Skip to content

Instantly share code, notes, and snippets.

Avatar

William Budington Hainish

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am hainish on github.
  • I am legind (https://keybase.io/legind) on keybase.
  • I have a public key ASDaovI-hi51KbddS-wQy0LhSRuR4YMsvBYdXBs1ptpsVwo

To claim this, I am signing this object:

View set_xconf_keybindings.sh
#!/bin/bash
if [ "$1" == "awesome" ]; then
for x in `seq 1 8`; do
xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Super><Shift>$x" -n -t string -s "move_window_workspace_${x}_key"
xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Primary><Alt>KP_$x" -r
xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Super>$x" -n -t string -s "workspace_${x}_key"
xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Primary>F$x" -r
done
View pilindrome.rs
fn main() {
let mut n = 2_i32;
let mut prob = 1_f64;
loop {
let this_prob = 1_f64 - (1_f64 / 10_f64.powi(n / 2));
prob *= this_prob;
println!("{}", 1_f64 - prob);
n += 1
}
}
@Hainish
Hainish / erdos-woods.py
Created Sep 15, 2016
Proof that 16 is an Erdős-Woods number
View erdos-woods.py
from fractions import gcd
k = 16
a = 0
while True:
ew = True
for i in xrange(a+1, a+k):
if gcd(i, a) == 1 and gcd(i, a+k) == 1:
ew = False
@Hainish
Hainish / fetchtest.go
Last active May 5, 2016 — forked from jehiah/fetchtest.go
Ensure we close connections (no KeepAlives)
View fetchtest.go
package main
import (
"bufio"
"errors"
"flag"
"fmt"
"net/http"
"os"
"sync"
View pgp key notification script
#!/usr/bin/python
import fileinput
import re
import subprocess
contents = ""
for line in fileinput.input():
contents = contents + line
from_address = re.match('(From )([^\s]+) ', contents).group(2)
View keybase.md

Keybase proof

I hereby claim:

  • I am Hainish on github.
  • I am legind (https://keybase.io/legind) on keybase.
  • I have a public key whose fingerprint is 977A 04EC 512A 9D0D B4A5 6E0E CDCA E8ED 6842 C592

To claim this, I am signing this object:

@Hainish
Hainish / webshims_asset_compile.rake
Created May 4, 2015
Create symlinks for non-digest webshim assets in /public/
View webshims_asset_compile.rake
# Rails4 doesn't create un-fingerprinted assets anymore, but we
# need a couple for webshims inclusion. Let's try to hook in and make
# symlinks.
# Lifted from team-umlaut/umlaut
require 'pathname'
# Every time assets:precompile is called, trigger webshims:create_non_digest_assets afterwards.
@Hainish
Hainish / rake_completion.sh
Created Oct 2, 2012
rake bash completion
View rake_completion.sh
# bash completion for rake
# Installation: cat rake_completion.sh >> ~/.bashrc
# Or, maybe: cat rake_completion.sh > /etc/bash_completion.d/rake
# checksecs is the number of seconds between checking for new rake tasks
checksecs=600
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
if [[ "`which md5`" != "" ]]; then