Skip to content

Instantly share code, notes, and snippets.

@yplam
yplam / OpencvTemplateScaleMatch.py
Created June 2, 2017 09:48
Opencv Template Matching with template scale
import numpy as np
import cv2
import imutils
template = cv2.imread('template.jpg') # template image
image_o = cv2.imread('image.jpg') # image
template = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY)
image = cv2.cvtColor(image_o, cv2.COLOR_BGR2GRAY)
@doctorpangloss
doctorpangloss / install_caffe.sh
Last active October 16, 2024 14:28
Installing Caffe on Mac 10.11.5 and later in the 10.11 series, and 10.12.1 and later in the 10.12 series
#!/bin/sh
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Apple hides old versions of stuff at https://developer.apple.com/download/more/
# Install the latest XCode (8.0).
# We used to install the XCode Command Line Tools 7.3 here, but that would just upset the most recent versions of brew.
# So we're going to install all our brew dependencies first, and then downgrade the tools. You can switch back after
# you have installed caffe.
# Install CUDA toolkit 8.0 release candidate
# Register and download from https://developer.nvidia.com/cuda-release-candidate-download
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@zl1zl
zl1zl / download.sh
Created May 4, 2016 02:07
download videos
#!/bin/bash
download="wget -c "
if type aria2c &>/dev/null; then
download="aria2c -x 5 -s 5"
echo "Using aria2c!!"
else
echo "Using ${download}"
fi
$download https://archive.org/download/cs231n-CNNs/CS231n%20Winter%202016%20-%20Lecture%2010%20-%20Recurrent%20Neural%20Networks%2c%20Image%20Captioning%2c%20LSTM-yCC09vCHzF8.mp4
@athoune
athoune / gist:01a739ed722257e613e1
Created November 10, 2014 20:14
Sending Luigi failure to Sentry
import os
import sys
import luigi
from raven import Client
client = Client()
# Define your Luigi tasks here
@luigi.Task.event_handler(luigi.Event.FAILURE)
@tamoyal
tamoyal / gist:10441108
Created April 11, 2014 04:39
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@neubig
neubig / crf.py
Created November 7, 2013 10:59
This is a script to train conditional random fields. It is written to minimize the number of lines of code, with no regard for efficiency.
#!/usr/bin/python
# crf.py (by Graham Neubig)
# This script trains conditional random fields (CRFs)
# stdin: A corpus of WORD_POS WORD_POS WORD_POS sentences
# stdout: Feature vectors for emission and transition properties
from collections import defaultdict
from math import log, exp
import sys
@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active May 20, 2025 07:59
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@gnarf
gnarf / ..git-pr.md
Last active June 18, 2025 12:07
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@westurner
westurner / setup_pandas_notebook.sh
Created July 29, 2012 07:53
Setup IPython Notebook and Pandas for OSX
#!/bin/sh
setup_brew () {
if ![-f "/usr/local/bin/brew"]; then
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
}
setup_ipython () {
brew install readline