This file contains 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
files = [path/to/file, path/to/file2, path/to/file3] | |
with zipfile.ZipFile('/tmp/test.zip', 'w', zipfile.ZIP_DEFLATED) as out_file: | |
for rel_filename in files: | |
absname = os.path.abspath(rel_filename) | |
root = os.path.dirname(absname) | |
filename = os.path.relpath(rel_filename, root) | |
out_file.write(rel_filename, filename) | |
print(absname, root, filename) |
This file contains 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 | |
from numpy.lib.stride_tricks import as_strided | |
def rolling_block(A, block=(3, 3)): | |
shape = (A.shape[0] - block[0] + 1, A.shape[1] - block[1] + 1) + block | |
strides = (A.strides[0], A.strides[1]) + A.strides | |
return as_strided(A, shape=shape, strides=strides) | |
X = np.random.randint(0, 200, (10, 10)) |
This file contains 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
WHERE XX defines the priority. -19 being highest priority. 19 being the lowest. | |
sudo renice -n [XX] [PID] | |
nice -n [XX] [COMMAND] |
This file contains 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 os | |
os.path.dirname(os.path.realpath(__file__)) |
This file contains 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
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import glob | |
import numpy as np | |
try: | |
import ujson as json | |
except ImportError: | |
import json |
This file contains 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
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import glob | |
try: | |
import ujson as json | |
except ImportError: | |
import ujson as json | |
import argparse |
This file contains 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 logging | |
def log_event(func): | |
""" | |
""" | |
def wrapper(*args, **kwargs): | |
# Code before function call | |
# <ADD IT HERE> |
This file contains 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
# Phase 1 - Preparation: | |
Acquire data | |
Reformat and clean data | |
# Phase 2 - Analysis: | |
Edit analysis scripts | |
Execute analysis scripts | |
Inspect outputs | |
Debug |
This file contains 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
# Phase 1 - Preparation: | |
Acquire data | |
Reformat and clean data | |
# Phase 2 - Analysis: | |
Edit analysis scripts | |
Execute analysis scripts | |
Inspect outputs | |
Debug |
This file contains 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 | |
#Code adapted from https://gist.github.com/yangj1e/3641843c758201ebbc6c (Modified to Python3.5) | |
cd ~ | |
#wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.0-Linux-x86_64.sh | |
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda3-2.4.1-Linux-x86_64.sh | |
bash Anaconda3-2.4.1-Linux-x86_64.sh -b | |
echo 'PATH="/home/ubuntu/anaconda3/bin:$PATH"' >> .bashrc | |
. .bashrc |