Skip to content

Instantly share code, notes, and snippets.

View wridgers's full-sized avatar

Will Ridgers wridgers

View GitHub Profile
@wridgers
wridgers / restRootPass.sh
Created July 19, 2012 08:55
A mysql password recovery utility.
#!/bin/bash
#
# resetRootPass script
#
# Recover lost root password of mysql database.
#
# By Willem Bermon
#
echo
@wridgers
wridgers / gist:3086828
Last active October 7, 2015 01:57
My vim keyboard reference file
-------- vim-commands ----------------------------------------------------------
// BASIC CONTROL
hjkl - move
i - insert mode
R - replace mode
o - insert new line below
O - insert new line above
// LINE MOTIONS
0 - start of line
sipRound : [4][64] -> [4][64];
sipRound [v0 v1 v2 v3] = [v0_3 v1_4 v2_3 v3_4]
where {
v0_1 = v0 + v1;
v1_1 = v1 << 13;
v1_2 = v1_1 ^ v0_1;
v0_2 = v0_1 << 32;
v2_1 = v2 + v3;
v3_1 = v3 << 16;
reddit.com
ycombinator.com
facebook.com
imgur.com
twitter.com
bbc.co.uk
channel4.com
youtube.com
@wridgers
wridgers / gq.sh
Created April 26, 2012 20:41
Leach lots of GQ videos, in HD.
#!/bin/sh
for i in `seq 1 10`;
do
wget -q "http://www.youtube.com/user/goingquantum/videos?page=$i" -O page.$i.txt
done
cat page.*.txt > total.txt
grep -o "/watch?v=\([^\"\&]*\)" total.txt | sed 's/\/watch?v=//g' | uniq > ids.txt
@wridgers
wridgers / dtm.c
Created March 28, 2012 23:41
a pretty small c deterministic turing machine
// could probably be much smaller given some work.
// compressed version
#include <stdio.h>
#define w while
#define b break
int i,j;char s='S',d[]="S0a0>S1a0>a0a0>a1a0>a-H--";struct t{t*l;t*r;char v;};
int main(int c, char**v){t*h=0;w(v[1][j]){t*n=new t;n->v=v[1][j];n->l=h;n->r=0;if(h)h->r=n;
h=n;++j;}w(1){if(!h->l)b;h=h->l;}w(1){if(s=='H')b;i=0;w(d[i]){if(s==d[i]&&h->v==d[i+1]){
s=d[i+2];h->v=d[i+3];t*m=new t;m->v='-';if(d[i+4]=='<'){if(!h->l){m->l=0;m->r=h;h->l=m;}
@wridgers
wridgers / tlds.txt
Created March 3, 2012 23:14
A list of all internet top level domains, line by line.
.aero
.asia
.biz
.cat
.com
.coop
.info
.int
.jobs
.mobi
@wridgers
wridgers / tlds.js
Created March 3, 2012 23:06
A list of all internet top level domains.
var generic = ['.aero', '.asia', '.biz', '.cat', '.com', '.coop', '.info', '.int', '.jobs', '.mobi', '.museum', '.name', '.net', '.org', '.pro', '.tel', '.travel', '.xxx'];
var us = ['.edu', '.gov', '.mil'];
var a = ['.ac', '.ad', '.ae', '.af', '.ag', '.ai', '.al', '.am', '.an', '.ao', '.aq', '.ar', '.as', '.at', '.au', '.aw', '.ax', '.az'];
var b = ['.ba', '.bb', '.bd', '.be', '.bf', '.bg', '.bh', '.bi', '.bj', '.bm', '.bn', '.bo', '.br', '.bs', '.bt', '.bv', '.bw', '.by', '.bz'];
var c = ['.ca', '.cc', '.cd', '.cf', '.cg', '.ch', '.ci', '.ck', '.cl', '.cm', '.cn', '.co', '.cr', '.cs', '.cu', '.cv', '.cx', '.cy', '.cz'];
var d = ['.dd', '.de', '.dj', '.dk', '.dm', '.do', '.dz'];
var e = ['.ec', '.ee', '.eg', '.eh', '.er', '.es', '.et', '.eu'];
var f = ['.fi', '.fj', '.fk', '.fm', '.fo', '.fr'];
var g = ['.ga', '.gb', '.gd', '.ge', '.gf', '.gg', '.gh', '.gi', '.gl', '.gm', '.gn', '.gp', '.gq', '.gr', '.gs', '.gt', '.gu', '.gw', '.gy'];
var h = ['.hk', '.hm', '.hn', '.hr', '.ht', '.hu'];
@wridgers
wridgers / .tmux.conf
Created February 7, 2012 16:05
tmux config file
# Make it use C-a, similar to screen..
unbind C-b
unbind l
set -g prefix C-a
bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf
set -g history-limit 1000
@wridgers
wridgers / rules.txt
Created December 10, 2011 18:18
Rules for C/C++ Turing Machine contest
-- RULES --
~ should be a single .c or .cpp file
~ must be written in C or C++ (C is a subset of C++)
~ entry must compile (of course)
~ must be a deterministic 1-tape TM as defined below
~ should accept the input string as a command-line argument (see Links for how to do this)
~ upon input, the program should output state:tape followed by a new line
~ the program should terminate once the state becomes H,Y, or N.
~ the delta function should be changeable (no hard coding the procedure!)
~ submissions should have a 'default' delta function that reverses the input string