Skip to content

Instantly share code, notes, and snippets.

Avatar

Leonid Shvechikov shvechikov

View GitHub Profile
@wolever
wolever / gevent-in-production.rst
Last active Jul 10, 2018
Point-form notes about using gevent in production
View gevent-in-production.rst
  • 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 monkeypatches.py and gevent_.py files for my implementation of monkeypatching.
  • The gevent_.py file contains a couple things:
View local.py
def my_local(init):
key = object()
def getter():
t = _app_ctx_stack.top
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
jbenet / simple-git-branching-model.md
Last active Jul 27, 2022
a simple git branching model
View simple-git-branching-model.md

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
witsch / net.devpi.devpi-server.plist
Created Aug 17, 2013
run `devpi-server` (http://devpi.net/) using `launchd` on OSX
View net.devpi.devpi-server.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.devpi.devpi-server</string>
<key>ProgramArguments</key>
<array>
@archeg
archeg / gist:5652752
Created May 26, 2013
Example of working with notes on Google Spreadsheet
View gist:5652752
__author__ = 'archeg'
import httplib
import urllib
import urllib2
import re
def URLRequest(url, params, headers, method="GET"):
if method == "POST":
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active Aug 10, 2022
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- 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
erikh / hack.sh
Created Mar 31, 2012 — forked from DAddYE/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@shvechikov
shvechikov / fmtcsv.py
Created Mar 27, 2012 — forked from astanin/fmtcsv.py
Pretty-print CSV file with fixed width columns.
View fmtcsv.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Usage: %prog [width [columns]] < table.csv
Pretty-print CSV file with fixed width columns.
Arguments:
@astanin
astanin / fmtcsv.py
Created Mar 27, 2012
Pretty-print CSV file with fixed width columns.
View fmtcsv.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Usage: %prog [width [columns]] < table.csv
Pretty-print CSV file with fixed width columns.
Arguments:
@koblas
koblas / smtp.py
Created Nov 11, 2011
SMTP Client for Tornado
View smtp.py
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