https://gist.github.com/victor-shepardson/5b3d3087dc2b4817b9bffdb8e87a57c4
I'm using Ubuntu 16.04 with a GTX 1060
# ----------------------------------------------------------------------------- | |
# From https://en.wikipedia.org/wiki/Minkowski–Bouligand_dimension: | |
# | |
# In fractal geometry, the Minkowski–Bouligand dimension, also known as | |
# Minkowski dimension or box-counting dimension, is a way of determining the | |
# fractal dimension of a set S in a Euclidean space Rn, or more generally in a | |
# metric space (X, d). | |
# ----------------------------------------------------------------------------- | |
import scipy.misc | |
import numpy as np |
def find_view(base, view): | |
""" | |
Given an array that is a `view` of a `base`, find an index such that | |
`base[index] is view` | |
""" | |
if not isinstance(view, np.ndarray): | |
return "..." | |
itemsize = view.itemsize |
def poisson_disk_sample(width=1.0, height=1.0, radius=0.025, k=30): | |
# References: Fast Poisson Disk Sampling in Arbitrary Dimensions | |
# Robert Bridson, SIGGRAPH, 2007 | |
def squared_distance(p0, p1): | |
return (p0[0]-p1[0])**2 + (p0[1]-p1[1])**2 | |
def random_point_around(p, k=1): | |
# WARNING: This is not uniform around p but we can live with it | |
R = np.random.uniform(radius, 2*radius, k) | |
T = np.random.uniform(0, 2*np.pi, k) |
# Matplotlib / individual rotation markers using a single path | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.path import Path | |
from matplotlib.animation import FuncAnimation | |
from matplotlib.collections import PathCollection | |
triangle = [[(-0.25, -0.5), (+0.0, +0.5), (+0.25, -0.5), (+0.0, +0.0)], |
# Author: Jake VanderPlas | |
# LICENSE: MIT | |
from __future__ import division | |
import numpy as np | |
def convolution_matrix(x, N=None, mode='full'): | |
"""Compute the Convolution Matrix |
# Copyright (2017) Nicolas P. Rougier - BSD license | |
# Twitter version (140 characters) | |
# -------------------------------- | |
_='0' | |
R,C="{:08b}".format(30),_*9+'1'+_*9 | |
for k in range(9): | |
print(C) | |
C = _+''.join([R[7-eval('0b'+C[i:i+3])] for i in range(len(C)-2)])+_ |
;; Refactored from https://github.com/djcb/mu/pull/783 | |
(defun mu4e~headers-msg-unread-p (msg) | |
"Check if MSG is unread." | |
(let ((flags (mu4e-message-field msg :flags))) | |
(and (member 'unread flags) (not (member 'trashed flags))))) | |
(defvar mu4e-headers-folding-slug-function | |
(lambda (headers) (format " (%d)" (length headers))) |
https://gist.github.com/victor-shepardson/5b3d3087dc2b4817b9bffdb8e87a57c4
I'm using Ubuntu 16.04 with a GTX 1060
" cat | |
lac 017777 i " Load accumulator (AC) with argument count | |
sad d4 " Skip next if we have more than 4 words of args | |
jmp nofiles " Otherwise, jump to nofiles | |
lac 017777 " Load AC with address of args | |
tad d1 " Increment AC by 1, past argument count | |
tad d4 " Increment AC by 4, now AC points to first real arg | |
dac name " Save arg pointer from AC into 'name' |