Skip to content

Instantly share code, notes, and snippets.

@draplater
draplater / asyncio_producer_consumer.py
Created May 5, 2016 16:03 — forked from akrylysov/asyncio_producer_consumer.py
Python 3 asyncio basic producer / consumer example
import asyncio
import random
q = asyncio.Queue()
async def producer(num):
while True:
await q.put(num + random.random())
await asyncio.sleep(random.random())
@draplater
draplater / gist:f4c05f1a74e43a6fbd3b
Created December 2, 2015 15:48 — forked from prellele/gist:1825744
Using StartSSL Certs with Nginx-Webserver

NOTE: You can check, if your config here:
http://www.sslshopper.com/ssl-checker.html

Decrypt the private key using the password you entered when you created your key:
openssl rsa -in ssl.key -out /etc/nginx/conf/ssl.key

Protect your key from prying eyes:
chmod 600 /etc/nginx/conf/ssl.key

@draplater
draplater / nginx-gitweb.md
Created December 1, 2015 05:12
Set up Gitweb + Nginx from scratch on Debian Wheezy

This guide offers the least time-consuming way of setting up Nginx for serving Git repositories over HTTP using Gitweb. The stuff here has been tested with Git 1.9.1 and Nginx 1.6.0 on Debian Wheezy. Probably also works for Ubuntu, etc.

Total time ~ 10 minutes.

Install

Enable wheezy-backports by adding this line to /etc/apt/sources.list:

deb http://http.debian.net/debian wheezy-backports main
@draplater
draplater / pandas_dbms.py
Created November 29, 2015 06:41 — forked from catawbasam/pandas_dbms.py
Python PANDAS : load and save Dataframes to sqlite, MySQL, Oracle, Postgres
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
@draplater
draplater / chacha20.js
Last active September 16, 2015 12:04 — forked from devi/chacha20.js
chacha20.js
/* chacha20 - 256 bits */
// Written in 2014 by Devi Mandiri. Public domain.
//
// Implementation derived from chacha-ref.c version 20080118
// See for details: http://cr.yp.to/chacha/chacha-20080128.pdf
var Chacha20KeySize = 32;
var Chacha20NonceSize = 8;
@draplater
draplater / Kexec for ARM
Last active September 11, 2015 08:56 — forked from Gnurou/Kexec for ARM
Cross-compiling Kexec for ARM, how-to.
./bootstrap
LDFLAGS=-static ./configure --host=arm-none-linux-gnueabi --without-zlib --without-lzma
make
-> static binary in build/sbin/kexec
@draplater
draplater / processify.py
Last active August 29, 2015 14:27 — forked from schlamar/processify.py
processify
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.