Skip to content

Instantly share code, notes, and snippets.

@OddBloke
OddBloke / preview_rest.py
Created November 3, 2011 20:34
PyBlosxom reST Preview
from pprint import pformat
import sys
from docutils.core import publish_parts
content = []
meta = {}
def _handle_line(line):
if not line.startswith('#'):
@OddBloke
OddBloke / gist:2360312
Created April 11, 2012 16:17
nose multiprocessing failure
from nose.tools import make_decorator
class decorate(object):
def __init__(self, numbers):
self.numbers = numbers
def __call__(self, f):
def wrap(args):
@OddBloke
OddBloke / layout.html
Created July 9, 2012 14:44
Add A GitHub Changelog Sidebar To Sphinx Docs
{% extends '!layout.html' %}
{% block sidebarsourcelink %}
{{ super() }}
<ul>
<li><a href="https://github.com/<user>/<repository>/commits/master/<path to source>/{{ sourcename|replace('.txt', '.rst') }}">Changelog</a></li>
</ul>
{% endblock %}
# For extracting user and pass
preds = map(eq_fact, ['user_name', 'password'])
[[user_name], [password]] = pred_list_partition(preds, kwargs, False)
def eq_fact(name):
def wrapped(x):
return x == name
Usage: javacTask <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files and annotation processors
-cp <path> Specify where to find user class files and annotation processors
def __call__(self, sender, signal, **kwargs):
form = sender
<rest of method not using sender>
WIDE_PROMPT="$USERNAME_NORMAL_COLOR%n$RESET_COLOR@%{$HOSTNAME_NORMAL_COLOR%}%m%{$reset_color%}:$DARK_RED%~$RESET_COLOR%# "
NARROW_PROMPT="$USERNAME_NORMAL_COLOR%n$RESET_COLOR@%{$HOSTNAME_NORMAL_COLOR%}%m%{$reset_color%}:$DARK_RED%~$RESET_COLOR
%# "
size_prompt() {
if [ $COLUMNS -lt 85 ]; then
PROMPT=$NARROW_PROMPT
else
PROMPT=$WIDE_PROMPT
fi
% s route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.101.0.1 0.0.0.0 UG 0 0 0 eth0
10.101.0.0 * 255.255.240.0 U 0 0 0 eth0
10.101.34.0 * 255.255.255.0 U 0 0 0 wlan0
{% set port = '9001' -%}
supervisor:
pkg:
- installed
service:
- running
- require:
- pkg: supervisor
- watch:
@OddBloke
OddBloke / gist:6535868
Created September 12, 2013 11:11
gvim Stack Trace
*** Error in `gvim': double free or corruption (!prev): 0x0000000007970780 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7aa26)[0x7fd1fdddba26]
/lib/x86_64-linux-gnu/libc.so.6(+0x7b7a3)[0x7fd1fdddc7a3]
gvim(mf_close+0x61)[0x5c4541]
gvim(ml_close+0x12)[0x4cc9b2]
gvim(buf_freeall+0x15c)[0x43b63c]
gvim(do_ecmd+0x43c)[0x47a90c]
gvim(do_exedit+0x125)[0x4949a5]
gvim(do_cmdline+0x12d3)[0x491ad3]