Skip to content

Instantly share code, notes, and snippets.

View nottrobin's full-sized avatar

Robin Winslow nottrobin

View GitHub Profile
@nottrobin
nottrobin / letter to MP about Gaza and UNRWA.md
Last active February 6, 2024 23:43
letter to MP about Gaza and UNRWA

Dear Victoria Prentis,

This is the only the third time I have written to you. I write now concerning what is by far the most important current issue to me, which will definitely be deciding my vote in the next election.

On January 26th, the International Court of Justice ruled that South Africa has a good case for charging Israel with genocide of the Palestinian people.

As I'm sure you're aware, under the genocide convention, all signatories (Britain included) are required to intervene to prevent any genocide they observe from happening. More directly, in the ICJ's ruling of provisional measures on January 26th, they specifically called on said signatories, along with Israel, to ensure that humanitarian assistance is provided to Gazans.

The United Nation's Relief and Works Agency (UNRWA) is by far the single most important organisation providing such humanitarian aid to Gazans effected by the horrifying crisis in Gaza, and it was able to do this in large part due to Britain's support.

@nottrobin
nottrobin / update_topics.py
Created August 2, 2022 10:38
Add "web-and-design" topic to all our team's repos
import requests
import json
from github import Github
token = "REPLACE_ME"
g = Github(token)
org = g.get_organization("canonical")
teams = org.get_teams()
@nottrobin
nottrobin / find-changed-files.sh
Created June 9, 2022 21:13
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[@]}"
do
article_added_in=$(git log --pretty=format:"%H" --diff-filter=A -- $article)
@nottrobin
nottrobin / curl-ubuntu-boston.sh
Created August 24, 2020 22:21
Curl Ubuntu Boston
$ curl -I --resolve 91.189.91.44:443:ubuntu.com https://ubuntu.com
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
nottrobin / index.html
Created July 16, 2020 16:22
Simplest layout
<!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
-->
<html>
@nottrobin
nottrobin / set-up-dotrun-macos.sh
Created July 1, 2020 08:37
Set up dotrun on mac
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 192.168.64.0/24(rw,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
nottrobin / get-discourse-topic.py
Last active April 22, 2020 20:26
Get discourse topic from discourse.ubuntu.com
#! /usr/bin/env python3
import json
import os
import sys
import time
import urllib.request
topic_id = sys.argv[1]
@nottrobin
nottrobin / post-cve.py
Last active April 9, 2020 14:18
A proof of concept script for authenticating with security API endpoints on ubuntu.com
#! /usr/bin/env python3
# Standard library
import os
from http.cookiejar import MozillaCookieJar
# Packages
from macaroonbakery import httpbakery
@nottrobin
nottrobin / settings.json
Created March 24, 2020 14:49
VSCode editor settings for black, flake8, html
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length",
"79"
],
"editor.formatOnSave": true,
@nottrobin
nottrobin / sorting_and_search_algorithms.py
Last active February 26, 2020 16:33
Sorting and search algorithms in Python - quick sort, merge sort, linear search, binary search
def quick_sort(items):
"""
https://en.wikipedia.org/wiki/Quicksort
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]