Skip to content

Instantly share code, notes, and snippets.

View ulope's full-sized avatar

Ulrich Petri ulope

View GitHub Profile
@ulope
ulope / gist:1495a9e7572c62885f30
Created January 14, 2015 12:10
Automatically place tox working directories into a central location
# Add this to your shell's rc file.
# Optionally export TOX_WORKDIR_BASE if you don't like the default of ~/.cache/tox
tox() {
if [ -z "$TOX_WORKDIR_BASE" ]; then
TOX_WORKDIR_BASE=~/.cache/tox
fi
if [ -f tox.ini ]; then
if [ -d .tox -a ! -L .tox ]; then
echo "Warning: Existing .tox directory is not symlinked into TOX_WORKDIR_BASE! Remove and re-run to auto-create symlink."
@ulope
ulope / SQLAlchemy.slides.html
Created November 17, 2014 14:56
PyUGRM #16 Lightning Talk SQLAlchemy
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
@ulope
ulope / click_date_type.py
Created August 19, 2014 18:02
DateTime ParamType for the click CLI Parser library (uses arrow)
import arrow
from arrow.parser import ParserError
import click
class DateParamType(click.ParamType):
name = 'date'
def __init__(self, date_format="YYYY-MM-DD"):
super(DateParamType, self).__init__()
### Keybase proof
I hereby claim:
* I am ulope on github.
* I am ulope (https://keybase.io/ulope) on keybase.
* I have a public key whose fingerprint is 2265 EB92 276E D197 1E68 019C 8EDA C8BD 2021 09C0
To claim this, I am signing this object:
.tox
@ulope
ulope / autolog.py
Last active November 20, 2017 15:17
Call logging decorator
# Written by Brendan O'Connor, brenocon@gmail.com, www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
# Copyright (c) 2003-2006 Open Source Applications Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@ulope
ulope / 02.make
Created April 19, 2014 03:57
mosh build error OS X 10.9
Making install in src
Making install in protobufs
GEN userinput.pb.cc
GEN hostinput.pb.cc
GEN transportinstruction.pb.cc
/Applications/Xcode.app/Contents/Developer/usr/bin/make install-am
CXX hostinput.pb.o
CXX transportinstruction.pb.o
CXX userinput.pb.o
AR libmoshprotos.a
@ulope
ulope / fabfile.py
Created January 29, 2014 15:01
Fabric task to create requirements from setup.py's `install_requires` and (if existing) `dependency_links`
# requires that the `setup()` call in setup.py is guarded with the if __name__ idiom
import imp
import os
from rex import rex # python-rex on PyPI
@task()
def update_req():
setup = imp.load_source("setup", "setup.py")
dep_re = rex("/^(.*?)#egg=(?P<package_name>.*)$/")
docker help run
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
-a=map[]: Attach to stdin, stdout or stderr.
-c=0: CPU shares (relative weight)
-cidfile="": Write the container ID to the file
-d=false: Detached mode: Run container in the background, print new container id
bridge name bridge id STP enabled interfaces
docker0 8000.fe0cf41bd090 no vethlkPXZM
lxcbr0 8000.000000000000 no