Skip to content

Instantly share code, notes, and snippets.

@hughes
hughes / gist:0c072bf7c9ec23d9f2c7
Created September 2, 2014 19:42
Abandoned laptop email script
#!/bin/bash
idletime=$((1000*60*5)) # 5 minutes in milliseconds
idleMessageSent=0
while true; do
idle=`xprintidle`
if [[ "$idle" -gt "$idletime" ]]; then
if [[ "$idleMessageSent" -eq 0 ]]; then
if (gnome-screensaver-command -q | grep "is active"); then
@hughes
hughes / gist:2e8eda0cf05687ce95f1
Created September 16, 2014 14:44
Unicode variable names...
var R = 6371; // km
var φ1 = lat1.toRadians();
var φ2 = lat2.toRadians();
var Δφ = (lat2-lat1).toRadians();
var Δλ = (lon2-lon1).toRadians();
var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) +
Math.cos(φ1) * Math.cos(φ2) *
Math.sin(Δλ/2) * Math.sin(Δλ/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
from passlib.apps import custom_app_context as pwd_context
class User(db.Model):
# ...
def set_password(self, password):
self.password_hash = pwd_context.encrypt(password)
def verify_password(self, password):
return pwd_context.verify(password, self.password_hash)
2014-11-20T01:23:29.020776
login attempt: sh ('111.248.112.58', 43366)
2014-11-20T01:23:36.252145
login attempt: root sh ('111.248.112.58', 43370)
2014-11-20T01:23:43.476545
login attempt: admin sh ('111.248.112.58', 43371)
2014-11-20T01:23:50.702848
login attempt: dreambox sh ('111.248.112.58', 43374)
2014-11-20T01:23:57.927477
login attempt: vizxv sh ('111.248.112.58', 43375)
@hughes
hughes / _.md
Created February 20, 2015 19:11
struct_test
@hughes
hughes / _.md
Last active August 29, 2015 14:15
grid-test
@hughes
hughes / _.md
Last active August 29, 2015 14:17
grid-constrained force layout
@hughes
hughes / _.md
Created March 27, 2015 22:42
grid-constrained force layout
@hughes
hughes / _.md
Last active August 29, 2015 14:18
chargeTest
@hughes
hughes / README.md
Last active August 29, 2015 14:19 — forked from mbostock/.block

From Wikipedia:

Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Use the menu in the top-left to change the frame of reference, fixing the specified gear in-place.