Skip to content

Instantly share code, notes, and snippets.

View smerritt's full-sized avatar

Sam Merritt smerritt

View GitHub Profile
@smerritt
smerritt / Helpful Gerrit queries
Last active August 29, 2015 13:56
Gerrit queries that I use to help me find stuff in the howling torrent of pending reviews. For best results, paste them in the Gerrit search box and bookmark the resulting page.
# Starred reviews
# I star something when I want to follow it and make sure it gets in; that way I can find it again.
# I never have more than a half-dozen things starred at a time, or else it's pointless.
is:starred
# My pending changes
status:open AND owner:torgomatic
# Everything Swift-related that's ready for review (no WIP stuff)
status:open AND -status:workinprogress AND (project:openstack/swift OR project:openstack/python-swiftclient OR project:openstack/swift-bench OR project:openstack/object-api)
diff --git a/swiftclient/client.py b/swiftclient/client.py
index ee80769..275c6b7 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -219,8 +219,9 @@ def http_connection(*arg, **kwarg):
return conn.parsed_url, conn
-def get_auth_1_0(url, user, key, snet):
- parsed, conn = http_connection(url)
Resque.configure do |config|
config.redis = MockRedis.new
end
# NOTE: all this code is completely untested. At best, it's syntactically
# valid, but don't bet on it.
import errno
import fcntl
import os
import splicetee
F_SETPIPE_SZ = getattr(fcntl, 'F_SETPIPE_SZ', 1031)
@smerritt
smerritt / gist:255ad07ee6989c0f44ae
Created July 3, 2014 00:57
chunked HTTP putter
#!/usr/bin/env python
import httplib
import time
conn = httplib.HTTPConnection('localhost', '6020')
conn.putrequest('PUT', '/sdb2/831/AUTH_test/c/o')
conn.putheader('Transfer-Encoding', 'chunked')
conn.putheader('Content-Type', 'application/octet-stream')
conn.putheader('X-Timestamp', "%016.05f" % time.time())
@smerritt
smerritt / gist:6d5c2e209376f1d1c834
Created July 11, 2014 16:24
This is a valid program in C, Perl, and sh.
#define do main() /*
# This is a valid program in C, Perl, and sh.
eval 'function sub() { echo "I like code."; exit; }';
sub echo {}
#*/
do {
printf("I like code.\n");
}
@smerritt
smerritt / mimestream.py
Last active August 29, 2015 14:05
If a a MIME streams in a forest, does anyone care?
#!/usr/bin/env python
#
# An overly-strict multipart-MIME parser thingy. Works for my contrived
# examples, at least. Does things in a streaming fashion so you can deal with
# large (multi-GB) multipart MIME messages without using all your memory.
import email.parser
import pprint
import random
import sys
function dammit() {
sudo `history -p \!\!`
}
@smerritt
smerritt / gist:bc0e242ed0b3fd424979
Last active August 29, 2015 14:06
zip() is self-inverse
>>> thing = [(1, 2, 3), ('a', 'b', 'c')]
>>> zip(*thing)
[(1, 'a'), (2, 'b'), (3, 'c')]
>>> zip(*zip(*thing))
[(1, 2, 3), ('a', 'b', 'c')]
>>>
209-204-163-11:swift (ec-put-path)$ egrep '^inter.*er$' /usr/share/dict/words
intercarrier
interceder
intercepter
interchanger
interchapter
intercommoner
intercommuner
intercondenser
intercooler