Skip to content

Instantly share code, notes, and snippets.

View ulope's full-sized avatar

Ulrich Petri ulope

View GitHub Profile
@ulope
ulope / admin.py
Last active December 15, 2015 09:19
from django.contrib.admin import site
from treebeard.admin import TreeAdmin
from apps.foldermgr.models import FolderTemplate
site.register(FolderTemplate, TreeAdmin)
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo 'Hg' && return
echo '○'
}
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo %{$reset_color%}' working on '%{$fg[blue]%}`basename $VIRTUAL_ENV`%{$reset_color%}
}
bridge name bridge id STP enabled interfaces
docker0 8000.fe0cf41bd090 no vethlkPXZM
lxcbr0 8000.000000000000 no
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
@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>.*)$/")
@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 / 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
#
.tox
### 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:
@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__()