Skip to content

Instantly share code, notes, and snippets.

sbebo /
Created Sep 5, 2017
Remove all git commits from history by given author
while [ -n "$1" ];
map "$1";
sbebo /
Last active Sep 5, 2017
Remove files and/or subdirs from all git history
git filter-branch -f --index-filter "git rm -r --cached --ignore-unmatch file1 file2 dir1 dir2" --prune-empty
View livemap.js
// this can be loaded via browser console with
// var script=document.createElement('script'); script.type='text/javascript'; script.src=''; document.head.appendChild(script);
var vehicleName;
var vehicleStats = [
{last: "10/08/2016 - 80€", level: "12%"},
{last: "13/08/2016 - 65€", level: "70%"},
{last: "14/08/2016 - 76€", level: "85%"},
sbebo /
Last active Oct 11, 2019
Create new repo from subdirectory
mkdir subdir-fork
cd subdir-fork
git clone
git filter-branch --prune-empty --subdirectory-filter <SUBFOLDER> master
git remote -v
git remote rm origin
git remote add origin<NEWREPO>.git
View gist:ff653eb60b3af9acb13e
+ iterm: VIM or SSH scrollback buffer is preserved? --> Uncheck "Save lines to scrollback in alternate screen mode"
+ ipython/jupyter: if installed via anaconda, it is not a "framework", so the osx backend in matplotlib works badly (keyboard highlight stays on the notebook). it's better to use qt, at least it works.
+ SCIP/SCIP.jl: to have a .dylib, just rename the .so file to .dylib
+ slow text cursor (repeat interval): system preferences -> keyboard -> key repeat
View gist:e5348894c6c78db5d8c5
:'<,'>s/@defVar(m, /var /g
:'<,'>s/@addConstraint(m, /subject to /g
sbebo / gist:07bff0f318388c0a7452
Created Jun 16, 2015
Install from pypi with conda
View gist:07bff0f318388c0a7452
conda skeleton pypi #package#
conda build #package#
conda install --use-local #package#
View gist:dae0fe67df11d91ef7cf
ssh -N -f -L localhost:9999:localhost:8888
#tunnel via port 9999 to port 8888 on remote host. useful, e.g., for ipython notebooks.
View lp.jl
module LPTest
using JuMP
using CPLEX, Gurobi
function gen_data(M, N)
println("Generating data..")
p = max(randn(N),0)
A = max(randn(M,N),0)
b = abs(randn(M))
sbebo / gist:2311b6bd279d5e3ef412
Created Sep 15, 2014
Move one file (with history) from one git repo to another
View gist:2311b6bd279d5e3ef412
mkdir /tmp/mergepatchs
cd ~/repo/org
export reposrc=myfile.c #or mydir
git format-patch -o /tmp/mergepatchs $(git log $reposrc|grep ^commit|tail -1|awk '{print $2}')^..HEAD $reposrc
cd ~/repo/dest
git am /tmp/mergepatchs/*.patch
You can’t perform that action at this time.