Skip to content

Instantly share code, notes, and snippets.

@stsievert
stsievert / gist:5332606
Created April 7, 2013 21:25
StackOverflow animation
[self.view.layer removeAllAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.1];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
[UIView commitAnimations];
@stsievert
stsievert / pay.py
Created May 4, 2013 20:54
For reddit!
# from http://www.ece.illinois.edu/students/salaries.html1010
bee = 60.646e3
phd = 90.374e3
# doesn't account for pay raises (which are common)
total_pay_bee = bee * (65 - 23)
total_pay_phd = phd * (65 - 23 - 7) + 20e3*7
@stsievert
stsievert / Error Log
Created May 20, 2013 13:44
An error log, for XCode.
Process: Xcode [1966]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 4.6.2 (2067.2)
Build Info: IDEApplication-2067002000000000~2
App Item ID: 497799835
App External ID: 15055625
Code Type: X86-64 (Native)
Parent Process: launchd [261]
User ID: 501
@stsievert
stsievert / numba.py
Created May 21, 2013 13:53
A bug with @autojit... or perhaps I'm defining my function incorrectly?
# let's define it regularly
def findNewNumber(n):
newNumber = 0
for i in arange(len(str(n))):
newNumber += int(str(n)[i])**2
return newNumber
In [7]: run euler.py
@stsievert
stsievert / generate_cached_times.py
Last active December 18, 2015 18:10
scikit-image PR #1792
# This was run from a notebook (so I could choose which cells to run).
# I have also uploaded the entire notebook as skimage_fftconvolve.ipynb (via a dropbox link)
# Cell 1
from skimage.restoration import richardson_lucy
import numpy as np
from scipy.signal import convolve, fftconvolve
import timeit
%matplotlib inline
@stsievert
stsievert / import_before_parallel_backend.py
Last active September 2, 2016 02:47
Stack trace for using joblib in dask.distributed.Executor.map
---------------------------------------------------------------------------
PicklingError Traceback (most recent call last)
<ipython-input-6-94dad265e0f3> in <module>()
17 # dask.distributed
18 b = e.map(repeated_tests, values)
---> 19 b = e.gather(b)
20 print(b)
/mnt/ws/home/ssievert/anaconda3/lib/python3.5/site-packages/distributed/executor.py in gather(self, futures, errors, maxsize)
@stsievert
stsievert / 2017-09-01.csv
Last active September 1, 2017 20:42
Growing batch size timing
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
,approx_grad,beta,chunks,d,max_iter,n,pointwise_loss,rel_error,seed,sigma,wall_time
0,True,"[-0.33772545 0.23013211 0.33314611 -0.20971334 -0.30575033 0.37405672
-0.0630507 0.18395188 0.12185236 -0.55615217]",2000,10,1,8000000,404087362.5696646,0.5786328175760411,0,7.0,9.872261762619019
1,True,"[-0.48261279 0.32924311 0.34738249 -0.15459457 -0.19415953 0.42306455
-0.17252527 0.05592582 0.15623894 -0.43401917]",2000,10,1,8000000,403110631.53552437,0.5542360022939973,1,7.0,7.958230018615723
2,True,"[-0.38672315 0.18469769 0.28169293 -0.05405629 -0.22192282 0.33552479
-0.11270603 0.00994565 0.1491486 -0.51029152]",2000,10,1,8000000,405328298.33456,0.6073403494210304,2,7.0,7.640789985656738
3,True,"[-0.38046754 0.23782463 0.18564596 -0.18898523 -0.20634251 0.38498398
-0.27994777 0.05463027 0.1997645 -0.4443485 ]",2000,10,1,8000000,405016186.76993334,0.6002291017741715,3,7.0,9.718455076217651
4,True,"[-0.50255132 0.36809792 0.30386753 -0.09045098 -0.10998031 0.2425631
@stsievert
stsievert / keybase.md
Created September 19, 2017 13:37
keybase.md

Keybase proof

I hereby claim:

  • I am stsievert on github.
  • I am stsievert (https://keybase.io/stsievert) on keybase.
  • I have a public key ASBfnKbfyf1tRg6utXGPlw-g_ZQ9otd2-3vDxvpprQ7xfAo

To claim this, I am signing this object:

@stsievert
stsievert / blur-image.ipynb
Created April 1, 2018 01:45
Blur image with box filter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stsievert
stsievert / Example.ipynb
Last active June 5, 2018 19:37
Hyperband example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.