This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
# vagrant plugin install vagrant-proxyconf | |
# apt-get install squid-deb-proxy-client | |
if Vagrant.has_plugin?("vagrant-proxyconf") | |
config.apt_proxy.http = `/usr/share/squid-deb-proxy-client/apt-avahi-discover` | |
# NB: you must 'vagrant provision' when you change networks, or the | |
# proxy config may be stale | |
end | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet super "super()" !b | |
`!p | |
# Set a fallback completion first | |
# snip.rv = 'super(${1:ClassName}, self).${2:method}(' <-- does not work | |
snip.rv = 'super(' | |
import vim | |
# this needs pythonhelper.vim | |
tag = vim.eval('TagInStatusLine()') | |
if tag: | |
# pythonhelper.vim's TagInStatusLine() returns '[in SomeClass.some_method (method)]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Grep for a string in all the Python packages in the buildout path | |
# Assumes . is the directory with a buildout.cfg | |
# Note: there is no one true buildout path -- every part has its own. So | |
# we look for a python interpreter in bin/python (or bin/py) and use its path. | |
# If that fails, we try to find a bin/test script and scrape the path from it. | |
# Should also work with virtualenv (just run it somewhere with a bin/python) | |
# Based on buildout-tags, which lives at https://gist.github.com/mgedmin/5152189 | |
progname=${0##*/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Using ~/bin/transset instead of the broken /usr/bin/transset" | |
echo "See https://bugs.freedesktop.org/show_bug.cgi?id=76958" | |
opacity=${1:-0.75} | |
scaled=$(echo "$opacity*4294967295"|bc) | |
hex=$(printf "0x%x" ${scaled%.*}) | |
echo "Setting opacity to $opacity" | |
xprop -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $hex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
filename=${1:-bootstrap.py} | |
test -f "$filename" || { | |
echo "there is no $filename here" | |
exit 1 | |
} | |
checksum=$(sha1sum "$filename") | |
case "$checksum" in | |
0b63906b1c5d2eccbc9f727b0c1374c7c29f06a2*) | |
echo "you've got the obsolete v1.x bootstrap.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gi.repository import GLib, Gtk | |
def make_option(long_name, short_name=None, flags=0, arg=GLib.OptionArg.NONE, | |
arg_data=None, description=None, arg_description=None): | |
# surely something like this should exist inside PyGObject itself?! | |
option = GLib.OptionEntry() | |
option.long_name = long_name.lstrip('-') | |
option.short_name = 0 if not short_name else short_name.lstrip('-') | |
option.flags = flags | |
option.arg = arg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mg@platonas: ~/src/apt-sources/glib2.0-2.42.0 $ valgrind gnome-calculator | |
==9270== Memcheck, a memory error detector | |
==9270== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. | |
==9270== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info | |
==9270== Command: gnome-calculator | |
==9270== | |
==9270== Conditional jump or move depends on uninitialised value(s) | |
==9270== at 0x7871324: composite_traps (cairo-xlib-render-compositor.c:1882) | |
==9270== by 0x78591AE: composite_traps (cairo-traps-compositor.c:1098) | |
==9270== by 0x78591AE: composite_mask_clip (cairo-traps-compositor.c:2029) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mgedmin> I'm seeing very weird segfaults in glib | |
in g_closure_invoke(), to be precise | |
this is on ubuntu gnome 14.10 with their gnome3-staging ppa enabled, so who knows what got broken where | |
but basically all the apps are segfaulting left and right when widgets lose focus | |
the stack trace is this: https://gist.github.com/0c80f6e81d9dfc4a4fd7 | |
I have a core dump and I can poke around it with gdb | |
and gdb tells me closure->marshal is 0x7fd4ba283040 <g_cclosure_marshal_VOID__BOOLEAN> | |
and real_closure->meta_marshal is 0x7fd4ba27fb10 <g_type_class_meta_marshal> | |
the segfault is here: https://github.com/GNOME/glib/blob/glib-2-42/gobject/gclosure.c#L768 | |
it's invoking a local variable 'marshal' which is "optimized out" in the stack trace's locals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
style "menu_item" | |
{ | |
xthickness = 2 | |
ythickness = 4 | |
# HACK: Gtk doesn't actually read this value | |
# while rendering the menu items, but Libreoffice | |
# does; setting this value equal to the one in | |
# fg[PRELIGHT] ensures a code path in the LO theming code | |
# that falls back to a dark text color for menu item text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
Parse email messages with Python tracebacks, add email headers to group them. | |
Usage with procmail: | |
# Traceback emails! | |
:0 fw | |
* ^From: some-service@example.com | |
* ^TO_.*errors-go-here@example.com |
OlderNewer