Skip to content

Instantly share code, notes, and snippets.

Avatar

dan mackinlay danmackinlay

View GitHub Profile
View peakdetect.py
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))
@danmackinlay
danmackinlay / gist:1954656
Created Mar 2, 2012
gpu kernel panic report
View gist:1954656
Fri Mar 2 11:04:59 2012
panic(cpu 0 caller 0xffffff7f80a87907): NVRM[0/1:0:0]: Read Error 0x00000100: CFG 0xffffffff 0xffffffff 0xffffffff, BAR0 0xc0000000 0xffffff8115c2d000 0x0a5480a2, D0, P3/4
Backtrace (CPU 0), Frame : Return Address
0xffffff811560ae70 : 0xffffff8000220702
0xffffff811560aef0 : 0xffffff7f80a87907
0xffffff811560af80 : 0xffffff7f80b77a64
0xffffff811560afd0 : 0xffffff7f80b77b24
0xffffff811560b030 : 0xffffff7f80e24749
0xffffff811560b170 : 0xffffff7f80b96bad
0xffffff811560b1a0 : 0xffffff7f80a91282
View log.sc
/*
* file-based loggers, because logging to a GUI window is no good when SuperCollide does its segfault thing.
*/
NullLogger {
/* this parent class provdes a black hole logger so that you can stop
logging without changing code. */
formatMsg {|msgs|
var stampedMsgs = msgs;
//A nil in the first msg argument will be replaced by a datestamp
msgs[0].isNil.if({
View information_criticality_society.texjn
information and Phase Transitions in Socio-Economic Systems
Terry Bossomaier, Dan Mackinlay, Lionel Barnett...
\section{Introduction}
\label{sec:intro}
Diamonds are not a good very long term investment! They are steadily turning into graphite. It will take millions of years, but the most stable form of carbon at room temperature and pressure is graphite. Thus diamonds will undergo a phase transition to graphite, albeit over a very long timescale.
When we normally think of phase transitions we think of the states of matter, ice melting to water or water turning to steam. They are order/disorder transitions. In graphite the carbon atoms are linked together in layers. The layers can slide over one another giving graphite its excellent lubricant properties. In diamond the carbon atoms are linked together in a three dimensional structure with each carbon at the centre of a tetrahedron linked to carbons at all four corners. Thus carbon has to go through a major structural reorganization to change from diamond t
View information_criticality_society.tex
information and Phase Transitions in Socio-Economic Systems
Terry Bossomaier, Dan Mackinlay, Lionel Barnett...
\section{Introduction}
\label{sec:intro}
Diamonds are not a good very long term investment! They are steadily turning into graphite. It will take millions of years, but the most stable form of carbon at room temperature and pressure is graphite. Thus diamonds will undergo a phase transition to graphite, albeit over a very long timescale.
When we normally think of phase transitions we think of the states of matter, ice melting to water or water turning to steam. They are order/disorder transitions. In graphite the carbon atoms are linked together in layers. The layers can slide over one another giving graphite its excellent lubricant properties. In diamond the carbon atoms are linked together in a three dimensional structure with each carbon at the centre of a tetrahedron linked to carbons at all four corners. Thus carbon has to go through a major structural reorganization to change from diamond t
@danmackinlay
danmackinlay / bezier_smooth_plot.py
Created Jan 16, 2012
pure python bezier smoothing for matplotlib
View bezier_smooth_plot.py
"""
For http://stackoverflow.com/q/5255932
"""
def tangent_interpolate(index, x_array, y_array, dist=0.5):
before_index = max(index - 1, 0)
after_index = min(index + 1, len(x_array))
chord_vector_x = x_array[after_index] - x_array[before_index]
chord_vector_y = y_array[after_index] - y_array[before_index]
if dist>0:
@danmackinlay
danmackinlay / shrinkpdf.sh
Created Nov 25, 2011
reduce PDF file size by optimising it for screen viewing
View shrinkpdf.sh
#!/bin/bash
# copied from http://www.tatome.de/bliki/doku.php?id=projects:shrinkpdf
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
echo usage: shrinkpdf \<filename\> \<resolution\> \[\<output\>\]
exit
fi
if [ ! -e "$1" ]; then
echo "$1" does not exist. Exiting.
@danmackinlay
danmackinlay / run_script_with_args.sh
Created Nov 3, 2011
Submit jobs with arguments to openPBS
View run_script_with_args.sh
#!/bin/sh
# Because OpenPBS is fucked, it cannot pass arguments to scripts, but only set environment variables.
# So we build this sophisticated functionality for ourselves, using a tottering monolith of subtle and
# hairy code that shows how functionality such as this might be accomplished despite
# the fierce difficulty, and yet how it is clearly such a shambolic affair that it can not possibly have seemed
# reasonable to provide as a service to users
#
# Usage:
# qsub run_script_with_args.sh -v 'PBS_COMMAND=ls -l'
exec $PBS_COMMAND
@danmackinlay
danmackinlay / gdmp.py
Created Oct 18, 2011 — forked from tkf/gdmp.py
Command line tool for google-diff-match-patch
View gdmp.py
#!/usr/bin/env python
"""
Command line tool for google-diff-match-patch
"""
from diff_match_patch import diff_match_patch
HTMLTEMP = '''\
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
View welcome.md

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.