a helpful primer for users sick of git's poorly-named commands
I've used Git since 2011, and this is the stuff that I've always had to Google to remember. I hope it helps you not hate Git so much.
tell application "Google Chrome" | |
set tab_list to every tab in the front window | |
repeat with the_tab in tab_list | |
set the_url to the URL of the_tab | |
tell application "Safari" to open location the_url | |
end repeat | |
end tell |
This gist details the following:
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
# Call virtualenvwrapper's "workon" if .venv exists. This is modified from-- | |
# http://justinlilly.com/python/virtualenv_wrapper_helper.html | |
# which is linked from-- | |
# http://virtualenvwrapper.readthedocs.org/en/latest/tips.html#automatically-run-workon-when-entering-a-directory | |
check_virtualenv() { | |
if [ -e .venv ]; then | |
env=`cat .venv` | |
if [ "$env" != "${VIRTUAL_ENV##*/}" ]; then | |
echo "Found .venv in directory. Calling: workon ${env}" | |
workon $env |
""" | |
Helper module for displaying ROOT canvases in ipython notebooks | |
Usage example: | |
# Save this file as rootnotes.py to your working directory. | |
import rootnotes | |
c1 = rootnotes.default_canvas() | |
fun1 = TF1( 'fun1', 'abs(sin(x)/x)', 0, 10) | |
c1.SetGridx() |
import json | |
from pprint import pprint as pp | |
import numpy as np | |
from numba import autojit, typeof, int32 | |
INF = float('inf') | |
@autojit | |
def jenks_matrics_init(data, n_classes, ): |
import json | |
from pprint import pprint as pp | |
def jenks_matrices_init(data, n_classes): | |
#fill the matrices with data+1 arrays of n_classes 0s | |
lower_class_limits = [] | |
variance_combinations = [] | |
for i in xrange(0, len(data)+1): | |
temp1 = [] | |
temp2 = [] |
import subprocess | |
import select | |
from logging import DEBUG, ERROR | |
def call(popenargs, logger, stdout_log_level=DEBUG, stderr_log_level=ERROR, **kwargs): | |
""" | |
Variant of subprocess.call that accepts a logger instead of stdout/stderr, | |
and logs stdout messages via logger.debug and stderr messages via | |
logger.error. |