Skip to content

Instantly share code, notes, and snippets.

View mattrobenolt's full-sized avatar
🀠
πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”

Matt Robenolt mattrobenolt

🀠
πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”πŸ€”
View GitHub Profile
import ec2
ec2.credentials.ACCESS_KEY_ID = 'xxx'
ec2.credentials.SECRET_ACCESS_KEY = 'xxx'
print ec2.instances.all()
for i in ec2.instances.filter(state='running', name__like='^production'):
print i.state, i.tags['Name']
@mattrobenolt
mattrobenolt / gist:3239561
Created August 2, 2012 18:41
yield from all the things
all = lambda x: x
def doit(things):
yield from all(things)
list(doit([]))
@mattrobenolt
mattrobenolt / server.js
Created August 5, 2012 16:32
DNS server backed by Redis, and resolves EC2 instance names
var dns = require('native-dns');
var server = dns.createServer();
var client = require('redis').createClient();
var aws = require('aws-lib');
server.on('request', function(req, res){
var parts = req.question[0].name.split('.');
var tag = parts[0];
var authority = parts.slice(1).join('.');
class Logger(type):
def __new__(cls, name, bases, crap):
print cls, name, bases, crap
class foo(dict):
__metaclass__ = Logger
publish:
python setup.py sdist upload
clean:
rm -rf *.egg-info
rm -rf dist
rm -rf build
.PHONY: publish clean
#!/usr/bin/env sh
INSTALL_DIR=`pwd`/maxmind
log() {
printf "\033[90m...\033[0m $@\n"
}
abort() {
printf "\033[31mError: $@\033[0m\n" && exit 1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import urllib2
import boto
try:
import simplejson as json
except ImportError:
try:
# Hang until we exit the script
while 1:
time.sleep(5)
except KeyboardInterrupt:
pass
def a():
print("a")
return True
def b():
print("b")
return True
print(any((a(), b()))) # :(
print("")
diff --git a/django/db/models/query.py b/django/db/models/query.py
index da4c69f..591ccfa 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -139,33 +139,22 @@ class QuerySet(object):
def __contains__(self, val):
# The 'in' operator works without this method, due to __iter__. This
- # implementation exists only to shortcut the creation of Model
- # instances, by bailing out early if we find a matching element.