Skip to content

Instantly share code, notes, and snippets.

View danmackinlay's full-sized avatar

dan mackinlay danmackinlay

View GitHub Profile
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
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
/*
* 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({
@danmackinlay
danmackinlay / gist:1954656
Created March 2, 2012 01:36
gpu kernel panic report
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
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))
#!/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
@danmackinlay
danmackinlay / long_exposure.py
Last active August 29, 2015 14:12
Dirty hack to fake long exposure from a quicktime movie
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
@danmackinlay
danmackinlay / serialization.R
Created February 1, 2015 01:12
pas ssparse matrices between R and Python
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(
@danmackinlay
danmackinlay / gpd.py
Created October 5, 2016 06:19
Generalized Poisson Distribution for scipy.
import numpy as np
from scipy.stats import rv_discrete
from scipy.special import gamma, gammaln
class gpd_gen(rv_discrete):
"""
A Lagrangian Generalised Poisson-Poisson distribution.
``eta`` is the branching ratio,
@danmackinlay
danmackinlay / README.md
Created October 18, 2016 23:52
Fork of Alfred Klomp's excellent shrinkPdf.sh

Usage

Download the script by clicking the filename at the top of the box. Make it executable. If you run it with no arguments, it prints a usage summary. If you run it with a single argument – the name of the pdf to shrink – it writes the result to stdout:

./shrinkpdf.sh in.pdf > out.pdf

You can also provide a second filename for the output: