Pragmatism in the real world
rst2pdf is a Python 2 application that we're making compatible with Python 3. When developing Python applications, I've found it useful to be able to switch python versions easily and also set up clean environments to work in. To do this, I currently use pyenv. This is how I set it up: Install Pyenv On my Mac, I install pyenv & its sister project pyenv-virtualenv with Homebrew: $ brew install readline xz $ brew install… continue reading.
I really like the 1Password password manager and recently switched to using the subscription based account. This allows access to my passwords via the web so, as you can imagine, I have a very strong 35 character master password set. On my Mac, I use the 1Password app and that requires me to enter my master password reasonably frequently, so this very long password is not so desirable here. I'm comfortable that a 12 character… continue reading.
Azure App Service is a way to host your web application in a container without having to think about the server. It's the same PaaS concept as AWS Elastic Beanstalk and supports all the main web programming languages. It also supports Windows and Linux OS containers. I have a client that is moving an on-premises PHP application to App Service and so have been looking at what I needed to do to deploy it there.… continue reading.
I've been trying to solve an issue with the rst2pdf Sphinx extension which allows you to use rst2pdf to create a PDF of your Sphinx documentation rather than using Sphinx's default pdfTeX builder. In order to understand what was happening, I really wanted to inspect variable at certain stages of the process, which is easiest with a step debugger. As I already use PhpStorm for step debugging PHP, I fired up PyCharm and worked out… continue reading.
Part two of my article on using Serverless PHP using Bref has been published! In part one, I introduced Bref as we wrote a simple "Hello World" application. Part follows this up exploring a more complete serverless application, my Project365 website. This S3 hosted static website is build using a serverless PHP function that connects to the Flickr API to retrieve my my one-photo-per-day images and present them on a single page per year. In… continue reading.
I regularly print to PDF on my Mac, This is done from the print dialog by selecting Save as PDF from the drop down in the bottom left of the dialog which is a bit of a pain to get using the mouse. I recently discovered that I could create a keyboard shortcut to make this much easier. In System Preferences -> Keyboard -> Shortcuts -> App Shortcuts you can create a keyboard shortcut to… continue reading.
I have a handy bash script that transcodes videos using Don Meton's video_transcoding tools. This script was written in a hurry and one limitation it had was that it re-transcoded any source file even if the output file already existed. The script looked like this: #!/usr/bin/env bash readonly source_dir="${1:-MKV}" readonly output_dir="${2:-MP4}" for file in "$source_dir"/*.mkv; do ./transcode.sh "$file" "$output_dir" done What it should do is only run transcode.sh if the output file doesn't exist, so… continue reading.
I'm trying to tighten up the policies of my AWS Lambda function so that it only has access to the one S3 bucket that it needed, so I added an S3CrudPolicy with the BucketName referencing the bucket that's defined in the template. The relevant part of template.yaml looks like this: Resources: ImagesBucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub "${ProjectName}-${UniqueKey}-images" ResizeFunction: Type: AWS::Serverless::Function Properties: FunctionName: resize # … Events: CreateThumbnailEvent: Type: S3 Properties: Bucket: !Ref ImagesBucket Events:… continue reading.
When creating an API with AWS Lambda and Api Gateway, I discovered that a client request to a given resource with a verb that wasn't supported resulted in an unexpected response. You can see this from this curl command to the /test resource which is only defined for GET: $ curl -i -X PUT https://mh5rwr9q25.execute-api.eu-west-2.amazonaws.com/prod/test HTTP/2 403 content-type: application/json content-length: 42 {"message":"Missing Authentication Token"} Given that I can GET the /Prod/hello resource, I would not… continue reading.