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
export TIME='TIME Command being timed: "%C" | |
TIME User time (seconds): %U | |
TIME System time (seconds): %S | |
TIME Elapsed (wall clock) time : %e | |
TIME Percent of CPU this job got: %P | |
TIME Average shared text size (kbytes): %X | |
TIME Average unshared data size (kbytes): %D | |
TIME Average stack size (kbytes): %p | |
TIME Average total size (kbytes): %K | |
TIME Maximum resident set size (kbytes): %M |
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
#!/bin/bash | |
# Add to instance metadata with `gcloud compute instances add-metadata \ | |
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot | |
# NOTE: requires `bc`, eg, sudo apt-get install bc | |
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage | |
threshold=0.1 | |
count=0 | |
wait_minutes=60 | |
while true |
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
# Info on how to get your api key (kaggle.json) here: https://github.com/Kaggle/kaggle-api#api-credentials | |
!pip install kaggle | |
api_token = {"username":"USERNAME","key":"API_KEY"} | |
import json | |
import zipfile | |
import os | |
with open('/content/.kaggle/kaggle.json', 'w') as file: | |
json.dump(api_token, file) | |
!chmod 600 /content/.kaggle/kaggle.json | |
!kaggle config path -p /content |
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 | |
import tensorflow as tf | |
__author__ = "Sangwoong Yoon" | |
def np_to_tfrecords(X, Y, file_path_prefix, verbose=True): | |
""" | |
Converts a Numpy array (or two Numpy arrays) into a tfrecord file. | |
For supervised learning, feed training inputs to X and training labels to Y. | |
For unsupervised learning, only feed training inputs to X, and feed None to Y. |
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
''' | |
Implementation of Fastfood (Le, Sarlos, and Smola, ICML 2013). | |
Primarily by @esc (Valentin Haenel) and felixmaximilian | |
from https://github.com/scikit-learn/scikit-learn/pull/3665. | |
Modified by @dougalsutherland. | |
FHT implementation was "inspired by" https://github.com/nbarbey/fht. | |
''' |
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
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
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 | |
import struct | |
import numpy as np | |
""" | |
MNist loading helper for Python 2.7. | |
For Python 3.x, see https://gist.github.com/akesling/42393ccb868125071fdea77d98a0d2f0 | |
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py |