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
| $ brew install fish | |
| $ echo "/usr/local/bin/fish" | sudo tee -a /etc/shells | |
| $ chsh -s `which fish` |
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
| # download: remote -> local | |
| scp user@remote_host:remote_file local_file | |
| # upload: local -> remote | |
| scp local_file user@remote_host:remote_file |
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
| # This script is designed to work with ubuntu 16.04 LTS | |
| # with keras 1.2.2 and the latest Pytorch with CUDA 8 support | |
| ########################################################################## | |
| #This is used to install CUDA 8 driver for Tesla K80 | |
| ########################################################################## | |
| #!/bin/bash | |
| echo "Checking for CUDA and installing." | |
| # Check for CUDA and try to install. | |
| if ! dpkg-query -W cuda-8-0; then |
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
| # For Windows users# Note: <> denotes changes to be made | |
| #Create a conda environment | |
| conda create --name <environment-name> python=<version:2.7/3.5> | |
| #To create a requirements.txt file: | |
| conda list #Gives you list of packages used for the environment | |
| conda list -e > requirements.txt #Save all the info about packages to your folder |
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 sys | |
| !conda install --yes --prefix={sys.prefix} numpy |
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 folium | |
| def plot_heatmap(data): | |
| ''' | |
| Args: | |
| takes a list of lists [[lat, long]] | |
| Returns: | |
| Folium map object with heatmap overlay | |
| ''' | |
| heatmap = folium.Map(tiles="CartoDBpositron", prefer_canvas=True) |
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 os | |
| with open('../data/labels.csv','r') as labels: | |
| lines = [line.split(',') for line in labels.readlines()][1:] | |
| for line in lines: | |
| image = line[0] | |
| label = line[1].split('/')[-1].replace('\n','') | |
| if not os.path.exists('../data/train/'+label): | |
| os.mkdir('../data/train/'+label) | |
| os.rename('../data/train/'+image+'.jpg', '../data/train/'+label+'/'+image+'.jpg') |
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 google.cloud import storage | |
| def list_blobs(bucket, prefix): | |
| """ | |
| Lists all the blobs in the bucket | |
| make sure prefix ends with '/' | |
| """ | |
| storage_client = storage.Client() | |
| bucket = storage_client.get_bucket(bucket) | |
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 convert_to_datetime(df, columns): | |
| return df[columns].apply(pd.to_datetime, axis=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
| from pdf2image import convert_from_path | |
| image = convert_from_path("path_to_pdf.pdf") |