Skip to content

Instantly share code, notes, and snippets.

View tphummel's full-sized avatar

Tom Hummel tphummel

View GitHub Profile
// http://nayuki.eigenstate.org/res/calculate-gcd-javascript.js
// Returns the GCD of the given integers. Each input must be non-negative.
function gcd(x, y) {
while (y != 0) {
var z = x % y;
x = y;
y = z;
}
return x;
@tphummel
tphummel / README.md
Last active August 29, 2015 13:56
animated gif notes

animated gif notes

setup (osx)

brew install ffmpeg
brew install imagemagick

// npm.im/rugmi
npm i -g rugmi
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1
Comment: GPGTools - https://gpgtools.org
hQEMA5fHim8EY+8fAQf+Np78QL2SpNKCG3fM6twwgSe/iHsZ3VmDco8oNA3U950d
At2CCKz913i/D1sCyfxI0+U0eiMIT+SKadM2+cDtLJVq5BUlUsxximPwJSWDzwY1
zV5JpeAp3hLuMcYa7LdcJXkRElRABrIw5ioLqsTsi8NymEyhpeY6bE15Vx/qA3zu
Mmj3/RKmjnUMO2DSvJB2J1+FAAUMWJu39/HCtR08SgPsPy9qo+aT4BXvsFIn58oo
rofTkSQhoMQwtliekfouk30sX9ZD750ISz1Il96RDONFQlXKoVESHEwhYuAb/Mw1
ZYdvoSGjBA1h4rlyXj/vbDxeqVMM1GJKbZoJ2OWPFdJLAV5KUy70MyqxdS+RU+Ew
@tphummel
tphummel / gpu-panic.log
Created March 20, 2014 17:18
osx crash report
Anonymous UUID: 065C32C4-19FB-AB59-04AB-533814968B06
Thu Mar 20 08:09:29 2014
panic(cpu 2 caller 0xffffff7f88795fb0): "GPU Panic: [<None>] 3 3 7f 0 0 0 0 3 : NVRM[0/1:0:0]: Read Error 0x00000100: CFG 0xffffffff 0xffffffff 0xffffffff, BAR0 0xd2000000 0xffffff811a499000 0x0a5480a2, D0, P2/4\n"@/SourceCache/AppleGraphicsControl/AppleGraphicsControl-3.4.35/src/AppleMuxControl/kext/GPUPanic.cpp:127
Backtrace (CPU 2), Frame : Return Address
0xffffff801348aca0 : 0xffffff8006422fa9
0xffffff801348ad20 : 0xffffff7f88795fb0
0xffffff801348adf0 : 0xffffff7f86e22eab
0xffffff801348aeb0 : 0xffffff7f86eec49a
0xffffff801348aef0 : 0xffffff7f86eec50a
@tphummel
tphummel / backup-range.sh
Last active August 29, 2015 13:57
setup glacier backups on ubuntu
#!/bin/sh
# http://www.cyberciti.biz/faq/bash-loop-over-file/
for f in /vol/log/*.gz
do
echo $f
glacier-cmd upload --description "log file $f" --partsize 32 my-vault $f
done
@tphummel
tphummel / gist:9768967
Created March 25, 2014 19:08
cloud object storage comparison
# https://cloud.google.com/products/cloud-storage/
s3-equiv, standard redundancy storage (updated 3/25/2014)
storage xfer out
amazon: $0.085/gb/mo 1st GB free, $0.12/gb
d'host: $0.050/gb/mo $0.05/gb
google: $0.026/gb/mo $0.12/gb

NL West

  1. Dodgers
  2. Diamondbacks
  3. Padres
  4. Giants
  5. Rockies

NL Central

// http://us1.php.net/manual/en/function.compact.php
// http://phpjs.org/functions/compact/
var city = 'Los Angeles', state = 'California', country = 'USA', opts;
opts = someFn(city, state, country);
console.log(opts);
// prints
@tphummel
tphummel / multi-stream.coffee
Last active August 29, 2015 14:02
multi pipe destinations stream
es = require 'event-stream'
createStream = (name) ->
write = (item) ->
console.log 'read', name, item
@queue item
end = ->
console.log 'end', name
@queue null
@tphummel
tphummel / gist:411e7bcd559620d0bc53
Last active August 29, 2015 14:06
IAM policy, s3 bucket read-only, single bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*"
],
"Resource": ["arn:aws:s3:::BUCKET-NAME", "arn:aws:s3:::BUCKET-NAME/*"]