Skip to content

Instantly share code, notes, and snippets.

View edrex's full-sized avatar

Eric Drechsel edrex

  • Portland, OR
View GitHub Profile
@edrex
edrex / mpl_animation_examples.ipynb
Last active August 29, 2015 13:56
matplotlib animations as HTML5 video
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edrex
edrex / publish.sh
Last active July 26, 2025 16:31
Upload static site to S3 with clean URLs
#!/bin/sh
# Be sure to set the index and 404 docs to "index" and "404" respectively in your bucket settings
# replace with your compile command
harp compile ./ ./out
# removes the html extension
for f in `ls out/*.html out/**/*.html`; do mv $f "${f%%.*}"; done
@edrex
edrex / sitemap.xml.jade
Created November 7, 2013 08:43
Harp sitemap.xml in Jade
doctype xml
- function merge(a,b,pre){for (var f in b) { a[f] = b[f]}; return a}
- function prefix(a,pre){var r={}; for (var f in a) { r[pre+f] = a[f]}; return r}
- function subdirs(b){var r={}; for (var i in b) {if (i !== 'data' && i !== 'contents') r[i]=b[i]}; return r;}
- function all_posts(b,pre){var r=prefix(b.data,pre); for(var s in subdirs(b)){merge(r, all_posts(b[s],pre+s+'/'))}; return r}
urlset(xmlns='http://www.sitemaps.org/schemas/sitemap/0.9')
each val, key in all_posts(public, '/')
url
loc #{key}
{
"rules": {
".read": true,
"messages": {
".read": true,
"$msg": {
".validate": "newData.child('user_id').val() == auth.id && newData.child('provider').val() == auth.provider",
".write": "!data.exists() && auth != null"
}
}
@edrex
edrex / gist:6033528
Created July 18, 2013 22:03
New Mac OOB setup
i Chrome (with Safari)
i Dropbox and start sync
p name this mac
i XCode cmd line tools from OSX dev site (git, make, etc)
i Sublime Text
i iTerm2
r ssh-keygen
r scp -rp othermachine.local:~/.gnupg ~/
i GPG Tools
w upload ssh pubkey to services:
@edrex
edrex / README.md
Created November 5, 2012 22:21 — forked from mbostock/.block
Line Chart
@edrex
edrex / create_box_and_sphere_in_new_doc.py
Created September 8, 2012 17:12
FreeCAD Scripting Examples
import FreeCAD
import Part
App.newDocument()
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")
box = App.ActiveDocument.addObject("Part::Box","Box")
box.Placement = App.Placement(App.Vector(1,1,1),App.Rotation(0,0,0,1))
@edrex
edrex / ssh-auto
Last active May 8, 2020 05:47
SSH Auto
#!/bin/sh
# Auto-reconnect ssh screen session after sleep + wifi network change
# usage: ssh-auto user@server
# With these setting SSH will detect a dropped connection after 30 seconds.
# Script will attempt to reconnect every 5 seconds whenever connection is dropped.
# Use Ctrl-C to exit the reconnect loop.
# choose your remote session manager
# ON_CONNECT_CMD='screen -DR'
ON_CONNECT_CMD='tmux -2 attach || tmux -2 new'
@edrex
edrex / graph.json
Created April 11, 2012 06:52 — forked from mbostock/.block
Force-Directed Layout (with labels)
{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1},{"name":"Labarre","group":2},{"name":"Valjean","group":2},{"name":"Marguerite","group":3},{"name":"Mme.deR","group":2},{"name":"Isabeau","group":2},{"name":"Gervais","group":2},{"name":"Tholomyes","group":3},{"name":"Listolier","group":3},{"name":"Fameuil","group":3},{"name":"Blacheville","group":3},{"name":"Favourite","group":3},{"name":"Dahlia","group":3},{"name":"Zephine","group":3},{"name":"Fantine","group":3},{"name":"Mme.Thenardier","group":4},{"name":"Thenardier","group":4},{"name":"Cosette","group":5},{"name":"Javert","group":4},{"name":"Fauchelevent","group":0},{"name":"Bamatabois","group":2},{"name":"Perpetue","group":3},{"name":"Simplice","group":2},{"name":"Scaufflaire","group":2},