Skip to content

Instantly share code, notes, and snippets.

View t-mart's full-sized avatar

Tim Martin t-mart

View GitHub Profile
# create a list of 2d indices of A in decreasing order by the size of the
# (real) entry of A that they index to
def sortedIndices(A):
indexList = [(i,j) for i in range(A.shape[0]) for j in range(A.shape[1])]
indexList.sort(key=lambda x: -A[x])
return np.array(indexList)
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
spec:
rules:
- http:
paths:
- path: /
backend:
@t-mart
t-mart / boomerang.zsh
Created October 14, 2018 01:49
Creates a "boomerang" movie clip.
#!/usr/bin/env zsh
set -ex
INPUT_FILE_PATH=${INPUT:a}
INPUT_DIR=${INPUT:a:h}
INPUT_EXT=${INPUT:e}
REVERSE_FILE_PATH="${INPUT_DIR}/reverse.${INPUT_EXT}"
FORWARD_FILE_PATH="${INPUT_DIR}/forward.${INPUT_EXT}"
@t-mart
t-mart / zsh.zsh
Created March 11, 2017 20:26
Function rename?
foo() {
echo "This is foo()"
}
bar=foo
bar
# --> zsh: command not found: bar
@t-mart
t-mart / xfce_terminalrc
Created January 17, 2015 11:01
terminal config for xfce's terminal (i.e. xubuntu) styled a la vim-hybrid (https://github.com/w0ng/vim-hybrid). put this in $HOME/.config/xfce4/terminal/terminalrc
[Configuration]
FontName=DejaVu Sans Mono 8
MiscAlwaysShowTabs=FALSE
MiscBell=FALSE
MiscBordersDefault=TRUE
MiscCursorBlinks=FALSE
MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
MiscDefaultGeometry=80x24
MiscInheritGeometry=FALSE
MiscMenubarDefault=TRUE
curl "https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py" | sudo python3.3
curl "https://raw.github.com/pypa/pip/master/contrib/get-pip.py" | sudo python3.3
sudo pip install virtualenv
@t-mart
t-mart / gist:5165953
Created March 14, 2013 22:52
good way to get time data
#!/bin/bash
#strace
# "-e trace=some_syscall" allows you to trace just the syscalls you want.
# lotta noise otherwise. comma separated list, but
# for our experiments, it'll prolly just be 1
# syscall
# "-T" give us time data
#
# "program arg0 arg1" is the program we want to trace. this'll likely be
from itertools import combinations
UP = [[0,0,1,0,1,1,
1,1,1,1,0,1],
[1,0,1,0,1,0,
0,1,1,0,1,1]]
DOWN = [[0,1,1,0,0,1,
1,1,1,1,0,1],
[1,0,1,0,1,0,
0,1,0,0,0,1]]
@t-mart
t-mart / pull-submodules-to-origin-master.pre-commit-hook.sh
Last active October 15, 2015 04:27
A script to pull submodules to their origin/master. Meant to be used as a git hook.
#!/bin/sh
#
# To enable this hook, place this file at:
# <repo-base-dir>/.git/hooks/pre-commit
printf "Updating submodules to origin master..." >&2
git submodule update --rebase --remote
STATUS=$?
if [ $STATUS -eq 0 ]; then
echo "done" >&2
@t-mart
t-mart / git_aliases.txt
Created October 15, 2012 22:55
My git aliases
Status
gst='git status'
gss='git status -s'
gstv='git status -v'
Remotes
gp='git push'
gl='git pull'
glom='git pull origin master'
ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'