Skip to content

Instantly share code, notes, and snippets.

View mitsuhiko's full-sized avatar
🖥️
What's happening

Armin Ronacher mitsuhiko

🖥️
What's happening
View GitHub Profile
[aliases]
addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
echo \"Making branch for pull request #$1 [pr/$1]\" && \
git fetch origin pull/$1/head:pr/$1 && \
echo \"Rebasing pr/$1 onto $b...\" && \
git fetch -q -f origin pull/$1/merge:refs/PR_MERGE_HEAD && \
git rebase -q --onto $b PR_MERGE_HEAD^ pr/$1 && \
git checkout -q $b && echo && \
git diff --stat $b..pr/$1 && echo && \
git slog $b..pr/$1; \

Keybase proof

I hereby claim:

  • I am mitsuhiko on github.
  • I am mitsuhiko (https://keybase.io/mitsuhiko) on keybase.
  • I have a public key whose fingerprint is D0C6 A999 5649 E5B4 0748 3E54 1D8F BE76 FDD3 E6F2

To claim this, I am signing this object:

$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
>>> app1 = example.Application('app1')
>>> app2 = example.Application('app2')
>>> with app1.source:
... from example.plugins import uppercase as uppercase_app1
...
{
"projects": [
{
"website": "https://github.com/mattupstate/flask-mail",
"status": "active",
"stewards": [
{
"login": "mattupstate",
"num": 2,
"name": "Matt Wright"
#!/usr/bin/env python
import re
from subprocess import Popen, PIPE
def get_cpu_temp():
rv = Popen(['smc', '-k', 'TC0D', '-r'],
stdout=PIPE).communicate()[0]
match = re.search(r'bytes (\S+) (.+?)\)', rv)
a, b = match.groups()
import sys
from contextlib import nested
@contextmanager
def nested(*managers):
exits = []
vars = []
exc = (None, None, None)
try:
impl RedisServer {
pub fn new() -> RedisServer {
let mut process = process::Command::new("redis-server")
.arg("-")
.stdout(process::InheritFd(1))
.stderr(process::InheritFd(1))
//.stdout(process::Ignored)
//.stderr(process::Ignored)
.spawn().unwrap();
>>> from flask import Flask
>>> app = Flask(__name__)
>>> @app.route('/')
... def index():
... pass
...
>>> a = app.url_map.bind('localhost')
>>> a
<werkzeug.routing.MapAdapter object at 0x10a47b390>
>>> a.match('/')
$ /usr/bin/python2.7
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> sorted([5, set()])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only compare to a set
$ python
class _TransactionBlock(object):
def __init__(self, find_session):
self._find_session = find_session
def __enter__(self):
sess = self._find_session()
depth = getattr(sess, '_flask_sqlalchemy_transaction_depth', 0)
sess._flask_sqlalchemy_transaction_depth = depth + 1
if depth > 0: