Skip to content

Instantly share code, notes, and snippets.

View meatballhat's full-sized avatar
🐻
🎷 🐻

Dan Buch meatballhat

🐻
🎷 🐻
View GitHub Profile
# vim:fileencoding=utf-8
CKBOOK := ./checkbooking
DATE := date
DEPS := bank-balance my-balance outstanding
last-done: $(DEPS)
$(CKBOOK) && $(DATE) > $@
@meatballhat
meatballhat / ridiculous-ruby-benchmark.rb
Created March 17, 2013 03:26
Crappy benchmark thrown together while working on Topaz IO buffering
class Garbage
def write(n)
out.write(n.to_s)
out.print ' '
out.print 't'
out.print 'i'
out.print 'm'
out.print 'e'
out.print 's'
out.write('. ')
@meatballhat
meatballhat / fabricate-py3k.patch
Created April 4, 2013 12:30
patch to get fabricate.py (mostly?) working with python3
diff --git a/fabricate.py b/fabricate.py
index fa5949f..a866f3e 100644
--- a/fabricate.py
+++ b/fabricate.py
@@ -20,7 +20,7 @@ To get help on fabricate functions:
"""
-from __future__ import with_statement
+from __future__ import with_statement, print_function, unicode_literals
@meatballhat
meatballhat / combine-ssh-keys-with-data-bag.rb
Last active December 16, 2015 07:09
data bag ssh key combiner thingy
#!/usr/bin/env ruby
USAGE = "Usage: #{File.basename($0)} <source.json> [source.json...] <dest.json>"
if ARGV.include?('-h') || ARGV.include?('--help')
$stderr.puts USAGE
exit 0
end
if ARGV.length < 2
$stderr.puts USAGE
abort 'ERROR: Need moar args (at least 2)'
@meatballhat
meatballhat / each-line-benchmark.rb
Created May 15, 2013 02:33
Crappy benchmark for `IO#each_line` performance. In local tests, I provided a file containing 100 copies of `/usr/share/dict/words`.
File.open(ARGV.first).each_line do |line|
1 + 1
end
out = ''
start = Time.now
File.open(ARGV.first).each_line do |line|
out << line
end
read_end = Time.now
REV_VAR := main.RevString
VERSION_VAR := main.VersionString
REPO_VERSION := $(shell git describe --always --dirty --tags)
REPO_REV := $(shell git rev-parse --sq HEAD)
GOBUILD_VERSION_ARGS := -ldflags "-X $(REV_VAR) $(REPO_REV) -X $(VERSION_VAR) $(REPO_VERSION)"
build:
go build -x $(GOBUILD_VERSION_ARGS) -o version-trick .
@meatballhat
meatballhat / 00-fake-single.travis.yml
Created October 14, 2013 00:57
non-existent Travis webhook auth config capability
# ...
notifications:
webhooks:
url: http://your-domain.com/notifications
auth:
secure: "a1b2.........c3d4"
@meatballhat
meatballhat / docker_app.sh
Last active December 26, 2015 06:08
docker install from ansible
#!/bin/bash
ansible-playbook ./docker_app.yml -c ssh -u ubuntu -s
@meatballhat
meatballhat / README.md
Last active December 27, 2015 18:48
example .travis.yml for use with docker-build-server and docker-build-worker

Example .travis.yml for docker-build-server integration

The docker_build section is optional, but omitting it will result in the container being built and then not pushed, which is probably not what you want. The tag argument should probably be called repo_tag since it's both the docker repo and tag in the format expected by commands like docker run.

The docker_build.notify_hipchat key being set to true will result in docker-build-worker using the value at notifications.hipchat.rooms[0]. It's worth noting that docker_build.notify_campfire

@meatballhat
meatballhat / response.json
Last active December 27, 2015 19:29
images mannn
{
"links": [
"foos.images.url": "https://some-s3-bucket/foo/bar/{images.style}_{images.id}"
],
"meta": {
"imageStyles": [
"original",
"zoom",
"thumb"
]