Skip to content

Instantly share code, notes, and snippets.

View mlevans's full-sized avatar

Michael Lawrence Evans mlevans

  • Office of Emerging Technology, City of Boston
  • Boston, MA
View GitHub Profile
@mlevans
mlevans / polygonize.py
Created April 26, 2012 03:39 — forked from migurski/polygonize.py
Polygonize a bag of lines
from sys import argv
from shapely.ops import polygonize
from shapely.geometry import asShape, LineString
import json
if __name__ == '__main__':
input = argv[1]
input = json.load(open(input))
@mlevans
mlevans / lambert.js
Created May 15, 2012 00:13 — forked from migurski/lambert.js
Lambert projection for Modest Maps
var LambertProjection = function(lat0, lon0, lat1, lat2, xmin, ymin, xmax, ymax)
{
var pi = Math.PI, ln = Math.log, pow = Math.pow,
sin = Math.sin, cos = Math.cos, tan = Math.tan,
atan = Math.atan, sqrt = Math.sqrt;
function sec(t) { return 1 / cos(t); }
function cot(t) { return 1 / tan(t); }
function deg2rad(deg) { return pi * deg / 180; }
@mlevans
mlevans / latency.txt
Created May 31, 2012 23:41 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@mlevans
mlevans / gunicorn-slayer.py
Created June 21, 2012 08:23 — forked from migurski/gunicorn-slayer.py
Gunicorn Slayer
from sys import argv
from time import time
from glob import glob
from os import stat, kill, getuid
from os.path import basename, dirname, join
from datetime import datetime
from random import choice
from signal import SIGTERM
if __name__ == '__main__':
@mlevans
mlevans / index.html
Created June 24, 2012 21:31 — forked from jasondavies/index.html
Multiple sparkline transition strangeness
<!DOCTYPE html>
<html>
<head>
<title>Animated Sparkline</title>
<script src="http://mbostock.github.com/d3/d3.js?2.7.2"></script>
<style type="text/css">
path {
stroke: steelblue;
stroke-linecap: round;
@mlevans
mlevans / index.html
Created November 2, 2012 22:42 — forked from zzolo/index.html
A basic pack layout with D3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MinnPost</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>
<link rel="shortcut icon" href="http://www.minnpost.com//sites/default/themes/siteskin/favicon.ico" type="image/x-icon" />
<meta name="keywords" content="Mark Dayton,Minnesota DFL,Minnesota GOP,Minnesota Legislature,Vikings Stadium,Voter ID Amendment" />
<html>
<head>
<style type="text/css">
#over{
position: absolute;
left: 20;
}
</style>
<script type="text/javascript">
How to create an animated gif using iMovie and Photoshop (yes I don't have After Effects otherwise this would be super easy)...
1) Open iMovie. Import movie as a new event and add it to a new Project, editing the clip as necessary
2) Go to Projects list, right click on appropriate project and 'Export using Quicktime', select the 'Image Sequence' file type and I would advise setting the fps to around 6-12 (you can do this by clicking 'Advanced'). Once saved you will see you have a bunch of images...
3) Now to Photoshop. Go to File > Scripts > Load files into Stack, to open all frame files into one document as individual layers.
4) Open the Animation panel, and by clicking the options icon, select 'Document Options...' Set the fps to the same as the Image Sequence.