Skip to content

Instantly share code, notes, and snippets.

@jsundram
jsundram / setup.sh
Last active July 3, 2023 13:34 — forked from bradp/setup.sh
New Mac Setup Script
# forked from https://gist.github.com/bradp/bea75b16d3325f5c47d4
# usage:
# 1) attach ssd to old machine and start running backup.sh
# 2) grab the latest version of this file from
# https://gist.github.com/jsundram/eeca472a8929bfab27209783b16bd6d9
# 3) copy this script onto the new machine and start running it
# sh setup.sh
# you will need to add homebrew to your .zprofile path
# PATH=$PATH:/opt/homebrew/bin
# echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zprofile
@jsundram
jsundram / get_lat_lon_exif_pil.py
Last active January 19, 2017 06:16 — forked from erans/get_lat_lon_exif_pil.py
Get Latitude and Longitude from EXIF using PIL
import PIL.Image
from PIL.ExifTags import TAGS, GPSTAGS
from operator import mul
def rekey(d, source):
"""Re-keys a dictionary d to use keynames from source mapping."""
return {encoding.get(k, k):v for (k, v) in d.iteritems()} if d else {}
def get_exif(image):
@jsundram
jsundram / index.html
Last active December 24, 2015 02:09 — forked from jrideout/index.html
Fixed filtering, legend order, minor code changes.
<!DOCTYPE html>
<html lang="en">
<head>
<title>dc.js multi-line chart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="http://nickqizhu.github.io/dc.js/css/dc.css"/>
<link rel="stylesheet" type="text/css" href="http://nickqizhu.github.io/dc.js/css/bootstrap.min.css"/>
import music21
import os
from collections import defaultdict
HAYDN = music21.corpus.getWork('haydn')
def title(h):
path, mvt = os.path.split(h)
mvt, ext = os.path.splitext(mvt)
qrt = os.path.basename(path)
@jsundram
jsundram / alignment.py
Last active December 16, 2015 10:49 — forked from mdboom/alignment.py
allow dynamic backend setting; name files after backend they were rendered from for clarity.
import matplotlib, sys
backend = sys.argv[1]
matplotlib.use(backend) # need to call use() before importing pyplot
from matplotlib.pyplot import *
text(0.1, 0.5, "Top Tj", verticalalignment="top")
text(0.2, 0.5, "Bottom Tj", verticalalignment="bottom")
text(0.3, 0.5, "Base Tj", verticalalignment="baseline")
text(0.4, 0.5, "Center Tj", verticalalignment="center")