Skip to content

Instantly share code, notes, and snippets.

@matlink
matlink / sum_under.sh
Created Feb 14, 2019
print SUM until threshold
View sum_under.sh
awk '{ if ($1<=1e7){SUM+=$3} else{print SUM; exit}}'
@matlink
matlink / default_value.py
Created Mar 12, 2018
Default value for missing value of python dict
View default_value.py
from collections import defaultdict as ddict
dic = ddict(lambda: '<my_default_value>')
@matlink
matlink / max_column.sh
Created Feb 17, 2018
print max of 2nd column
View max_column.sh
awk '{ if(max<$2) {max=$2} } END { print max }'
@matlink
matlink / hashcat_crackpos.sh
Created Feb 17, 2018
hashcat get cracking positions
View hashcat_crackpos.sh
hashcat -m99999 -o ${BASENAME}.hc.ranks --outfile-format=10 --potfile-disable --markov-hcstat=${BASENAME}.hcstat2 --session=${BASENAME} --increment -a3 -1?l?u?d ${BASENAME} ?1?1?1?1?1?1?1?1?1?1
@matlink
matlink / hashcat_markov.sh
Last active Feb 17, 2018
hashcat use markov stat
View hashcat_markov.sh
hashcat --markov-hcstat=${FILEBASE}.hcstat2 --session=${FILEBASE} --increment --stdout -a3 -1?l?u?d ?1?1?1?1?1?1?1?1?1?1
@matlink
matlink / runtime.txt
Created Feb 16, 2018
measure run time
View runtime.txt
#include <time.h>
clock_t begin = clock();
/* here, do your time-consuming job */
clock_t end = clock();
double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
@matlink
matlink / hcstat.sh
Created Feb 16, 2018
create hcstat2 file
View hcstat.sh
hcstat2gen < inputfile 2>/dev/null | xz --compress --format=raw --stdout -9e 2>/dev/null > output.hcstat2
@matlink
matlink / print_lower.sh
Last active Feb 16, 2018
print lines having 1st column lower than
View print_lower.sh
NUMBER=2880000000
awk '{ if ($1 < '"$NUMBER"') {print $0} }'
@matlink
matlink / sort.sh
Last active Feb 15, 2018
Sort by 3rd column, numerically
View sort.sh
sort -nk3,3
@matlink
matlink / ranks.sh
Created Feb 14, 2018
print rank of input words
View ranks.sh
awk '{ print NR, $0 }'
You can’t perform that action at this time.