Skip to content

Instantly share code, notes, and snippets.

View drewcummins's full-sized avatar

Andrew Cummins drewcummins

View GitHub Profile

Keybase proof

I hereby claim:

  • I am drewcummins on github.
  • I am mathsive (https://keybase.io/mathsive) on keybase.
  • I have a public key ASC2dbIu8Jh6g-5YcIN3faNdAoVnD92B7oZmYrMzvxR8OAo

To claim this, I am signing this object:

wget http://www.fisica.net/relatividade/stephen_hawking_a_brief_history_of_time.pdf -O bhot.pdf
pdftotext -enc UTF-8 bhot.pdf
tail -n +12 bhot.txt | say -v Fred
Verifying my Blockstack ID is secured with the address 1EQRQ7DCavGDzhvWxhB4w83SXvu9M57PBr https://explorer.blockstack.org/address/1EQRQ7DCavGDzhvWxhB4w83SXvu9M57PBr
@drewcummins
drewcummins / gist:2769933
Created May 22, 2012 15:54
xth unique ordered pair in {1..n} set
#
# Gets the symbol index that begins matching the x'th pair in an n-length set
#
# (1) sum {1,2..n} = (n+1)*n/2
# (2) ith symbol starts at i*n - sum {1,2,..i}
# (3) substitute 1 into 2 and equate to the pair index, x
# i*n - (i+1)*i/2 = x
# (4) solve for i
# i = 1/2 * (-sqrt(4n^2 - 4n - 8x + 1) + 2n - 1)
# (5) solve for j
@drewcummins
drewcummins / gist:1230261
Created September 20, 2011 20:43
Haskell Lol Server
import System.IO
import Network.Socket
import Network (PortID(..))
import System.Environment
import Control.Concurrent
import Control.Monad
import Control.Monad.Fix (fix)
import Data.Char
import Data.List.Split
import System.IO.Error
@drewcummins
drewcummins / gist:1229062
Created September 20, 2011 13:27
RRobot Installer
#!/bin/bash
if [ -e /opt/local/bin/ruby ]
then
echo 'Not going to install as this might muck up your current ruby installation'
exit 1
fi
if [ ! -e /opt/local/bin/port ]
then