Skip to content

Instantly share code, notes, and snippets.

Tom Hummel tphummel

Block or report user

Report or block tphummel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tphummel /
Last active Sep 1, 2019
craps simulator

craps toy/simulator


➜  node craps-toy.js
│ (index) │ die1 │ die2 │ sum │   result    │
│    0    │  1   │  4   │  5  │ 'point set' │
tphummel / Vagrantfile
Last active May 29, 2019
Vagrantfile to install nginx, configure javascript custom modules, and a hello world example
View Vagrantfile
# vagrant box add --name ol76 --checksum cfb58aaa12f56702afd739966273df63cd3ff3362e6a5a3fa6fa9ffcec4762e3 --checksum-type sha256
Vagrant.configure("2") do |config| = "ol76" "forwarded_port", guest: 80, host: 8111, host_ip: ""
config.vm.synced_folder ".", "/vagrant_data"
config.vm.provision "shell", inline: <<-SHELL
sudo cat > /etc/yum.repos.d/nginx.repo <<EOF
tphummel / lanes.js
Created Feb 13, 2019
compute total distance by lane of a running track
View lanes.js
let laneWidthMeters = 1.22
function getLanes({laneOneMeters, aRadMeters, bRadMeters, numLanes}) {
let turnMeters = 2 * Math.PI * aRadMeters
let straightMeters = laneOneMeters - turnMeters
let lanes = [
['#', 'distance (m)', 'turn (m)', 'straight (m)'],
tphummel /
Last active Oct 31, 2018
Eat Club Analytics

Eat Club Analytics

  1. log in and browse:
  2. scroll to the bottom of the page and keep clicking more until your entire history is shown on the page.
  3. open chrome web console (or comparable)
  4. open javascript console
  5. run the following command
copy("div.item-cont.row")).map((r)=>{ return"div.column")).map((c)=>{ return c.innerText.split("\n") }) }).map((o)=>{ return {date: o[0][0], location: o[0][1], dish: o[1][0], type: o[2][0]} }))
tphummel / http-to-s3.js
Created Feb 25, 2018
pipe the content of a webpage to a file in s3
View http-to-s3.js
var http = require('http')
var path = require('path')
var AWS = require('aws-sdk')
function httpToS3 (event, context, callback) {
var s3 = new AWS.S3()
var now = (new Date()).toISOString()
protocol: 'http:',
tphummel /
Last active Jan 16, 2018
Find Streaks in Daily Data with Sparse/Missing Days

install libraries

brew update
brew install tphummel/util/date-range
brew install tphummel/util/streak
brew install jq
brew install csvkit
tphummel /
Last active Sep 11, 2017
Athena, S3, and HiveQL for CloudTrail Analysis

Doing CloudTrail Analysis with Athena, S3, HiveQL


I discovered a security group which got opened too widely. I want to figure out when it happened and who did it.


This article assumes you have CloudTrail enabled and there is a complete history of your account activity sitting in an S3 bucket.


tphummel /
Last active Feb 12, 2017
run queries on a user's starred github repos

run queries on a user's starred github repos

download data

for i in {1..20}
  curl -H "Accept: application/" "$i" > "p$i.json"
tphummel /
Created Jul 15, 2016
add github user keys to authorized_keys via cloud-init/userdata
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
users=( "tphummel" "githubuser2" "githubuser3" )
You can’t perform that action at this time.