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
alias ..="cd ../" | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
alias mvnT='mvn -T 4 -e package' | |
alias mvnNT='mvn -T 4 -DskipTests -e package' | |
alias mvnNTA='mvn -T 4 -Dmaven.test.skip=true -e package' | |
alias mvnTI='mvn -T 4 -e clean install' |
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
syntax on | |
set nu | |
set title | |
set titleold="" | |
set titlestring=VIM:\ %F | |
" Allow saving of files as sudo when I forgot to start vim using sudo. | |
cmap w!! w !sudo tee > /dev/null % |
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 | |
#brings you back home after sudo su | |
function get_owner { | |
pid=$1 | |
echo $(ps ouid -p $pid h | tr -d ' ') | |
} | |
pid=$$ | |
my_uid=$(get_owner $pid) |
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
public class ConcurrentIndexerTest { | |
@Test | |
public void testUniqueIndexes() throws InterruptedException, ExecutionException { | |
//would not work for ConcurrentHashMap unless you're extreamly lucky | |
Map<String, Integer> index = Collections.synchronizedMap(new HashMap<>()); | |
populateIndexer(index); | |
Collection<Integer> indexes = index.values(); | |
Set<Integer> uniqueIndexes = new HashSet<>(indexes); |
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 | |
#automated killing of maven debug plugin | |
#or anyone else if the port was specified | |
port=${1:-5005} | |
pid=`lsof -t -i :$port | tr -s ' ' | cut -d ' ' -f 2` | |
if [[ -z $pid ]]; then | |
echo "no one to kill 8'(" | |
else | |
echo "killing process listening on port $port \n`ps hp $pid`" |
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
for d in `find . -name target`; do find $d -type f; done | xargs rm |
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
$ for m in {32..33}; do for s in {00..59}; do echo "$m$s " `grep -c "$m$s" ~/input`; done; done > ~/out | |
$ gnuplot -p -e "set xdata time; set timefmt '%M%S'; set format x '%M:%S'; plot '~/out' using 1:2 with points" |
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
# usage: | |
# $ sudo apt-get install python-numpy | |
# $ python percentile.py 95 97 99 99.9 < my_file_with_floats | |
import numpy as np | |
import fileinput | |
import sys | |
lines = [] | |
for line in sys.stdin: |
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 | |
#turn tcp dump into a text file: | |
# receiving_time -> fix_msg_sending_time | |
tcpdump -A -r - | strings | sed 's/\.\([[:digit:]]\+=\)/|\1/g' | sed 's/\.*$//g' | sed 's/^[^|]*|/|/g' | grep 'length\|8=FIX' | grep -B 1 '35=X' | grep -v '^--$' | cut -d ' ' -f 1 | sed 's/.*52=\([^|]*\).*/-> \1/g' | paste - - |
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 | |
# packs python scripts to an executable, the first script must be the main script | |
# example: pyzip quotes find_quotes.py dx.py | |
name=$(basename "$0") | |
usage="$name name_of_executable main_script.py [other python scripts]" | |
executable=${1?usage} | |
main_script=${2?usage} | |
scripts=${@:3} |
OlderNewer