Skip to content

Instantly share code, notes, and snippets.

@scoates
scoates / predictions.md
Last active Mar 18, 2020
Financial package (and new restrict) predictions
View predictions.md

My hope/mild-expectation for Trudeau's financial package press conference tomorrow:

  • unenforceable requirement that everyone must stay home except to get food, medicine, necessary supplies
  • all offices/churches/gyms/etc. with more than 5 people must close. Everyone (except essential services including grocery and pharmacy) encouraged to close, if more than 1.
  • no gatherings of more than 10 people (current recommendation: 50)
  • all restaurants, bars, coffee shops, etc., must do delivery/pickup only; can’t have more than 10 people working
  • fed tax deadline pushed back to June 1 (filing) + July 31 (payment) (Quebec already did this)
  • shortened EI timeline, waiver of waiting period, special circumstances to allow easier qualification, added resources to administer this
  • mortgage holiday until May 1
  • immediate stimulus cheques going out; maybe up to $1000 (everyone); treated as a tax credit
  • federal corporate tax cut for small business, more coming from provinces
View keybase.md

Keybase proof

I hereby claim:

  • I am scoates on github.
  • I am scoates (https://keybase.io/scoates) on keybase.
  • I have a public key whose fingerprint is 8A45 6450 4355 2F7B FB92 5422 E905 36DD 957A 42BE

To claim this, I am signing this object:

@scoates
scoates / check_elb_healthy_hosts.py
Created Jun 27, 2013
Nagios plugin to monitor AWS/EC2 Elastic Load Balancers for healthy hosts
View check_elb_healthy_hosts.py
#!/usr/bin/env python
"""
A nagios plugin for ensuring that load balancers have at least a certain
number of healthy nodes.
Usage:
Nagios Command:
define command {
command_name check_elb_healthy_hosts
@scoates
scoates / console_log.txt
Last active Sep 21, 2017
Sample Zappa Async Run
View console_log.txt
$ time curl -L 'https://REDACTED.execute-api.us-east-1.amazonaws.com/dev/bake?num=10'
Baked 10 items in 10.4251441956 seconds. Baking took 67 seconds.
Baked a potato in 6 seconds.
Baked a cake in 3 seconds.
Baked a casserole in 9 seconds.
Baked a casserole in 4 seconds.
Baked a cake in 9 seconds.
Baked a casserole in 5 seconds.
Baked a casserole in 7 seconds.
@scoates
scoates / zappa_settings.json
Created Sep 21, 2017
Zappa asunc settings
View zappa_settings.json
{
"stagename": {
"async_resources": true,
"async_response_table": "dynamodb_table_name",
"async_response_table_read_capacity": 2,
"async_response_table_write_capacity": 1,
}
}
@scoates
scoates / async-app.py
Last active Sep 21, 2017
Asynchronous results in Zappa
View async-app.py
from zappa.async import task, get_async_response
from flask import Flask
from time import sleep, time
app = Flask(__name__)
@app.route('/bake')
def bake():
start = time()
@scoates
scoates / Vagrantfile
Last active Oct 21, 2016
Ensure one VM ("gateway") is running before allowing the others
View Vagrantfile
# Check to see that we have a gateway running before we allow the `up` of another VM
# This is a filthy hack
if ARGV[0] != 'up'
GATEWAY_STATUS = 'running' # this is irrelevant for everything but `vagrant up`
# if we don't do this, we could fork forever in the else block, here
else
GATEWAY_STATUS = `vagrant status --machine-readable | grep 'gateway,state,' | awk -F, {'print $4'}`.strip!
if GATEWAY_STATUS != 'running'
puts "*** The gateway is not running. You can not 'up' any other VMs."
end
@scoates
scoates / vermont_hitlist.md
Last active Oct 5, 2016
Sean's Vermont Hitlist
View vermont_hitlist.md

This is stuff on my hit list when I'm in Vermont:

  • Hill Farmstead Brewery
  • Parker Pie (near HF) for pizza / bottles; they have a great tap list
  • Willys Store in Greensboro for HF bottles and Jasper Hill cheeses (Moses Sleeper, Cabot Clothbound, Alpha Tolman, Harbison, … )
  • There's a roadside pie shop right outside of Elmore State Park
  • Lost Nation brewery in Morristown (lunch, taps)
  • Alchemist in Stowe (the new place)
  • Doc Ponds in Stowe for eats + good taps + good bottles
  • The Bench in Stowe (same)
@scoates
scoates / loudopen.c
Created Aug 14, 2016
Hook into libc's open
View loudopen.c
#define _GNU_SOURCE
#include <stdio.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <stdarg.h>
int open(const char* pathname, int flags, ...)
{
int (*libc_open)(const char*, int, ...);
@scoates
scoates / twitter_user_to_image
Last active Dec 19, 2015
Get a twitter profile image from a username. We route around bad APIs. Twitter wears the scumbag hat, these days.
View twitter_user_to_image
#!/bin/bash
# Usage: $0 username
# e.g.:
# $ ./twitter_user_to_image coates
# https://si0.twimg.com/profile_images/1597362183/me.jpg
curl -sL http://twitter.com/$1 | grep profile_images | head -n1 | perl -p -e's/.*?http/http/;s/".*//;s/_bigger//'