Skip to content

Instantly share code, notes, and snippets.

View btel's full-sized avatar
💡
open to freelance opportunities

Bartosz Telenczuk btel

💡
open to freelance opportunities
View GitHub Profile
#!/usr/bin/python
import subprocess
import sys
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("team1")
parser.add_argument("team2")
{
"a": 1,
"nested_dictionary": {
"c": 1,
"d": 2
},
"b": 2,
"list": [
1,
2,
Only in inkscape-0.48.4-patched/: patch-clang.diff
diff -crB inkscape-0.48.4/src/2geom/sbasis.h inkscape-0.48.4-patched/src/2geom/sbasis.h
*** inkscape-0.48.4/src/2geom/sbasis.h Fri Jul 8 20:25:09 2011
--- inkscape-0.48.4-patched/src/2geom/sbasis.h Fri Nov 8 00:42:01 2013
***************
*** 75,84 ****
return d[i];
}
Linear& operator[](unsigned i) { return d.at(i); }
! Linear const* begin() const { return (Linear const*)&*d.begin();}
@btel
btel / cross-correlogram normalisation.ipynb
Created March 3, 2014 18:57
generating correlated spikes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python
import svgutils.transform as sg
import sys
import os
#create new SVG figure
fig = sg.SVGFigure("15cm", "10cm")
@btel
btel / lif.py
Last active August 29, 2015 13:59
numba implementation of LIF
@jit(double[:,:2](double[:], double[:], double, double, double))
def lif_model(ge, gi, dt=dt, vreset=0, vthresh=-40*mV):
v = vreset
mem_pot = np.zeros((len(ge), 2))
Ee, Ei = 0, -100
El = -60
gl = 1/60
C = 250
for i in range(len(ge)):
dv = (-gl*(v-El) - ge[i]*(v-Ee) - gi[i]*(v-Ei))*dt/C
#!/bin/bash
python $*
fname="${@: -1}"
width=`identify -format %w $fname`
gitversion=`git rev-parse --short HEAD`
origin_name=`basename $(git remote show -n origin | grep Fetch | cut -d: -f2-)`
branch=`git rev-parse --abbrev-ref HEAD`
#!/bin/bash
TMPDIR=$(mktemp -d /tmp/git-latexdiff.XXXXXX)
latexdiff "$1" "$2" > $TMPDIR/diff.tex
pdflatex -interaction nonstopmode -output-directory $TMPDIR $TMPDIR/diff.tex
pdflatex -interaction nonstopmode -output-directory $TMPDIR $TMPDIR/diff.tex
evince $TMPDIR/diff.pdf
rm -rf $TMPDIR
@btel
btel / README
Last active October 25, 2018 20:40
Thined version of matplotlib Axes for better performance
When improving the performance of plotting high-dimensional data using
faceted scatter plots, I noticed that much of time was spent on the axis
creation (even 50%!).
On my machine creating 20x20 array of subplots without actually plotting
anything takes about 11 seconds (for comparison plotting 5000 points on
all of them takes only 0.6s!):
import matplotlib
matplotlib.interactive(True)
#from github.com/gdetor/SPySort
def get_jitter(self, evts, center, centerD, centerDD):
""" Estimates the jitter given an event or a matrix of events where
individual events form the rows, a median event and the first two
derivatives of the latter.
**Parameters**
evts : double (array)