Skip to content

Instantly share code, notes, and snippets.

@willkelly
willkelly / ircbouncersetup.md
Last active March 10, 2017 18:30
IRC Bouncer Setup

HELLO

There is only one proper irc setup. Many people will tell you to use a bouncer. These people area silly and wrongheaded folk whose brains are filled with stupid ideas about irc. Let me explain.

What, exactly, is a bouncer? I will tell you! An irc bouncer is an irc client that is written in an irc server. Should you choose to use a bouncer, you will need an irc client to connect to your irc client.

@willkelly
willkelly / identity.rs
Created June 9, 2015 19:36
identity issues
$ rustc main.rs
main.rs:7:21: 7:29 error: unable to infer enough type information about `_`; type annotations required [E0282]
main.rs:7 let f = identity(identity);
^~~~~~~~
error: aborting due to previous error
#!/usr/bin/python
# apt-get install python-pip cgroup-bin
# pip install cgroups
import cgroups
import os
import time
import subprocess
DEBIAN_FRONTEND=noninteractive apt-get install -y mdadm
mdadm -C -l0 --raid-devices=2 /dev/md0 /dev/xvdb /dev/xvdc
mkfs.ext4 /dev/md0
perl -pi -e 's@/dev/xvdb@/dev/md0@g' /etc/fstab
mount -a
#if [[ -d /var/lib/elasticsearch ]]; then
# mv /var/lib/elasticsearch /mnt/elasticsearch
#else
# mkdir /mnt/elasticsearch
# ln -sf /mnt/elasticsearch /var/lib/elasticsearch

What is Aptly

Aptly is software for managing apt repositories.

Features we use

  • Quick package addition / removal.
from sqlalchemy import create_engine, Column, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
engine = create_engine('postgresql+psycopg2://testman:testmanpass@localhost:5432/testman')
class TestMan(Base):
__tablename__ = "testman"
from sqlalchemy import create_engine, Column, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
engine = create_engine('postgresql+psycopg2://testman:testmanpass@localhost:5432/testman')
class TestMan(Base):
__tablename__ = "testman"
import sqlite3
con = sqlite3.connect("/dev/input")
cursor = con.cursor()
cursor.execute("Select name from object")
print "\n".join([item[0] for item in cursor.fetchall()])
def zebra_execute(json, endpoint, token):
return requests.post(
endpoint,
headers={
"X-Auth-Token": token,
"Content-Type": "application/json",
"X-ZeroVM-Execute": "1.0"},
data=json).content
@willkelly
willkelly / gist:a2722dfb0aa435acacee
Last active August 29, 2015 14:01
Make threads that return values in python
import threading
class ThreadFunction(threading.Thread):
def __init__(self, group=None, target=None, name=None,
args=(), kwargs={}, Verbose=None):
self._return = None
super(ThreadFunction, self).__init__(group, self._wrap(target),
name, args, kwargs, Verbose)