Skip to content

Instantly share code, notes, and snippets.

andystanton /
Last active July 30, 2017 16:15
Ghost2Jekyll: Converts ghost 0.4.2 sqlite db posts to jekyll 2.3.0 markdown posts.
#!/usr/bin/env python3
# This script is provided to show how I migrated from Ghost 0.4.2
# to Jekyll 2.3.0 and is used at your own risk. Back up your blog
# before trying it out.
def getPostTemplate():
with open('', 'r') as f:
posttemplate =
andystanton / lightbox.rb
Last active September 23, 2015 09:30 — forked from melborne/lightbox.rb
# A Liquid tag for Jekyll sites that allows embedding Lightbox images.
# Adapted to work with
# as well as allowing remote image urls and commas in image titles.
# original author: kyoendo
# modified by: andystanton
# original Source URL:
# modified Source URL:
andystanton / Start up local Docker Machine on OSX
Last active April 3, 2024 00:50
Start up local Docker Machine on OSX automatically.


This script is no longer required with Docker for Mac which includes an option to run Docker at startup and doesn't use docker-machine to administer the local Docker engine.


  • Docker Machine + Docker
  • curl
  • A Virtualbox-driven Docker Machine called "default" docker-machine create --driver virtualbox default (this is the default with Docker toolkit).
andystanton / JVM DNS TTL
Last active November 15, 2022 08:17
A script that inspects the DNS TTL for a JVM in a supplied Docker image.

A script that inspects the DNS TTL for a JVM in a supplied Docker image. The image must also contain a JDK.

It does this by generating a Docker image containing a Java program that outputs the JVM's DNS TTL and executing this, then cleaning up the container, image and temporary files.


$ ./ openjdk:8
andystanton / Tiny Python 3 HTTP 1.1
Last active March 25, 2024 22:43
Tiny Python 3 HTTP/1.1 Server


This is a Python 3 HTTP/1.1 server bound to on port 8000 using only the standard library.


I wanted a simple Python 3 web server using HTTP 1.1 that can perform simple HTTP operations and depends only on Python and standard library modules. I couldn't find an example so I made one.

The example demonstrates how to accept different methods, parse the url and query strings, read data sent to the server, parse and return json, return responses with different status codes and headers, handle graceful termination, and override the default error logging.

andystanton / Polygon Angle
Last active July 15, 2024 15:30
Polygon Angle Visualiser in Pythonista

Polygon Angle Visualiser

A Pythonista script that displays a polygon and its internal angle.

Swiping left and right causes the number of sides to increase or decrease.