Skip to content

Instantly share code, notes, and snippets.

View twexler's full-sized avatar
💁‍♂️
Breakin' stuff.

Ted Wexler twexler

💁‍♂️
Breakin' stuff.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am twexler on github.
  • I am twexler (https://keybase.io/twexler) on keybase.
  • I have a public key ASBnrrW6oK03-3yDR6dNhzB0rTuBugHIy8O7PgimmVVwZAo

To claim this, I am signing this object:

panic: net: inconsistent fdMutex
goroutine 1145194 [running]:
panic(0x126cc0, 0xc94cf02860)
/usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
net.(*fdMutex).RWLock(0xc8200620e0, 0x0, 0xc94d37f61e)
/usr/local/Cellar/go/1.6/libexec/src/net/fd_mutex.go:136 +0x20c
net.(*netFD).writeLock(0xc8200620e0, 0x0, 0x0)
/usr/local/Cellar/go/1.6/libexec/src/net/fd_unix.go:194 +0x39
net.(*netFD).Write(0xc8200620e0, 0xc94cf02848, 0x7, 0x8, 0x0, 0x0, 0x0)
@twexler
twexler / subnet_address_alloc.py
Created December 22, 2014 23:09
ec2 subnet address allocation script
import boto.ec2
import boto.vpc
def subnet_stats(subnet_id):
addresses = []
ints = ec2.get_all_network_interfaces(filters={'subnet-id': subnet_id})
for i in ints:
addresses.append(i.private_ip_address)
for addr in i.private_ip_addresses:
if addr.private_ip_address != i.private_ip_address:
FROM litaio/ruby
MAINTAINER "Ted Wexler <ted@stuckinacan.com>"
RUN apt-get update
RUN apt-get install -y redis-server libssl-dev
RUN gem install lita
ADD conf/ /srv/lita-docker/
WORKDIR /srv/lita-docker
RUN bundle install
CMD service redis-server start && bundle exec lita start
#!/usr/bin/env python
import boto
import sys
#standard nagios exit codes
EXIT_OK = 0
EXIT_WARN = 1
EXIT_CRIT = 2
EXIT_UNKN = 3
@twexler
twexler / gist:a63462d2a414d83f7bc9
Last active August 29, 2015 14:03
get all names from running instances that have a tag
import boto
ec2 = boto.connect_ec2()
ec2_hosts = [ec2.get_all_tags(filters={'resource-id': i.id, 'key': 'Name'})[0].value for i in list(itertools.chain.from_iterable([res.instances for res in ec2.get_all_instances(filters={"tag-key": "server_env", "instance-state-code": 16})]))]ec2_hosts = [ec2.get_all_tags(filters={'resource-id': i.id, 'key': 'Name'})[0].value for i in list(itertools.chain.from_iterable([res.instances for res in ec2.get_all_instances(filters={"tag-key": "server_env", "instance-state-code": 16})]))]ec2_hosts = [ec2.get_all_tags(filters={'resource-id': i.id, 'key': 'Name'})[0].value for i in list(itertools.chain.from_iterable([res.instances for res in ec2.get_all_instances(filters={"tag-key": "server_env", "instance-state-code": 16})]))]
[18:47:57] twexler:~ $ python
Python 2.7.6 (default, May 17 2014, 00:21:47)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.29.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.timeit('import re;s="perceptes is gay";r=".*gay$";rr = re.compile(r);rr.match(s)')
2.5647430419921875
>>> timeit.timeit('import re;s="perceptes is gay";r=".*gay$";re.match(r, s)')
2.603404998779297
>>>
@twexler
twexler / gist:4157060
Created November 27, 2012 21:14
Generate a random number
>>> import random
>>> random.randint(1,100)
77
>>>
-(id)initWithNameAndURLs:(NSString*)name xmlURL:(NSURL*)xURL ackURL:(NSURL*)aURL {
if ((self = [super init]) != NULL){
displayName = [name retain];
xmlURL = [xURL retain];
ackURL = [aURL retain];
return self;
}
return nil;
}
@twexler
twexler / gist:1821335
Created February 13, 2012 23:09
All the things!
def allthethings(a, b=None):
if b == None: b = "things"
print "%s all the %s!" % (a,b)