Skip to content

Instantly share code, notes, and snippets.

tphummel / Dockerfile
Last active Jul 22, 2020
Http server binary in a scratch container
View Dockerfile
FROM scratch
COPY ./http /bin/app
ENTRYPOINT ["/bin/app"]
tphummel /
Last active Jun 7, 2020
Metacritic Review Scrape

Scrape Reviews from Metacritic

  1. Browse a metacritic page of results like: All-Time Nintendo DS Reviews
  2. Open developer tools > Console
  3. Paste the javascript into the console prompt
  4. Execute the javascript
  5. the exported json is now in your clipboard. paste the json into a file and save.


  • You can get 100 results per page so it isn't too bad doing it this way.
tphummel /
Created Feb 9, 2020
convert master branch git log to csv
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
set -x
for d in *; do
View dedupe-array.js
const assert = require('assert').strict
function dedupe (input) {
return Object.keys(input.reduce((memo, num) => {
memo[num] = true
return memo
}, {})).map((numStr) => {
return parseInt(numStr, 10)
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
You can’t perform that action at this time.