Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View anthonycarminati's full-sized avatar

Anthony Carminati anthonycarminati

View GitHub Profile
#!/usr/bin/env bash
# Basic setup
touch README.md .gitignore
# Project specific controller files
touch application.py config.py manage.py requirements.txt
# Application folders and files
mkdir app
@anthonycarminati
anthonycarminati / Example Data Analysis - Classification.ipynb
Last active June 20, 2017 14:48
An iPython notebook that shows off the process of creating dummy data and performing classification.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anthonycarminati
anthonycarminati / connect.py
Created December 9, 2016 16:47
psycopg2_with_ssh_tunneling
import psycopg2
from sshtunnel import SSHTunnelForwarder
try:
with SSHTunnelForwarder(
('<server ip address>', 22),
#ssh_private_key="</path/to/private/ssh/key>",
### in my case, I used a password instead of a private key
ssh_username="<server username>",
@anthonycarminati
anthonycarminati / linux_process_killer
Created September 20, 2016 14:14
Kill a process running on a specific port
lsof -i :<place_port_here> |awk '{print $2}'|sort -u |grep -v PID |xargs kill
@anthonycarminati
anthonycarminati / terminal_customization
Last active February 23, 2017 04:15
Add this script to .bash_profile on mac or .bashrc on linux to color code the various blocks.
########################################
## TERMINAL CUSTOMIZATION
########################################
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREENBOLD="\[\033[1;32m\]"
@anthonycarminati
anthonycarminati / recursively_remove_files
Created February 10, 2016 19:59
This script recursively removes all files from your current root and sub-directories. By changing the '*.pyc' block you can specify which files will be removed.
find . -type f -name '*.pyc' -delete
@anthonycarminati
anthonycarminati / create_labels
Last active February 4, 2016 23:09
Creates issue labels for a Github repo.
###
# Label definitions
###
declare -A LABELS
# Platform
LABELS["platform:ruby"]="BFD4F2"
LABELS["platform:sql"]="BFD4F2"
LABELS["platform:python"]="BFD4F2"
@anthonycarminati
anthonycarminati / apply_gitignore
Last active February 1, 2016 16:38
This code applies the logic defined in a .gitignore file, even after files have been committed to a repository. Note: this does not delete files locally, it only removes them from version control.
git rm --cached `git ls-files -i -X .gitignore`