This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
import logging | |
from functools import partial | |
import http.client | |
from tornado.httputil import HTTPHeaders | |
HTTPHeaders._normalize_name = lambda x: x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from tornado import gen | |
import tornado.ioloop | |
import tornado.web | |
from tornado_threaded import threaded, inline_threaded | |
@threaded | |
def slow_func(callback): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# | |
# Copyright (c) 2009 Andrew Grigorev <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imp | |
import os | |
import stat | |
import string | |
import sys | |
from default_settings import * | |
def get_arg(key): | |
return sys.argv[sys.argv.index(key) + 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
import sys | |
from Crypto.Cipher import ARC4 | |
import numpy | |
import magic | |
import string | |
fname = sys.argv[1] if len(sys.argv) > 1 else 'videostream' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
def get_bound_objects(queryset, classes): | |
""" | |
Helper function to map a list of objects to corresponding classes in Django ORM. | |
It is a simple and stupid alternative to django_polymorphic. | |
Good to use with custom Paginator class. Example usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!! Appearance | |
urxvt.termName: rxvt-unicode | |
urxvt.scrollBar: false | |
urxvt.background: black | |
urxvt.foreground: gray | |
!! Font prefferenes | |
urxvt.font: xft:DejaVu Sans Mono:pixelsize=13 | |
urxvt.boldFont: xft:DejaVu Sans Mono:pixelsize=13:weight=bold | |
urxvt.letterSpace: -1 | |
!! Larger history limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# | |
# see: https://github.com/fx5/not_random and related article | |
import sys | |
import os | |
import gzip | |
import random | |
from itertools import imap | |
import hashlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# coding: utf-8 | |
from collections import deque | |
import socket | |
import logging | |
import re | |
logging.basicConfig(level=logging.DEBUG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ "`whoami`" != "root" ] && echo "Should be run by root!" && exit 1 | |
[ -e *.vmdk ] || ( echo Extracting VMDK image from *.ova ... ; tar xf *.ova ) | |
[ -e github.img ] || ( echo Converting *.vmdk to raw image ... ; qemu-img convert *.vmdk github.img ) | |
echo Preparing mounts ... | |
losetup -f github.img -P | |
vgchange -ay enterprise-11 |
OlderNewer