Skip to content

Instantly share code, notes, and snippets.

@swayson
swayson / github-stars.py
Last active January 1, 2016 15:52
Grab metadata of starred github repos.
import pandas as pd
from github import Github
g = Github("username", "password")
final = ({'url':r.html_url , 'name': r.name} for r in g.get_user().get_starred())
pd.DataFrame(final).to_excel('Github Stars 20160101.xlsx')
@swayson
swayson / readme.md
Created January 16, 2016 13:12 — forked from baraldilorenzo/readme.md
VGG-19 pre-trained model for Keras

##VGG19 model for Keras

This is the Keras model of the 19-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman

# DEFINE ENVIRONMENT VARIABLES
apt-get update
apt-get upgrade -y
# INSTALL PACKAGES
apt-get install -y aria2
@swayson
swayson / readme.md
Created February 17, 2016 11:23 — forked from baraldilorenzo/readme.md
VGG-16 pre-trained model for Keras

##VGG16 model for Keras

This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman

@swayson
swayson / Python Docstring template.
Created February 17, 2016 13:59
?np.random.binomial
ONE_SENTENCE_DESCRIPTION
PARAGRAPH_DESCRIPTION
Parameters
----------
PARAM_NAME : DTYPE
DESCRIBE PARAMETER
...
Returns
-------
RETURN_NAME : DTYPE
@swayson
swayson / sqlite_random_sample.sql
Created February 17, 2016 19:57
Efficient way to do random sampling in SQLite.
SELECT * FROM table
WHERE _ROWID_ >= (abs(random()) % (SELECT max(_ROWID_) FROM table))
LIMIT 1
#!/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
# Phase 1 - Preparation:
Acquire data
Reformat and clean data
# Phase 2 - Analysis:
Edit analysis scripts
Execute analysis scripts
Inspect outputs
Debug
@swayson
swayson / datascience-project-flow.txt
Created February 27, 2016 17:39
Data Science Project Flow
# Phase 1 - Preparation:
Acquire data
Reformat and clean data
# Phase 2 - Analysis:
Edit analysis scripts
Execute analysis scripts
Inspect outputs
Debug
@swayson
swayson / logger.py
Created March 14, 2016 05:51
Python logging decorator and simple config.
import logging
def log_event(func):
"""
"""
def wrapper(*args, **kwargs):
# Code before function call
# <ADD IT HERE>