Skip to content

Instantly share code, notes, and snippets.

Nils Werner nils-werner

Block or report user

Report or block nils-werner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nils-werner /
Last active Sep 11, 2018
Vectorized Koide's coincidence experiment
from scipy.constants import physical_constants as pc
import numpy
import scipy.stats
import scipy.linalg
def a():
def pnorm(v, p):
return sum([x**p for x in v])**(1/p)
nils-werner /
Last active Mar 2, 2018
Have I Been Pwned Password Checker
#!/usr/bin/env python
from __future__ import print_function
import sys
import getpass
import hashlib
import argparse
View output.txt
$ bash
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/me/sotest/virtenv3/bin/python3.6
Also creating executable in /Users/me/sotest/virtenv3/bin/python
Installing setuptools, pip, wheel...done.
Running virtualenv with interpreter /usr/local/bin/python2
New python executable in /Users/me/sotest/virtenv2/bin/python2.7
Also creating executable in /Users/me/sotest/virtenv2/bin/python
Installing setuptools, pip, wheel...done.
nils-werner /
Last active Jun 21, 2017
Tupper's self-referential formula
import numpy
import matplotlib.pyplot as plt
def tupper(x,y):
return 0.5 < ((y // 17) // (2**(17 * x + y % 17))) % 2
N = 4858450636189713423582095962494202044581400587983244549483093085061934704708809928450644769865524364849997247024915119110411605739177407856919754326571855442057210445735883681829823754139634338225199452191651284348332905131193199953502413758765239264874613394906870130562295813219481113685339535565290850023875092856892694555974281546386510730049106723058933586052544096664351265349363643957125565695936815184334857605266940161251266951421550539554519153785457525756590740540157929001765967965480064427829131488548259914721248506352686630476300
x, y = numpy.meshgrid(numpy.arange(107), numpy.arange(N, N + 17)[::-1])
def sliding_window(data, size, stepsize=1, padded=False, axis=-1, copy=True):
Calculate a sliding window over a signal
data : numpy array
The array to be slided over.
size : int
The sliding window size
nils-werner /
Last active Jan 4, 2018
Generate DotA 2 changelogs using LSTN DNN
'''Use this if you have a pre trained net and dont want to wait for a few hours'''
from __future__ import print_function
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.utils.data_utils import get_file
import numpy as np
import random
import sys
nils-werner /
Last active Dec 9, 2015
Matplotlib + PySoundCard
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from pysoundcard import Stream, continue_flag, complete_flag
number_of_blocks = 100
number_of_channels = 6
nils-werner /
Created Apr 22, 2015
Abbreviating stub pytest fixtures
@pytest.fixture(params=(True, False))
def odd(request):
return request.param
@pytest.fixture(params=(1, 2))
def channels(request):
return request.param
@pytest.fixture(params=(16000, 44100))
def samplerate(request):
#!/usr/bin/env bash
set -e
PYV=`python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";`
# Make sure we are on a recent version of PIP and have wheels
pip install --upgrade pip
pip install --upgrade setuptools
pip install --upgrade six
nils-werner / GitLab7.8.4
Last active Aug 29, 2015
GitLab webhook request
View GitLab7.8.4
{'connection': 'close',
'content-length': '1598',
'content-type': 'application/json',
'host': ''}
"before": "781f005120f77fbc69d1077d57b3b10ee792f232",
"after": "0bba8ee1bc7d3f5849b530ef6a4bdef1e97f8ecb",
"ref": "refs/heads/master",
You can’t perform that action at this time.