I hereby claim:
- I am simonhayward on github.
- I am simonhayward (https://keybase.io/simonhayward) on keybase.
- I have a public key whose fingerprint is C78E AB4C 3CCB 8657 CC05 011F 8AC0 2148 9CC8 9FA0
To claim this, I am signing this object:
| package main | |
| import ( | |
| "log" | |
| "net/http" | |
| ) | |
| func logRequest(handler http.Handler) http.Handler { | |
| return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
| log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL) |
| """ | |
| https://florian.github.io/reservoir-sampling/ | |
| - Store the first k elements as the reservoir elements | |
| - For the i-th element, add it to the reservoir with a probability of k/i. | |
| This is done by replacing a randomly selected element in the reservoir | |
| """ | |
| import random | |
| import sys | |
I hereby claim:
To claim this, I am signing this object:
| import logging | |
| from django.db import DEFAULT_DB_ALIAS, connections | |
| from django.db.migrations.loader import MigrationLoader | |
| def migrations_have_applied(): | |
| """ | |
| Check if there are any migrations that haven't been applied yet | |
| """ |
| export SSH_AUTH_SOCK=/home/simon/.ssh-socket | |
| ssh-add -l >/dev/null 2>&1 | |
| if [ $? = 2 ]; then | |
| # No ssh-agent running | |
| rm -rf $SSH_AUTH_SOCK | |
| # >| allows output redirection to over-write files if no clobber is set | |
| ssh-agent -a $SSH_AUTH_SOCK >| /tmp/.ssh-script | |
| source /tmp/.ssh-script | |
| echo $SSH_AGENT_PID >| ~/.ssh-agent-pid |
| # UTF-8 | |
| export LC_ALL=en_GB.UTF-8 | |
| export LANG=en_GB.UTF-8 | |
| export LANGUAGE=en_GB.UTF-8 | |
| export EDITOR=/usr/bin/vim | |
| # tailoring 'less' | |
| ####################################################### | |
| alias more='less' |
| " filetype plugin on | |
| " filetype indent on | |
| " Pathogen load | |
| filetype off | |
| call pathogen#infect() | |
| call pathogen#helptags() | |
| filetype plugin indent on | |
| syntax on |
| #!/bin/sh | |
| BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
| if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "master" ]; then | |
| echo "[$BRANCH_NAME] $(cat $1)" > $1 | |
| fi |
| # This file has been auto-generated by i3-config-wizard(1). | |
| # It will not be overwritten, so edit it as you like. | |
| # | |
| # Should you change your keyboard layout somewhen, delete | |
| # this file and re-run i3-config-wizard(1). | |
| # | |
| # i3 config file (v4) | |
| # | |
| # Please see http://i3wm.org/docs/userguide.html for a complete reference! |
| from string import ascii_uppercase as uc, ascii_lowercase as lc, maketrans | |
| def rot_func(text, encode=True, rotate=13): | |
| letters = uc + lc | |
| rot = "".join((x[:rotate][::-1] + x[rotate:][::-1])[::-1] for x in (uc,lc)) | |
| src, trg = (letters, rot) if encode else (rot, letters) | |
| trans = maketrans(src, trg) | |
| return text.translate(trans) |