This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import numpy as np | |
def centered(arr, newshape): | |
# Return the center newshape portion of the array. | |
newshape = np.asarray(newshape) | |
currshape = np.array(arr.shape) | |
startind = (currshape - newshape) // 2 | |
endind = startind + newshape | |
myslice = [slice(startind[k], endind[k]) for k in range(len(endind))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def n_IPS(lam): | |
# Cauchy equation | |
A, B, C = 1.4915, 4.8486e3, 1.3694e8 | |
return A + B / lam**2 + C / lam**4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Screen settings | |
wget https://gist.githubusercontent.com/npyoung/4d44b0700d743231ab82396be3ff242c/raw/36ad6447b43f3ca927cdb0a80b268ddbfc914ce5/.screenrc | |
# Get NVIDIA drivers | |
echo "Getting NVIDIA drivers" | |
wget http://us.download.nvidia.com/titan/linux/387.34/nvidia-driver-local-repo-ubuntu1604-387.34_1.0-1_amd64.deb && | |
sudo dpkg -i nvidia-driver-local-repo-ubuntu1604-387.34_1.0-1_amd64.deb && | |
sudo apt-key add /var/nvidia-driver-local-repo-387.34/7fa2af80.pub && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Detach instead of dying if we disconnect | |
autodetach on | |
# Don't waste my time | |
startup_message off | |
# Keep scroll up history | |
defscrollback 30000 | |
termcapinfo xterm* ti@:te@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import PyCapture2 | |
from sys import exit | |
if __name__ == '__main__': | |
# Ensure sufficient cameras are found | |
bus = PyCapture2.BusManager() | |
camInfos = bus.discoverGigECameras() | |
if not len(camInfos): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Garmin | |
LABEL="GARMIN" /media/noah/GARMIN vfat noauto,sudo 0 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pst(x, triggers, window, axis=-1): | |
"""Extract windows along an axis centered around a list of indices. | |
Args: | |
x: Array from which windows should be extracted. | |
triggers: Indices in signal where the extracted sequences should be aligned to. | |
window: (before, after) tuple specifying the number of samples around | |
the trigger to extract. | |
axis: Axis along which to compute the PSTH. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ y ] = butterfilter( x, cut, fs, type ) | |
%BUTTEFILTER Apply a Butterworth filter | |
nyq = fs / 2; | |
cutf = cut / nyq; | |
if nargin == 4 | |
[b, a] = butter(5, cutf, type); | |
elseif nargin == 3 | |
[b, a] = butter(5, cutf); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import base64, getpass, hashlib, argparse, pyperclip | |
ENCODING = 'utf-8' | |
def get_pass(domain, key): | |
bits = (domain + '/' + key).encode(ENCODING) | |
for i in range(2 ** 16): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def label_subplots(axes): | |
import string | |
for idx, ax in enumerate(axes): | |
ax.text(-0.1, 1.05, string.ascii_uppercase[idx], transform=ax.transAxes, | |
size=20, weight='bold') |