Skip to content

Instantly share code, notes, and snippets.

@huyng
huyng / matplotlibrc
Created February 8, 2011 15:50
my default matplotlib settings
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@mjhoy
mjhoy / Makefile
Last active December 19, 2022 04:44
Costa Rica shaded relief
all: hill-relief.jpg costarica_min_topo.json
# -------------
# Relief raster
# -------------
#
# Notice the `zip` file requirements here have no download.
# You will need to search for them online. They are from the
# SRTM project: http://www2.jpl.nasa.gov/srtm/
# (which appears to have multiple versions of files).
@gka
gka / textWidth.js
Created November 14, 2013 15:58
Approximate text width based on estimated character widths...
var textWidth = (function() {
function charW(w, c) {
if (c == 'W' || c == 'M') w += 15;
else if (c == 'w' || c == 'm') w += 12;
else if (c == 'I' || c == 'i' || c == 'l' || c == 't' || c == 'f') w += 4;
else if (c == 'r') w += 8;
else if (c == c.toUpperCase()) w += 12;
else w += 10;
return w;
}
@emeeks
emeeks / edgelist.csv
Last active March 1, 2021 10:49
Arc Diagram with Directed Edges
source target weight
sam tully 3
sam pat 8
sam kim 2
sam pris 1
roy pris 5
roy sam 1
tully sam 1
tully pris 5
tully kim 3
@mbostock
mbostock / server.js
Created December 12, 2011 18:38
Node + MySQL + JSON
process.env.TZ = "UTC";
var util = require("util"),
express = require("express"),
gzip = require("connect-gzip"),
mysql = require("mysql");
var client = mysql.createClient({
host: /* mysql host, e.g., "host.example.com" */,
port: /* mysql port, e.g., 3306 */,
@mbostock
mbostock / .block
Last active August 2, 2019 22:07
Ordinal Brushing
license: gpl-3.0
redirect: https://observablehq.com/@d3/ordinal-brushing
@emeeks
emeeks / edgelist.csv
Last active July 6, 2019 00:24
Adjacency Matrix from Node/Edge List
sam tully 3
sam pat 8
sam kim 2
sam pris 1
roy pris 5
roy sam 1
tully sam 1
tully pris 5
tully kim 3
@tmcw
tmcw / foursquare_to_geojson.py
Created August 20, 2012 20:53
Turn your Foursquare Data Archive into a GeoJSON file
import glob, json
# this script loves this script
# https://gist.github.com/3350235
points = []
vids = set()
places = glob.glob("checkins/*.json")
for p in places:
@tmcw
tmcw / foursquare_archive.py
Created August 14, 2012 15:19
Simple Foursquare Checkins Archive of one User
import requests, os, glob, json, sys, webbrowser
you = 'self'
data = 'checkins'
try: os.mkdir(data)
except Exception: pass
cid = 'YOUR_CLIENT_ID'
@drio
drio / README.md
Created January 22, 2012 14:53
Playing with pthreads

What's this?

I was/am in the process of adding multithreading capabilities to a tool I am working on (more on that soon). The tool is written in C/C++. My first option was using POSIX threads (pthreads) before going into higher level options like boost.

I first read this