Skip to content

Instantly share code, notes, and snippets.

View shvechikov's full-sized avatar

Leonid Shvechikov shvechikov

View GitHub Profile
wolever / gevent-in-production.rst
Last active July 10, 2018 21:03
Point-form notes about using gevent in production
  • I've been using gevent in production for about 6 years, and I've only encountered a handful of issues:
    • In gevent pre-1.0 there were issues with the DNS resolver
    • I've had a couple of issues with gevent-openssl, which I've fixed by using a custom version: mjs/gevent_openssl#14 and mjs/gevent_openssl#12
    • Celery hangs when gevent is monkeypatched. I haven't figured out why, and this might have been fixed in newer versions of celery (the one I'm using is fairly old).
  • All of my experience using gevent is in fully monkeypatched mode. It's certainky possible to use outside of monkeypatch mode, but I don't know anything about that.
  • See the and files for my implementation of monkeypatching.
  • The file contains a couple things:
ei-grad /
Last active August 29, 2015 14:02
def my_local(init):
key = object()
def getter():
t =
l = getattr(t, 'my_locals')
if l is None:
t.my_locals = l = {}
if key not in l:
l[key] = init()
return l[key]
jbenet /
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

witsch / net.devpi.devpi-server.plist
Created August 17, 2013 13:28
run `devpi-server` ( using `launchd` on OSX
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
archeg / gist:5652752
Created May 26, 2013 13:14
Example of working with notes on Google Spreadsheet
__author__ = 'archeg'
import httplib
import urllib
import urllib2
import re
def URLRequest(url, params, headers, method="GET"):
if method == "POST":
rgreenjr / postgres_queries_and_commands.sql
Last active April 19, 2024 07:21
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
erikh /
Created March 31, 2012 07:02 — forked from DAddYE/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
shvechikov /
Created March 27, 2012 12:06 — forked from astanin/
Pretty-print CSV file with fixed width columns.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
Usage: %prog [width [columns]] < table.csv
Pretty-print CSV file with fixed width columns.
astanin /
Created March 27, 2012 11:43
Pretty-print CSV file with fixed width columns.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
Usage: %prog [width [columns]] < table.csv
Pretty-print CSV file with fixed width columns.
koblas /
Created November 11, 2011 15:23
SMTP Client for Tornado
from tornado import ioloop
from tornado import iostream
import socket
class Envelope(object):
def __init__(self, sender, rcpt, body, callback):
self.sender = sender
self.rcpt = rcpt[:]
self.body = body
self.callback = callback