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
'''Creates a directory based on the id in the line | |
and recursively downloads site files to a specified depth. | |
Files are save with directory structure of the site according | |
to the wget implementation. | |
Example site_list.txt file: | |
id_345 http://www.stackoverflow.com | |
id_367 http://stats.stackexchange.com | |
id_378 http://www.google.com |
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 wave, struct, numpy as np, matplotlib.mlab as mlab, pylab as pl | |
def wavToArr(wavefile): | |
w = wave.open(wavefile,"rb") | |
p = w.getparams() | |
s = w.readframes(p[3]) | |
w.close() | |
sd = np.fromstring(s, np.int16) | |
return sd,p | |
def wavToSpec(wavefile,log=False,norm=False): |
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 pyevolve import G1DBinaryString, GSimpleGA | |
import binascii, numpy as np | |
targ = np.array(list(str(bin(int(binascii.hexlify("Merry Christmas!"), 16))[2:]))) | |
genome = G1DBinaryString.G1DBinaryString(127) | |
genome.evaluator.set(lambda chromosome: sum(np.array(list(str(chromosome.getBinary()))) == targ)) | |
ga = GSimpleGA.GSimpleGA(genome,42) | |
ga.setGenerations(100) | |
ga.evolve(freq_stats=10) | |
print ga.bestIndividual() | |
print "".join(targ) |
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
#!/usr/bin/perl -w | |
# Perl hack to do network scanning using Dell 1600n printer/scanner/fax/copier. | |
# Read LICENCE section below for terms and conditions. | |
# Run with no args for usage. | |
# $Id: dell1600n-net-scan.pl,v 1.64 2010-09-19 16:19:33 jon Exp $ | |
# | |
# Jon Chambers, 2005-05-19 | |
# | |
# Contains excellent and gratefully received patches from: |
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
# Large (multi-GB), gzipped mysqldump file: dump.sql.gz | |
# Split into a file per table, but appending any header optimizations with SET and USE statements | |
zcat dump.sql.gz | awk '/DROP TABLE IF EXISTS/{n++}{print >"out" n " .sql" }' | |
# Creates n output files, for example 34, but the first "out.sql" with no number | |
# has all the header SET and USE statements. We need to prepend out.sql to every | |
# other outn.sql. We have to do this with a temporary outn.txt file and GNU Parallel | |
# (http://www.gnu.org/software/parallel/): | |
mv out.sql out.txt |