Skip to content

Instantly share code, notes, and snippets.

View smidm's full-sized avatar

Matěj Šmíd smidm

View GitHub Profile
@smidm
smidm / pkgconfig.py
Created June 23, 2016 08:38
pkg-config python wrapper for building extensions with distutils
import subprocess
def pkgconfig(*packages, **kw):
"""
Query pkg-config for library compile and linking options. Return configuration in distutils
Extension format.
Usage:
pkgconfig('opencv')
# modified numpy concatenate, vstack, hstack accepting scalars in the input tuple
def concatenate(tup, axis=0):
tup_arrays = [x for x in tup if isinstance(x, np.ndarray)]
shape = list(tup_arrays[0].shape)
shape[axis] = 1
tup_ = []
for x in tup:
if isinstance(x, (int, long, float)):
@smidm
smidm / annotate.py
Created January 6, 2016 09:10
matplotlib: object text annotation with fixed object-annotation screen distance while zooming
# xy offset xy
plt.annotate('...text...', object_to_annotate_coords, (0, -20), textcoords='offset points', color='k')
@smidm
smidm / maximize_figure.py
Created January 6, 2016 08:54
maximize matplotlib figure
fig_manager = plt.get_current_fig_manager()
if hasattr(fig_manager, 'window'):
fig_manager.window.showMaximized()
@smidm
smidm / bigger_figures.py
Last active November 3, 2015 11:15
makes ipython inline figures bigger
import IPython
IPython.core.pylabtools.figsize(10,6)
@smidm
smidm / strace frequent freezes.ipynb
Created January 19, 2014 21:45
strace analysis of correct behaviour for the bug https://bugzilla.redhat.com/show_bug.cgi?id=1055234
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
supported backends: ['pdf', 'wx', 'gtk3', 'gtk', 'ps', 'qtagg', 'tkagg', 'gtkcairo', 'mixed', 'template', 'gtk3cairo', 'svg', 'qt4agg', 'gtk3agg', 'emf', 'qt', 'cocoaagg', 'qt4', 'wxagg', 'agg', 'gtkagg', 'fltkagg', 'pgf', 'macosx', 'cairo', 'gdk']
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type `PyGtkGenericCellRenderer' is smaller than the parent type's `GtkCellRenderer' class size
from gtk import _gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion `node != NULL' failed
from gtk import _gtk
fish: Job 1, “python valid_matplotlib_backends.py ” terminated by signal SIGSEGV (Address boundary error)