Skip to content

Instantly share code, notes, and snippets.

What's happening

Armin Ronacher mitsuhiko

What's happening
View GitHub Profile
from flask import request, url_for
def url_for_here(**changed_args):
args = request.args_args.copy()
return url_for(request.endpoint, **args)
app.jinja_env.globals['url_for_here'] = url_for_here
View gist:10130454
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
mitsuhiko / .gitconfig
Last active Jan 30, 2021
Adds the ultimate of all pull request commands to git
View .gitconfig
# Alternatively don't use slog but something else. I just like that more.
slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
git fetch origin pull/$1/head:pr/$1 && \
git fetch -f origin pull/$1/merge:PR_MERGE_HEAD && \
git rebase --onto $b PR_MERGE_HEAD^ pr/$1 && \
git branch -D PR_MERGE_HEAD && \
git checkout $b && echo && \
git diff --stat $$1 && echo && \
View gist:5721547

wsgi.input_terminated Proposal

Problem Description

Currently WSGI servers or WSGI middlewares cannot accept chunked requests or perform request filtering because a WSGI application needs to depend on the content length as this is the only thing that the specification currently guarantees will work.

from sre_parse import Pattern, SubPattern, parse as sre_parse
from sre_compile import compile as sre_compile
from sre_constants import BRANCH, SUBPATTERN
class Scanner(object):
def __init__(self, tokens, flags=0):
subpatterns = []
pat = Pattern()

These become tabbed automatically
[Foo bar]
View foo.txt
Some stuff here
title: Foo
body: Bar
Bla bla
View Cargo.toml
name = "debscraper"
version = "0.1.0"
authors = ["Armin Ronacher <>"]
edition = "2018"
# See more keys and their definitions at
url = "2.1.0"
pub fn copy_with_progress<R: ?Sized, W: ?Sized>(progress: &ProgressBar,
reader: &mut R, writer: &mut W)
-> io::Result<u64>
where R: Read, W: Write
let mut buf = [0; 16384];
let mut written = 0;
loop {
let len = match buf) {
Ok(0) => return Ok(written),
View terrible.diff
diff --git a/src/service/objects/ b/src/service/objects/
index d6dcdd6..1c79c67 100644
--- a/src/service/objects/
+++ b/src/service/objects/
@@ -313,6 +313,7 @@ pub struct ObjectsActor {
meta_cache: Arc<Cacher<FetchFileMetaRequest>>,
data_cache: Arc<Cacher<FetchFileDataRequest>>,
download_thread: RemoteThread,
+ cache_pool: ThreadPool,