See it in action at bl.ocks.org.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# quickly toggle between brightness levels | |
# put this in your path and run it using a gnome keyboard shortcut | |
# i have it bound to Ctrl-F5 | |
import dbus | |
bus=dbus.SessionBus() | |
proxy=bus.get_object('org.gnome.PowerManager','/org/gnome/PowerManager/Backlight') | |
cl = int(proxy.GetBrightness(dbus_interface='org.gnome.PowerManager.Backlight')) | |
if cl < 20: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Primes extends Iterable[Int] { | |
import scala.collection.mutable.ListBuffer | |
var primes = ListBuffer[Int]() | |
var ints = Iterator.from(2) | |
def iterator = new Iterator[Int] { | |
def hasNext = true | |
def next:Int = { | |
ints.dropWhile(n => primes.exists(n % _ == 0)) | |
primes += ints.next | |
primes.last |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This is my fork
- d3.tsv - load and parse data
- d3.time.format - parse dates
- d3.time.scale - x-position encoding
- d3.scale.linear - y-position encoding
- d3.extent - compute domains
- d3.svg.axis - display axes
- d3.svg.line - display line shape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
OlderNewer