Skip to content

Instantly share code, notes, and snippets.

@samuelleach
samuelleach / mysq_json.txt
Created June 11, 2015 14:36
Install JSON UDF for Mac OS 64bit
#via https://github.com/mysqludf/lib_mysqludf_json
#and https://github.com/mysqludf/lib_mysqludf_json/issues/2
git clone git@github.com:mysqludf/lib_mysqludf_json.git
cd lib_mysqludf_json
gcc -v $(/usr/local/bin/mysql_config --cflags) -shared -fPIC -o lib_mysqludf_json.so lib_mysqludf_json.c
sudo ln -s lib_mysqludf_json.so /Applications/XAMPP/xamppfiles/lib/mysql/plugin/.
@samuelleach
samuelleach / overpass.txt
Created June 12, 2015 16:18
Example use of OSM overpass API for extracting an OSM way to geojson
# With help from http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Query_by_element_id
sudo pip install overpass
overpass --timeout 500 'way(272386359)' test.geojson
@samuelleach
samuelleach / test.sh
Created August 20, 2015 09:06
Running scrapy on mac os
# http://stackoverflow.com/questions/21320585/cannot-set-up-a-scrapy-project
export DYLD_LIBRARY_PATH=$HOME/anaconda/lib

hello markdown

@samuelleach
samuelleach / eastnorth2lonlat.py
Created November 14, 2015 18:32
Convert Eastings/Northings to lon lat
import pyproj as pyproj
import pandas as pd
import numpy as np
df = pd.read_csv('SCOOT_Detectors.csv')
osgb36 = pyproj.Proj("+init=EPSG:27700")
eastnorth = np.apply_along_axis(func1d=lambda x: osgb36(x[0],x[1], inverse=True), arr=df[['EASTING', 'NORTHING']].values, axis=1)
@samuelleach
samuelleach / .bashrc
Last active December 11, 2015 19:49 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@samuelleach
samuelleach / README.md
Last active December 14, 2015 17:28 — forked from mbostock/.block
@samuelleach
samuelleach / git
Created March 26, 2013 09:15 — forked from chyld/git
# ----------------------------------------------------------------- #
REFERENCES
# ----------------------------------------------------------------- #
http://ndpsoftware.com/git-cheatsheet.html
# ----------------------------------------------------------------- #
BASIC
# ----------------------------------------------------------------- #
@samuelleach
samuelleach / index.html
Last active December 16, 2015 11:28 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.link {
stroke: #000;
}
.node {
fill: #ccc;
@samuelleach
samuelleach / README.md
Last active December 16, 2015 21:09
Force layout graph with colour-coded node neighbours.

First attempt at making a colour-coded graph, with code snippets inspired from the D3 community.

Green => Friend and follower.

Red => Follower

Blue => Friend.

Improvements needed: