How to make your desktop open different URLs in different browsers, depending on the URL
-
vim ~/bin/open-the-right-browser
#!/bin/sh case "$1" in *git.example.com*) browser=firefox;; *) browser=chromium-browser;; esac
exec
import hudson.triggers.*; | |
for (item in Jenkins.instance.getItems(Project)) { | |
println("--- Scheduling for " + item.name + " ---") | |
def trigger = item.triggers.get(Jenkins.instance.getDescriptor(TimerTrigger.class)); | |
if (trigger) { | |
println trigger.spec; | |
} | |
} |
#!/usr/bin/python | |
""" | |
Multiping version ${version} by Marius Gedminas <marius@gedmin.as> | |
Licence: GPL v2 or later | |
Syntax: multiping hostname | |
Pings a host every second and displays the results in an ncurses window. | |
Legend: | |
# ping OK |
auto lo | |
iface lo inet loopback | |
auto eth0 | |
iface eth0 inet static | |
address X.X.X.X | |
pointopoint X.X.X.Y | |
netmask 255.255.255.255 | |
gateway X.X.X.Y | |
dns-nameservers A.B.C.D A.B.C.E A.B.C.F |
#!/bin/sh | |
set -e | |
COMPILED_BY="Marius Gedminas <marius@gedmin.as>" | |
FEATURES= | |
FEATURES="$FEATURES --with-features=huge" # yum, features | |
FEATURES="$FEATURES --enable-multibyte" # vim is *crippled* without this! | |
# (BTW 'big' implies this) | |
FEATURES="$FEATURES --enable-pythoninterp" # most of my plugins use this | |
FEATURES="$FEATURES --enable-rubyinterp" # Command-T wants this |
#!/bin/sh | |
# update dynamic files in /var/www/zope3.pov.lt/py3/ | |
# /opt/ztk-py3-status/ is a checkout of https://github.com/mgedmin/ztk-py3-status | |
# /opt/ztk-py3-status/*.py require python3 | |
# sponge requires moreutils | |
# convert requires imagemagick | |
# dot and neato require graphviz | |
cache_dir=/stuff/pypi-cache |
#!/usr/bin/env python | |
import sys | |
import getpass | |
import argparse | |
try: | |
# Suppress PyGI warning (LP: #1510392) | |
import gi | |
gi.require_version('GnomeKeyring', '1.0') | |
except (ImportError, ValueError): |
#!/usr/bin/python3 | |
""" | |
Show recent requests on a timeline | |
Parses a ZServer trace.log file. The format is documented at | |
https://pypi.python.org/pypi/zc.zservertracelog | |
""" | |
import json | |
import re |
How to make your desktop open different URLs in different browsers, depending on the URL
vim ~/bin/open-the-right-browser
#!/bin/sh
case "$1" in
*git.example.com*) browser=firefox;;
*) browser=chromium-browser;;
esac
exec
= Problem =
timeit.timeit()
doesn't let you pass local vars to the code to be timed.
= Solution =
(pdb) !import sys, timeit
(Pdb) !dv = (lambda sys=sys: (lambda **kw: setattr(sys.modules['__main__'], 'VARS', kw)))()
(Pdb) !tt = lambda s, sys=sys: sys.stdout.write('%.3g ms\n' % timeit.timeit(s, 'import sys; self = sys.modules["__main__"].SELF', number=10)/10.*1000)
#!/usr/bin/env python | |
""" | |
Compare PDF reports pixel-wise. | |
When reportgen functional tests fail, you may want to see visually what | |
exactly changed. To do that: | |
(1) set your changes aside, e.g. | |
git stash |