View peakdetect.py
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 | |
from math import pi, log | |
import pylab | |
from scipy import fft, ifft | |
from scipy.optimize import curve_fit | |
i = 10000 | |
x = np.linspace(0, 3.5 * pi, i) | |
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 * | |
np.random.randn(i)) |
View mysql2sqlite.sh
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/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
View long_exposure.py
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 os | |
import tempfile | |
import subprocess | |
import skimage | |
from skimage import exposure | |
import skimage.io as io | |
import argparse | |
import shutil | |
import numpy as np |
View serialization.R
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
library(rhdf5) | |
load.sparse.hdf = function (filename, path) { | |
idx = as.vector(h5read(filename, paste(path, "v_indices", sep="/"))) | |
idxptr = as.vector(h5read(filename, paste(path, "v_indptr", sep="/"))) | |
vals = as.vector(h5read(filename, paste(path, "v_data", sep="/"))) | |
dims = as.vector(h5read(filename, paste(path, "v_datadims", sep="/"))) | |
col.names = h5read(filename, paste(path, "v_col_names", sep="/")) | |
data = sparseMatrix( |
View prowl_monitor.py
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/env python | |
""" | |
load-monitoring script that pushes notifications to growl when something goes wrong | |
requires jacobb's prowlpy http://github.com/jacobb/prowlpy/tree/master - and a prowl | |
account (http://prowl.weks.net/) | |
this version, with a "panic" function, is untested. | |
""" |
View lock.py
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
""" | |
various ways of acquiring cross-process locks on a string including a django one | |
http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/ | |
needs test coverage, but won't get it here since I've just removed it from the project. | |
`with` statement requires python 2.5 or later; these may work as non-with statement doohickeys | |
django locks require version 1.0 or later to get the "force_insert" argument | |
""" |
View mysql_logger.lua
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
local log_file = 'mysql.log' | |
local fh = io.open(log_file, "a+") | |
function read_query( packet ) | |
if string.byte(packet) == proxy.COM_QUERY then | |
local query = string.sub(packet, 2) | |
local q = query | |
local cutoff = 160 | |
if cutoff < #query then | |
q = query:sub(1, cutoff) .. "..." |
View supervisord.ini
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
[program:queuewalker] | |
command = /project_path/manage.py process_queue | |
redirect_stderr = true | |
user=www-data | |
umask=002 | |
[supervisord] | |
logfile = /var/log/supervisord.log | |
logfile_maxbytes = 50MB | |
logfile_backups=10 |
View friendfeed_private_syndicator.py
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
# −*− coding: UTF−8 −*− | |
""" | |
quick/dirty private feed exposer | |
http://friendfeed.com/api/documentation | |
http://www.dalkescientific.com/Python/PyRSS2Gen.html | |
http://code.google.com/p/httplib2/ | |
http://labix.org/python-dateutil | |
""" | |
import settings | |
from settings import FF_BASE_URL, FF_API_BASE_URL, FF_REMOTE_KEY, FF_FEED, FF_NICKNAME, FF_CONSUMER_SECRET, OUTPUT_CACHE_DIR, INPUT_CACHE_DIR |
View index.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>NetCultures blog test</title> | |
<style type="text/css" media="screen"> | |
#header h1 { | |
color: pink; | |
} | |
#header { |
OlderNewer