This file contains 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 | |
# In honor of the remarkable Windson | |
#/bin/bash | |
namespace=$1 | |
if [[ -z "$namespace" ]]; then | |
echo "Use "$(basename "$0")" NAMESPACE"; | |
exit 1; | |
fi |
This file contains 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
# Pass the env-vars to MYCOMMAND | |
eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
# … or ... | |
# Export the vars in .env into your shell: | |
export $(egrep -v '^#' .env | xargs) |
This file contains 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
B A S H C H E A T S H E E T | |
to page output forward (only): command filename | more | |
to page output forward & back: command filename | less | |
to print a dataset: lp datasetname (-d printerid) (-o landscape) | |
USE OF QUOTATION MARKS | |
echo "$varname" = echo The value of \$varname is \"$varname\" | |
= echo "The value of \$varname is \"$varname\"." | |
$fred='Four spaces between these words.' |
This file contains 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
import random | |
def merge_sort(xs): | |
"""Inplace merge sort of array without recursive. The basic idea | |
is to avoid the recursive call while using iterative solution. | |
The algorithm first merge chunk of length of 2, then merge chunks | |
of length 4, then 8, 16, .... , until 2^k where 2^k is large than | |
the length of the array | |
""" | |
This file contains 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
.PHONY: using-gcc using-gcc-static using-clang | |
using-gcc: | |
g++-4.8 -o main-gcc -lasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \ | |
ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc | |
using-gcc-static: | |
g++-4.8 -o main-gcc-static -static-libstdc++ -static-libasan -O -g -fsanitize=address -fno-omit-frame-pointer main.cpp && \ | |
ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) ./main-gcc-static |
This file contains 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
import numpy as np | |
def gs_cofficient(v1, v2): | |
return np.dot(v2, v1) / np.dot(v1, v1) | |
def multiply(cofficient, v): | |
return map((lambda x : x * cofficient), v) | |
def proj(v1, v2): | |
return multiply(gs_cofficient(v1, v2) , v1) |