Skip to content

Instantly share code, notes, and snippets.

Rob dwo

  • London, UK
Block or report user

Report or block dwo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dwo /
Created Apr 29, 2019
Generate a simple passphrase
cat /usr/share/dict/words | grep -E "^[a-z]{4,8}$" | gshuf -n 4 | paste -s -d " " -
import csv
import re
tweets = set()
with open('tweets.csv', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in reader:
tweet = unicode(row[5], 'utf-8')
dwo /
Created Feb 16, 2016
See what files get opened by a process on OSX
sudo dtruss -t open -p PID
dwo / 0_deterministic_sample.rb
Last active Aug 29, 2015
Choosing random array members deterministically based on contents of array and a name string
View 0_deterministic_sample.rb
require 'backports/1.9.1' if RUBY_VERSION < '1.9.1'
require 'backports/1.9.2' if RUBY_VERSION < '1.9.2'
require 'digest'
class Array
def deterministic_sample(n, name='')
seed = Digest::SHA1.hexdigest( << name).to_i(16)
prng =
self.sort.sample(n, :random => prng)
dwo / Makefile
Created May 9, 2015
Resizing images from one folder to another with ImageMagick and GNU Make
View Makefile
source_files := $(wildcard src/*.jpg)
resized_files := $(source_files:src/%.jpg=resized/%.jpg)
all: $(resized_files)
resized/%.jpg: src/%.jpg
convert $< -resize 1920x1080 $@
dwo / 01_QR.scala
Last active Dec 19, 2015
Quine Relay on Mac OS X 10.7.5
View 01_QR.scala
object QR extends App{println("(display \"printf %s \\\"Transcript show: 'puts [regsub -all {.} \\\\\\\"};0 nruter;)\\\\\\\\\\\\\\\"eludomdne dne;)\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\(yalpsid\\\\\\\\\\\\$\\\\\\\\\\\\\\\"(tnirp};)\\\\\\\\\\\\\\\";)\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\ n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\t\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"(tnirp;)\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"t\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"?0>2%)j>>\\\\\\\\]1-i\\\\\\\\[s((tnirp)--j;0=>j;6=j(rof;)\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\(etirw\\\\\\\\\\\\$\\\\\\\\\\\\\\\"(tnirp{)++i;htgnel.s=<i;1=i(rof;)\\\\\\\\\\\\\\\" nigeb laitini;RQ eludom\\\\\\\\\\\\\\\"(tnirp;j,i tni;)\\\\\\\\\\\\\\\";RQ dne;)\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\DNE)\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\}s tnirp;)s,\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install build-essential autoconf automake libprotobuf-dev \
protobuf-compiler libncurses5-dev zlib1g-dev libio-pty-perl
protobuf_CFLAGS=" " protobuf_LIBS="-lprotobuf" ./configure --prefix="/usr"
sed -i s/LITE_RUNTIME/SPEED/ src/protobufs/*.proto
dwo /
Created Dec 13, 2012
I used this to delete all my gems once
GEMS=`gem list --no-versions`
for x in $GEMS ; do gem uninstall -x --ignore-dependencies $x; done
dwo /
Last active Oct 7, 2015
what's taking up all the space?
du -sm * | sort -nr | head -25
dwo /
Created Jul 18, 2012
my bash script for pulling all projects and updating ctags
for i in `find . -type d -maxdepth 1`; do
echo $i
cd $i
git pull --rebase && git submodule update --init --recursive
ctags -R * > /dev/null
cd $CWD
You can’t perform that action at this time.