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
/* | |
To compile: | |
$ g++ gradient_adder.cpp -lm -lopencv_core -lopencv_highgui -lopencv_imgproc -o gradient_adder | |
To run: | |
$ ./gradient_adder non_grad_image.png | |
This will take a black and white input image and seperately apply opposite up/down | |
gradients to the white and the black portions | |
*/ |
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
#!/usr/bin/env python | |
# This script will take a jpg or png image, pixelate it, and convert those "pixels" to NES colors | |
# NES colors are the 54 colors available in the original Nintendo color palette | |
# | |
# To calculate which color to lock to, the LAB color space is used which is | |
# better than RGB for calculating the "distance" between two colors | |
# | |
# Still, the distance metric could use some work. Some colors choices are puzzling. | |
# It is a TODO |
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
#!/usr/bin/env python | |
# This script will pixelate most jpg and png images | |
# It will both show you the result and save it | |
import sys | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import PIL.Image as Image |
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
#!/usr/bin/env python | |
# Do some cursory checks before pushing the branch to `origin <branch_name>` | |
# Checks that no debuggers, TODOs, or print statements are in the branch diff before pushing | |
# Also checks that there are no saved but uncommitted files in git status | |
import subprocess | |
import sys | |
def execute(cmd): |
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
#!/usr/bin/env python | |
# Set a note on the current git branch using command line arguments | |
# Usage: note this branch is broken | |
import sys | |
import subprocess | |
import json | |
if __name__ == '__main__': |
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
#!/bin/bash | |
# Usage: memprof PID# | |
# Continuously poll the memory usage of a process | |
top -l 0 -s 1 -pid $1 -stats VSIZE | awk 'NR%13==0; fflush(stdout)' | ts |
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
#!/usr/bin/env python | |
# Loads the json contents of the clipboard as a python datastructure called jobj | |
import sys | |
import json | |
from IPython import embed | |
if __name__ == "__main__": | |
f_name = sys.argv[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
#!/usr/bin/env python | |
# Open a IPython REPL using the arguments as libraries to be imported via `import *`. | |
# Also imports a few stdlib libraries | |
# For example: | |
# $ i lib/lib_to_be_imported.py | |
# does | |
# from lib.lib_to_be_imported import * | |
# before the REPL starts |
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
#!/usr/bin/env python | |
# Loads json into a python datastructure from a url | |
# Usage: curljson http://example.com/json_endpoint | |
# Then the datastructure is accessible via jobj | |
import json | |
import sys | |
from IPython import embed | |
from subprocess import Popen, PIPE |
NewerOlder