Skip to content

Instantly share code, notes, and snippets.

View nottrobin's full-sized avatar

Robin Winslow nottrobin

View GitHub Profile
@nottrobin
nottrobin / random-open-port.sh
Created October 5, 2015 17:11
Get a random available port number between 2000 and 65000
#!/usr/bin/env bash
# (From https://gist.github.com/nottrobin/f4edb323174076f3cc05)
# Get random port between 2000 and 65000
PORT=$(shuf -i 2000-65000 -n 1)
# Check it's open
while nc -z 127.0.0.1 ${PORT}; do
PORT=$(shuf -i 2000-65000 -n 1)
done
@nottrobin
nottrobin / update-from-remote.sh
Last active October 8, 2015 07:40
Update a git directory to the head of a specific branch, from a specified remote
#!/usr/bin/env bash
# (From: https://gist.github.com/nottrobin/def07af07fbe1f68317c)
# Update a git dir, either by cloning it or pulling changes down
# Usage:
# update-from-remote ${branch} ${git_url} ${dir_path}
branch=$1
git_url=$2
dir_path=$3
@nottrobin
nottrobin / oom_kill-shortcut.sh
Created September 28, 2015 11:01
oom_kill keyboard shortcut
# Kill the process taking up the most memory
alt + SysRq + f
@nottrobin
nottrobin / update-sysctl-config.sh
Created September 28, 2015 10:59
Update sysctl config
sudo sysctl --system
@nottrobin
nottrobin / enable-sysrq.ini
Last active September 28, 2015 10:58
Enable SysRq keyboard commands in Ubuntu
# /etc/sysctl.d/10-magic-sysrq.conf
kernel.sysrq = 1
@nottrobin
nottrobin / response-ception.md
Last active September 9, 2015 23:30
My response to David's response to my response to his response to my open letter about the refugee crisis

Here's my response to David's final response to [my response][] to his response to [my open letter][] about the refugee crisis.


Hi David

I guess you're probably right. Thanks for replying all the same.

Kind regards,
Robin

@nottrobin
nottrobin / my-response-to-david-mackintosh.md
Last active September 9, 2015 23:22
My response to David Mackintosh's response to my open letter about the refugee crisis

David Mackintosh responded to [my open letter][] about the current refugee crisis.

Below is my response to him - his response is quoted below mine.

David has since sent [a final response][], not to address by further points, but simply to say that we clearly don't agree.


Hi David

@nottrobin
nottrobin / refugee-letter.md
Last active September 9, 2015 13:14
An open letter to David Mackintosh, my conservative MP, about the response to the refugee crisis.

FYI, David Mackintosh responded (rather promptly) to my open letter below, and then [I responded to him][].


Dear David Mackintosh,

I am ashamed of our government's response to the refugee crisis.

The UK is lagging far behind all other wealthy EU nations in their commitment to sheltering refugees of the Syrian crisis. I am aware that David Cameron recently stated that the UK will take 20,000 migrants over [the next 5 years][], but this is still a tiny drop in the ocean and pales in comparison to the response from other EU nations: Germany let 20,000 migrants into the country [this weekend alone][].

@nottrobin
nottrobin / update-git-dir.sh
Last active September 4, 2015 13:22
helper function for updating a directory path with a git project
function update_git_dir {
# Update a git dir, either by cloning it or pulling changes down
# Usage:
# update_git_dir ${branch} ${git_url} ${dir_path}
branch=$1
git_url=$2
dir_path=$3
git clone --depth 1 -b ${branch} ${git_url} ${dir_path} || (
@nottrobin
nottrobin / proxy-settings.py
Created August 17, 2015 12:25
Django settings to enable absolute URLs from behind a proxy
# Setup support for proxy headers
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')