Skip to content

Instantly share code, notes, and snippets.

@tianqig
tianqig / Vagrantfile
Created July 28, 2017 13:11 — forked from bsweger/Vagrantfile
Vagrantfile to set up a Python virtual environment for data analysis
Vagrant::Config.run do |config|
config.vm.define :pythondata do |pythondata_config|
# Every Vagrant virtual environment requires a box to build off of.
pythondata_config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
pythondata_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
# Forward a port from the guest to the host, which allows for outside
@tianqig
tianqig / happy_git_on_osx.md
Created July 30, 2017 08:11 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@tianqig
tianqig / google-cl.sh
Created August 5, 2017 08:26 — forked from loopj/google-cl.sh
Install google command line tools on mac
#!/bin/bash
sudo pip install -Iv http://gdata-python-client.googlecode.com/files/gdata-2.0.14.tar.gz googlecl
@tianqig
tianqig / gcloud_commands
Created August 5, 2017 14:45 — forked from frntn/gcloud_commands
all gcloud commands
gcloud auth
gcloud auth activate-refresh-token
gcloud auth activate-service-account
gcloud auth git-helper
gcloud auth list
gcloud auth login
gcloud auth print-access-token
gcloud auth print-refresh-token
gcloud auth revoke
gcloud components
import sys
import os
import cv2
import numpy as np
import tensorflow as tf
sys.path.append("..")
from object_detection.utils import label_map_util
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@tianqig
tianqig / GitHub curl.sh
Created August 23, 2017 12:28 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@tianqig
tianqig / disable-warnings.py
Created August 24, 2017 13:08
turn off all warnings by creating this startup file: ~/.ipython/profile_default/startup/disable-warnings.py , from https://stackoverflow.com/users/180783/astrofrog
import warnings
warnings.filterwarnings('ignore')
@tianqig
tianqig / gifextract.py
Created September 2, 2017 14:03 — forked from BigglesZX/gifextract.py
Extract frames from an animated GIF, correctly handling palettes and frame update modes
import os
from PIL import Image
'''
I searched high and low for solutions to the "extract animated GIF frames in Python"
problem, and after much trial and error came up with the following solution based
on several partial examples around the web (mostly Stack Overflow).
There are two pitfalls that aren't often mentioned when dealing with animated GIFs -