Skip to content

Instantly share code, notes, and snippets.

View stefanv's full-sized avatar

Stefan van der Walt stefanv

View GitHub Profile
_________________________________________________________________________________ test_convex_image _________________________________________________________________________________
def test_convex_image():
img = regionprops(SAMPLE)[0].convex_image
# determined with MATLAB
ref = np.array(
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
#!/bin/bash
# From https://koenig-haunstetten.de/2017/01/02/google-calendar-integration-in-orgmode/
#
# Install into crontab with `crontab -e`:
#
# 3 * * * * ~/scripts/gcal-sync-org > /dev/null 2>&1
#
# Modify your emacs init script to load `diary.google` from DIARY_PATH:
#
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import urllib.request
import os
archive = 'https://mail.python.org/pipermail/numpy-discussion'
months = ('January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December')
output = 'mirror'
if not os.path.isdir(output):
#!/bin/bash
CONTAINERS=$(docker ps -aq)
IMAGES=$(docker images --filter dangling=true --quiet)
if [[ $CONTAINERS ]]; then
docker rm $CONTAINERS
else
echo "No containers to remove"
fi
if [[ $IMAGES ]]; then
In [3]: deprecated?
Init signature: deprecated(alt_func=None, behavior='warn', removed_version=None)
Docstring:
Decorator to mark deprecated functions with warning.
Adapted from <http://wiki.python.org/moin/PythonDecoratorLibrary>.
Parameters
----------
alt_func : str
cimport numpy as cnp
import numpy as np
ctypedef int (*kernel)(double[:] arr)
cdef kernel0(double[:] arr):
cdef int i
for i in range(arr.shape[0]):
arr[i] = 0
import subprocess
import numpy as np
res = subprocess.check_output(['git', 'shortlog', '-s', '-n', '--merges',
'--first-parent', 'master',
'--since="1 year ago"'])
res = res.decode('utf-8').split('\n')
res = [r for r in res if r.strip()]
merges, authors = zip(*[r.split(maxsplit=1) for r in res])
@stefanv
stefanv / _coords.npy
Last active May 22, 2018 00:37
Capture points and replot with cubic interpolation

Edit your milestone and in the description put on a line by itself:

on-merge: backport to v0.14.x for example.

Now if a PR is assigned a milestone before being merged, the bot will submit a backport automatically if possible. You can also manually request a backport:

@MeeseeksDev backport [to] {branch}