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
| from base64 import b64encode | |
| from subprocess import check_call | |
| from subprocess import check_output | |
| from tempfile import mkdtemp | |
| def lambda_handler(_event, _context): | |
| tmp = mkdtemp(dir='/tmp') | |
| check_call(['pip', 'install', 'psycopg2', '--target', tmp]) | |
| tar = check_output(['tar', '-C', tmp, '-cz', '.']) |
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
| #!/bin/bash | |
| fibs=(1 1) | |
| while ((fibs[-1] < 200)) | |
| do | |
| echo ${fibs[@]} | |
| fibn=$((fibs[-1] + fibs[-2])) | |
| fibs+=($fibn) | |
| done |
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 consecutive(cond, axis): | |
| cond = np.moveaxis(cond, axis, -1) | |
| measure = np.zeros(cond.shape[:-1], dtype=np.uint32) | |
| diff = np.diff(cond) | |
| for index in np.ndindex(measure.shape): | |
| boundary = np.flatnonzero(diff[index]) | |
| if not len(boundary): | |
| continue | |
| if cond[index][0]: | |
| boundary = np.insert(boundary, 0, -1) |
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 matplotlib.pyplot as plt | |
| import numpy as np | |
| import statsmodels.formula.api as smf | |
| x = np.linspace(0, 2, 100) | |
| y = np.sqrt(x) * np.sin(2 * np.pi * x) + np.random.random_sample(100) |
NewerOlder