Skip to content

Instantly share code, notes, and snippets.

View dt's full-sized avatar

David Taylor dt

View GitHub Profile
com
foursquare
foo
client [fsthriftclient for 'foo']
server
bin [main method(s) and concrete bag]
concrete [implementation of services used in 'endpoint' or 'rpc']
endpoint
json
frontend [self-hosted/internal web pages]
### Keybase proof
I hereby claim:
* I am dt on github.
* I am davidtaylor (https://keybase.io/davidtaylor) on keybase.
* I have a public key whose fingerprint is C1C7 28C0 61A1 AF42 37E5 3469 769C 56D5 F1B4 6954
To claim this, I am signing this object:
@dt
dt / tag.py
Last active August 29, 2015 14:06
BUILD graph rules
# Copyright 2014 Foursquare Labs Inc. All Rights Reserved.
from pants.backend.core.tasks.task import Task
class Tagger(Task):
@classmethod
def product_types(cls):
return ['tagged_build_graph']
def execute(self):
@dt
dt / gist:1cc0151bb3978eae1d25
Created October 31, 2014 05:32
10/31 ads build
[05:29] ~/code/fs/2 $ rm -rf .pants.d .local_artifact_cache/[^I]*
[05:29] ~/code/fs/2 $ time ./fs --pants-binary=../../pants/dist/pants.pex compile ads-api
Writing log files to disk in /tmp/davidt/goals
Begin: 2014-10-31 05:29:56.130135
Running: ../../pants/dist/pants.pex goal compile --compile-scala-missing-deps=fatal src/jvm/com/foursquare/ads/server/bin:foursquare.ads
Writing log files to disk in /tmp/davidt/goals
05:29:57 00:00 [main]
(To run a reporting server: ./pants goal server)
05:29:58 00:01 [bootstrap]
# def slow_identity_func(i):
# import time
# time.sleep(i[0])
# return i[1]
# def test_multiproc_map_timeout(self):
# context = create_context()
# msg = 'subproc_map result still not ready...'
# counting_log = MockLogger(count_messages_matching=set([msg]))
# context._log = counting_log
@dt
dt / gist:ba4dd0ce404fb83a49be
Created December 5, 2014 06:30
#coffeebot device
light <- hardware.pin8;
light.configure(ANALOG_IN);
function check() {
agent.send("lvl", light.read());
imp.wakeup(10, check);
}
check();
@dt
dt / agent.nut
Created December 5, 2014 06:31
#coffeebot server
brew_light <- 55000;
brewing <- false;
slack_url <- "https://hooks.slack.com/services/BLAHBLAHBLAH";
function slack(msg) {
local body = "{\"text\": \""+msg+"\", \"username\": \"Coffeebot\", \"icon_emoji\": \":coffee:\"}";
local request = http.post(slack_url, {}, body);
local resp = request.sendsync();
server.log("Slack says ("+resp.statuscode + "): " + resp.body)
}
@dt
dt / gist:1e55ab109f865d445823
Last active August 29, 2015 14:11
product product_type hack
class ProductiveJUnitRun(JUnitRun):
@classmethod
def product_types(cls):
return ['junit_tests_ran']
task(name='junit',
action=ProductiveJUnitRun,
dependencies=['bootstrap', 'compile']).install('test', replace=True).with_description('Test compiled code.')
@dt
dt / python_repl.py
Created January 14, 2015 18:23
virtual env based pants py replacement
# coding=utf-8
# Copyright 2013 Foursquare Labs Inc. All Rights Reserved.
from __future__ import absolute_import
import os
import subprocess
from pants.backend.core.tasks.task import Task
from pants.backend.python.targets.python_binary import PythonBinary
#!/bin/bash
set -e
if [ ! -d .pvenvs/onchange ]; then
mkdir -p .pvenvs
python2.7 -m virtualenv --quiet .pvenvs/onchange
if [ $(uname) = 'Darwin' ]; then
.pvenvs/onchange/bin/pip install --quiet MacFSEvents
else