Skip to content

Instantly share code, notes, and snippets.

View tphummel's full-sized avatar

Tom Hummel tphummel

View GitHub Profile
@tphummel
tphummel / README.md
Last active October 31, 2018 05:04
Eat Club Analytics

Eat Club Analytics

  1. log in and browse: https://www.eatclub.com/orders/past
  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(Array.prototype.slice.call(document.querySelectorAll("div.item-cont.row")).map((r)=>{ return Array.prototype.slice.call(r.querySelectorAll("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
tphummel / http-to-s3.js
Created February 25, 2018 21:14
pipe the content of a webpage to a file in s3
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()
http.request({
protocol: 'http:',
@tphummel
tphummel / sparse-streaks.md
Last active January 16, 2018 03:53
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
tphummel / README.md
Last active September 11, 2017 17:49
Athena, S3, and HiveQL for CloudTrail Analysis

Doing CloudTrail Analysis with Athena, S3, HiveQL

Problem

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

Prerequisites

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

Approach

@tphummel
tphummel / README.md
Last active February 12, 2017 06:50
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}
do
  curl -H "Accept: application/vnd.github.v3.star+json" "https://api.github.com/users/tphummel/starred?page=$i" > "p$i.json"
done
@tphummel
tphummel / add-users.sh
Created July 15, 2016 18:33
add github user keys to authorized_keys via cloud-init/userdata
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
main(){
users=( "tphummel" "githubuser2" "githubuser3" )
ssh_user="ssh_user"
@tphummel
tphummel / stats-llc-styleguide.txt
Last active November 18, 2015 05:34
the stats llc styleguide
from: https://web.archive.org/web/20090831121101/http://www.stats.com/style_sheet.asp
Numerals
No. 1
12th-ranked
3-to-4 weeks
6-foot-2
6-foot
7-footer
1st-and-10

intro

  • craps is a social dice game
  • it is a negative expectation game (like most things in a casino)
  • my style is to strike a balance between betting like a robot and betting like an idiot

etiquette

  • hands back
@tphummel
tphummel / README.md
Last active August 29, 2015 14:15
css edit bookmarklet