Skip to content

Instantly share code, notes, and snippets.


Robin Winslow nottrobin

View GitHub Profile
nottrobin /
Created Jun 9, 2022
Find latest commit, check for modified articles in it, check if it was added in this commit
#! /usr/bin/env bash
commit_id=$(git log --format="%H" -n 1)
articles=( $(git diff --name-only HEAD HEAD^ | egrep '^_articles') )
for article in "${articles[@]}"
article_added_in=$(git log --pretty=format:"%H" --diff-filter=A -- $article)
$ curl -I --resolve
HTTP/2 200
server: nginx/1.14.0 (Ubuntu)
date: Mon, 24 Aug 2020 22:21:24 GMT
content-type: text/html; charset=utf-8
content-length: 68552
vary: Accept-Encoding
strict-transport-security: max-age=15724800
cache-control: max-age=61, stale-while-revalidate=90
x-view-name: canonicalwebteam.templatefinder.templatefinder.template_finder
nottrobin / index.html
Created Jul 16, 2020
Simplest layout
View index.html
<!doctype html>
# Features:
- Keep CSS inline: It will be small enough not to add much weight to the page, which means it's better to avoid the extra HTTP call to request CSS
- Use system fonts: But it's hard to find a nice system font for both Linux, Windows and MacOS
multipass launch --name dotrun
DOTRUN_IP=$(multipass list | grep dotrun | egrep -o '\d+[.]\d+[.]\d+[.]\d+')
multipass exec dotrun -- mkdir shared
multipass exec dotrun -- chmod 777 shared
multipass exec dotrun -- sudo apt update
multipass exec dotrun -- sudo apt install --yes nfs-kernel-server
multipass exec dotrun -- bash -c 'echo "$HOME/shared,fsid=0,insecure,no_subtree_check,all_squash,async,anonuid=1000,anongid=1000)" | sudo tee -a /etc/exports'
multipass exec dotrun -- sudo exportfs -a
multipass exec dotrun -- sudo service nfs-kernel-server restart
mkdir $HOME/shared
nottrobin /
Last active Apr 22, 2020
Get discourse topic from
#! /usr/bin/env python3
import json
import os
import sys
import time
import urllib.request
topic_id = sys.argv[1]
nottrobin /
Last active Apr 9, 2020
A proof of concept script for authenticating with security API endpoints on
#! /usr/bin/env python3
# Standard library
import os
from http.cookiejar import MozillaCookieJar
# Packages
from macaroonbakery import httpbakery
nottrobin / settings.json
Created Mar 24, 2020
VSCode editor settings for black, flake8, html
View settings.json
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"editor.formatOnSave": true,
nottrobin /
Last active Feb 26, 2020
Sorting and search algorithms in Python - quick sort, merge sort, linear search, binary search
def quick_sort(items):
Worst-case complexity: O(n^2)
Best-case complexity: O(n log n)
Auxilliary space complexity: O(n), can be O(log n) if you're clever
pivot_item = items[-1]
#! /usr/bin/env bash
# ===
# This will pull down the server documentation from
# ===
set -euo pipefail
# Empty the documents directory, so we get fresh documents
nottrobin / nginx-sigterm.Dockerfile
Created Nov 15, 2019
nginx with SIGTERM immediately exits
View nginx-sigterm.Dockerfile
FROM nginx
RUN echo 'server {\n\
listen 80 default_server;\n\
location / {\n\
}' > /etc/nginx/conf.d/default.conf
CMD ["nginx", "-g", "daemon off;"]