Skip to content

Instantly share code, notes, and snippets.

@cchwala
cchwala / gist:f2f8c480c910b72bbd4c30c79daf6b97
Created March 28, 2017 09:01
Force update of local and remote fork if they diverged too far from upstream master
# Get the upstream, i.e. main repo, master
git fetch upstream
# Force the current local branch to equal upstream master
git reset --hard upstream/master
# Force update of remote repo. WARNING: THIS CAN BREAK STUFF
git push origin master --force
@cchwala
cchwala / custom_roll.py
Created July 19, 2016 15:55
Speed of numpy.roll vs list with append and pop vs custom numpy rolling using slices
def my_roll(arr, x):
arr[0:-1] = arr[1:]
arr[-1] = x
return arr