Skip to content

Instantly share code, notes, and snippets.

@borntyping
borntyping / nose.py
Last active December 11, 2015 03:48
Runs nosetests using sniffer, but drops much of the output and avoids reloading python modules
#!/usr/bin/env python
from os import getcwd
from sys import argv
from subprocess import Popen
from pynotify import init, Notification
from sniffer.broadcasters import PynotifyEmitter
from sniffer.main import run
from sniffer.runner import Sniffer
@borntyping
borntyping / Makefile
Created February 4, 2013 16:48
Dependency graph for pytentd
# Requires snakefood python module
all: data clusters graph
data:
@echo "Generating data"
@sfood tentd > /tmp/tentd.deps
clusters: data
@echo "Clustering data"
@borntyping
borntyping / after.py
Created February 9, 2013 11:24
New PyTentd testing example
def test_create_new_profile(self, entity):
schema = 'https://testprofile.example.com/'
data = {'data': 'test'}
response = PUT('entity.profile', data, secure=True, schema=schema)
profile = entity.profiles.get(schema=schema)
assert response.json() == profile.to_json() == data
class PositiveInt(object):
__slots__ = 'value'
def __init__(self, value):
self.__set__(instance=None, value=value)
def __get__(self, instance, owner):
return self.value
def __set__(self, instance, value):
class Attribute(object):
def __get__(self, instance, owner):
print("Getting x")
if not 'x' in instance.__dict__:
instance.__dict__['x'] = 1
return instance.__dict__['x']
def __set__(self, instance, value):
instance.__dict__['x'] = value
eval $(echo "no:global default;fi:normal file;di:directory;ln:symbolic link;pi:named pipe;so:socket;do:door;bd:block device;cd:character device;or:orphan symlink;mi:missing file;su:set uid;sg:set gid;tw:sticky other writable;ow:other writable;st:sticky;ex:executable;"|sed -e 's/:/="/g; s/\;/"\n/g')
{
IFS=:
for i in $LS_COLORS do
echo -e "\e[${i#*=}m$( x=${i%=*}; [ "${!x}" ] && echo "${!x}" || echo "$x" )\e[m"
done
}
@borntyping
borntyping / gist:6407534
Created September 1, 2013 21:48
Docker on Debian 7 / Linode (uncompleted)
Linode configuration profile:
Kernel: pv-grub-x86_64
Xenify: No
Required packages:
lxc
supervisor (optional)
Docker installation:
wget http://get.docker.io/builds/Linux/x86_64/docker-latest.tgz
@borntyping
borntyping / gist:7926482
Last active December 31, 2015 03:19
Riemann ports
riemann 5555/udp
riemann 5555/tcp
riemann 5556/websockets
riemann-dash 4567/http
❯ sudo aptitude install kate
The following NEW packages will be installed:
docbook-xml{a} docbook-xsl{a} fonts-freefont-ttf{a} kate kate-data{a} katepart{a} kde-runtime{a} kde-runtime-data{a} kdelibs-bin{a} kdelibs5-data{a} kdelibs5-plugins{a} kdoctools{a} liba52-0.7.4{a} libattica0{a}
libcanberra-gtk3-0{a} libcanberra-gtk3-module{a} libcddb2{a} libcdio13{a} libclucene0ldbl{a} libcrystalhd3{a} libdbusmenu-qt2{a} libdirac-decoder0{a} libdlrestrictions1{a} libdvbpsi7{a} libebml3{a} libexiv2-12{a}
libfile-basedir-perl{a} libfile-desktopentry-perl{a} libfile-mimeinfo-perl{a} libgif4{a} libilmbase6{a} libimobiledevice2{a} libiodbc2{a} libiso9660-8{a} libkateinterfaces4{a} libkatepartinterfaces4{a} libkcmutils4{a}
libkde3support4{a} libkdeclarative5{a} libkdecore5{a} libkdesu5{a} libkdeui5{a} libkdewebkit5{a} libkdnssd4{a} libkemoticons4{a} libkfile4{a} libkhtml5{a} libkidletime4{a} libkio5{a} libkjsapi4{a} libkjsembed4{a} libkmediaplayer4{a}
libknewstuff2-4{a} libknewstuff3-4{a} libknotifyconfig4{a} libk
$ time sudo /opt/chef/embedded/bin/gem install librarian librarian-chef
Successfully installed librarian-0.1.1
Fetching: librarian-chef-0.0.2.gem (100%)
Successfully installed librarian-chef-0.0.2
2 gems installed
Installing ri documentation for librarian-0.1.1...
Installing ri documentation for librarian-chef-0.0.2...
Installing RDoc documentation for librarian-0.1.1...
Installing RDoc documentation for librarian-chef-0.0.2...
sudo /opt/chef/embedded/bin/gem install librarian librarian-chef