This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deBruijn(n, k): | |
''' | |
An implementation of the FKM algorithm for generating the de Bruijn | |
sequence containing all k-ary strings of length n, as described in | |
"Combinatorial Generation" by Frank Ruskey. | |
''' | |
a = [ 0 ] * (n + 1) | |
def gen(t, p): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdout, stderr | |
# Enable tab completion if readline is available. Rather than using the | |
# default completer, though, we allow tabs at the beginning of the line. | |
try: | |
import readline | |
readline.is_libedit = 'libedit' in readline.__doc__ | |
except ImportError: | |
pass | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AAABAACAADAAEAAFAAGAAHAAIAAJAAKAALAAMAANAAOAAPAAQAARAASAATAAUAAVAAWAAXAAYAAZABABBABCABDABEABFABGABHABIABJABKABLABMABNABOABPABQABRABSABTABUABVABWABXABYABZACACBACCACDACEACFACGACHACIACJACKACLACMACNACOACPACQACRACSACTACUACVACWACXACYACZADADBADCADDADEADFADGADHADIADJADKADLADMADNADOADPADQADRADSADTADUADVADWADXADYADZAEAEBAECAEDAEEAEFAEGAEHAEIAEJAEKAELAEMAENAEOAEPAEQAERAESAETAEUAEVAEWAEXAEYAEZAFAFBAFCAFDAFEAFFAFGAFHAFIAFJAFKAFLAFMAFNAFOAFPAFQAFRAFSAFTAFUAFVAFWAFXAFYAFZAGAGBAGCAGDAGEAGFAGGAGHAGIAGJAGKAGLAGMAGNAGOAGPAGQAGRAGSAGTAGUAGVAGWAGXAGYAGZAHAHBAHCAHDAHEAHFAHGAHHAHIAHJAHKAHLAHMAHNAHOAHPAHQAHRAHSAHTAHUAHVAHWAHXAHYAHZAIAIBAICAIDAIEAIFAIGAIHAIIAIJAIKAILAIMAINAIOAIPAIQAIRAISAITAIUAIVAIWAIXAIYAIZAJAJBAJCAJDAJEAJFAJGAJHAJIAJJAJKAJLAJMAJNAJOAJPAJQAJRAJSAJTAJUAJVAJWAJXAJYAJZAKAKBAKCAKDAKEAKFAKGAKHAKIAKJAKKAKLAKMAKNAKOAKPAKQAKRAKSAKTAKUAKVAKWAKXAKYAKZALALBALCALDALEALFALGALHALIALJALKALLALMALNALOALPALQALRALSALTALUALVALWALXALYALZAMAMBAMCAMDAMEAMFAMGAMHAMIAMJAMKAMLAMMAMNAMOAMPAMQAMRAMSAMTAMUAMVAMWAMXAMYAMZANANBANCANDANEANFANGANHA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
RIN="6601234567" | |
PIN="12180" | |
SIS="sis.rpi.edu" | |
# Options for curl(1), e.g., -vvv for verbose and -s for silent. | |
CURLOPTS="-s" | |
# Use HTTPS if it's available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
if [ "$1" = "store" ]; then | |
echo -n "Archiving Subversion metadata... " | |
find . -name '.svn' -type d -print0 > .svn.tmp | |
xargs -0 tar cf .svn.tar < .svn.tmp | |
xargs -0 rm -Rf < .svn.tmp | |
rm -f .svn.tmp | |
echo "done." | |
elif [ "$1" = "restore" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Converts hex digits in big endian to an integer. *) | |
on fromHex(theDigits) | |
set theValue to 0 | |
repeat with theDigit in theDigits | |
set theValue to (theValue * 16) + (offset of theDigit in "0123456789ABCDEF") - 1 | |
end repeat | |
return theValue | |
end fromHex | |
(* Does a record have a certain key? (Hack.) *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lldb | |
class Executioner(object): | |
typemap = { | |
None: 'void', | |
int: 'int', | |
float: 'float', | |
str: 'char *', | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cracker for David Lougheed's Ciphode 0.06, by rgov. | |
# See www.davidlougheed.com/ciphode for details. | |
''' | |
printable is a set of all of the characters that can be easily typed. We can | |
use it to test whether a numkey decrypts the message into gibberish or not. | |
''' | |
from string import printable | |
def isprintable(string): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def modinv(n, mod): | |
''' | |
Lazily finds the multiplicative inverse of n modulo mod. | |
''' | |
for x in xrange(1, mod): | |
if (n * x) % mod == 1: return x | |
else: | |
raise ArithmeticError('%i has no multiplicative inverse modulo %i.' % (n, mod)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ps -Ac -o pid=,command= | grep -v 'launchd' | while read line; do | |
PID=$(echo $line | cut -f 1 -d ' ') | |
CMD=$(echo $line | cut -f 2- -d ' ') | |
cat <<EOF > /tmp/gdbscript | |
attach $PID | |
sharedlibrary update | |
info sharedlibrary |
OlderNewer