Skip to content

Instantly share code, notes, and snippets.

@schmir
schmir / .sh
Created January 31, 2019 11:13
show git status on tab key
# When Tab is pressed on an empty(!) command line, the contents of the
# directory are printed (`ls`) instead of a menu list of all
# executables:
function my-hg-report() {
tip=$(hg tip 2> /dev/null) || return
echo
hg --config pager.pager= status
echo
hg --config pager.pager= log --limit 5 --style compact
@schmir
schmir / jdbc_streaming.clj
Created July 5, 2017 12:25
streaming responses in java.jdbc
(ns soka-trb.jdbc-streaming
"streaming results in clojure.java.jdbc, when {:use-streaming? true} is passed
as option
hooks into jdbc/prepare-statements and calls turn-on-streaming
Users need to extend the TurnOnStreaming protocol for their databases
"
(:require [clojure.java.jdbc :as jdbc]
[robert.hooke]))
# use ssh url instead of anonymous
[url "git@github.com:brainbot-com/"]
insteadOf = https://github.com/brainbot-com/
# save this as ~/.config/pep8
[pep8]
ignore = E401,E501,E126,E123,E128,E127,E124,E122
exclude = .svn,CVS,.bzr,.hg,.git,.tox,build
#! /usr/bin/env python
import smtplib
_from = "ralf@pediapress.com"
_to = "schmir@gmail.com"
s = smtplib.SMTP("brainbot.com", 25)
s.set_debuglevel(True)
s.ehlo()
#! bin/buildout -c
[buildout]
extends = buildout.cfg
develop +=
../fscrawler
[versions]
fscrawler=
import pytest, py, os
@pytest.fixture(autouse=True)
def chdir_tmpdir(request, tmpdir):
"""autouse fixture that chdirs to tmpdir"""
cwd = py.path.local(".")
tmpdir.chdir()
request.addfinalizer(cwd.chdir)
# Copyright (c) 2007-2009 PediaPress GmbH
# See README.rst for additional licensing information.
"""custom json encoder/decoder, which can handle metabook objects"""
from mwlib import metabook
try:
import simplejson as json
except ImportError:
# allow to silence error reporting for certain 'expected exceptions'
# gevent prints a error report including a traceback for each failed
# greenlet. this is at times useful, but you're currently forced to
# either handle exceptions in those greenlets or live with the traceback
# on stderr.
# patch_gevent introduces a class variable 'expected_exceptions' to
# gevent's greenlet class. This is a tuple of exceptions for which no
# error report should be printed to stderr.
.file "greenlet.c"
.text
.p2align 4,,15
.type green_is_gc, @function
green_is_gc:
.LFB148:
.cfi_startproc
cmpq $-1, 24(%rdi)
je .L3
xorl %eax, %eax