This file contains hidden or 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
SELECT FLOOR(RAND()*(~0)); |
This file contains hidden or 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
require 'formula' | |
class Gdb < Formula | |
url 'http://ftp.gnu.org/gnu/gdb/gdb-7.4.tar.bz2' | |
homepage 'http://www.gnu.org/software/gdb/' | |
md5 '95a9a8305fed4d30a30a6dc28ff9d060' | |
def install | |
args = ["--prefix=#{prefix}", | |
"--disable-debug", |
This file contains hidden or 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
# coding=utf8 | |
from distutils.core import setup, Extension | |
setup(name = "foo", | |
version = "0.0.1", | |
author = "Saúl Ibarra Corretgé", | |
author_email = "[email protected]", | |
description = "PyStructSequence example", | |
ext_modules = [Extension('foo', |
This file contains hidden or 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
# http://stackoverflow.com/questions/1216267/ab-program-freezes-after-lots-of-requests-why | |
sudo sysctl -w net.inet.ip.portrange.first=32768 | |
sudo sysctl -w net.inet.tcp.msl=1000 | |
This file contains hidden or 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
# Create local repository | |
mkdir /location/debs | |
cp package-file.deb /location/debs | |
dpkg-scanpackages /location/debs /dev/null | gzip > /location/debs/Packages.gz | |
# Add repository to APT | |
deb file:/location debs/ |
This file contains hidden or 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
# Based on http://stackoverflow.com/questions/328356/extracting-text-from-html-file-using-python | |
from cStringIO import StringIO | |
from formatter import AbstractFormatter, DumbWriter | |
from htmllib import HTMLParser, HTMLParseError | |
def html2text(data): | |
f = StringIO() |
This file contains hidden or 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 concurrent.futures import ProcessPoolExecutor, wait | |
from multiprocessing import cpu_count | |
try: | |
workers = cpu_count() | |
except NotImplementedError: | |
workers = 1 | |
pool = ProcessPoolExecutor(max_workers=workers) |
This file contains hidden or 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 select | |
import socket | |
import ssl | |
bindsocket = socket.socket() | |
bindsocket.bind(('127.0.0.1', 10000)) | |
bindsocket.listen(1) | |
connect_address = bindsocket.getsockname() |
This file contains hidden or 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 signal | |
from tornado.ioloop import IOLoop | |
from tornado_backdoor import BackdoorServer | |
def handle_SIGINT(signum, frame): | |
io_loop = IOLoop.instance() | |
io_loop.add_callback(io_loop.stop) |
This file contains hidden or 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 | |
import os | |
import pyuv | |
import sys | |
fd = os.getenv('PYUV_CHANNEL_FD') | |
if fd is None: | |
print "[Child] No channel fd found" |