Skip to content

Instantly share code, notes, and snippets.

Sean Coates scoates

Block or report user

Report or block scoates

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
@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 / 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 / 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 / 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 / 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 / hangout.scpt
Created Oct 2, 2015
Start a Google Hangout in Textual with `/hangout`
View hangout.scpt
on textualcmd(inputString, destinationChannel)
tell application id "com.google.Chrome"
activate
delay 0.5
if (count of (every window where visible is true)) is greater than 0 then
if URL of active tab of front window is not "chrome://newtab/" then
tell front window
make new tab
end tell
View _modules:boto_fk.py
#
def _get_not_deleted_peering_connections(name, vpc_conn):
unfiltered_peers = vpc_conn.get_all_vpc_peering_connections(filters={'tag:Name': name})
peers = []
for this_peer in unfiltered_peers:
if this_peer.status_code != u'deleted':
peers.append(this_peer)
return peers
@scoates
scoates / _modules:boto_fk.py
Last active Oct 9, 2015
Salt: Auto-assign public IPs in VPC subnets
View _modules:boto_fk.py
# -*- coding: utf-8 -*-
'''
TODO
'''
# keep lint from choking on _get_conn and _cache_id
#pylint: disable=E0602
# Import Python libs
from __future__ import absolute_import
View highstate_pile.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
based on https://raw.githubusercontent.com/saltstack/salt/develop/tests/eventlisten.py
'''
# Import Python libs
from __future__ import print_function
import optparse
You can’t perform that action at this time.