Skip to content

Instantly share code, notes, and snippets.

View jampekka's full-sized avatar

Jami Pekkanen jampekka

View GitHub Profile
@jampekka
jampekka / tsv_to_heatmap.py
Last active August 29, 2015 14:07
Heatmaphack
import numpy as np, matplotlib.pyplot as plt, sys
from scipy.ndimage.filters import gaussian_filter
def transparent_jet(cutoff=0.2):
colormap = plt.cm.get_cmap('jet')
colormap._init()
alphas = np.linspace(0.0, 1.0, colormap.N)
alphas[alphas < cutoff] = 0.0
alphas[alphas > cutoff] = 1.0
colormap._lut[:-3,-1] = alphas
@jampekka
jampekka / gst0.10.py
Created September 17, 2014 19:07
Gstreamer 1.0 v4l2src with Python halts
# PyGST with Gst 0.10 works fine
import gst
pipe = gst.parse_launch("""v4l2src device=/dev/video0 !
appsink sync=false max-buffers=1 drop=true name=sink emit-signals=true""")
sink = pipe.get_by_name('sink')
pipe.set_state(gst.STATE_PLAYING)
<html>
<head>
<script src="http://motherjones.github.io/newsquizjs/jquery.js"></script>
<script src="http://motherjones.github.io/newsquizjs/tabletop.js"></script>
<script src="http://motherjones.github.io/newsquizjs/newsquiz.min.js"></script>
<link href="http://motherjones.github.io/newsquizcss/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="http://motherjones.github.io/newsquizcss/bootstrap-responsive.css" rel="stylesheet" media="screen">
<link href="http://motherjones.github.io/newsquizcss/style.css" rel="stylesheet" media="screen">
</head>
<body>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.