Skip to content

Instantly share code, notes, and snippets.

View poeli's full-sized avatar

Po-E Li poeli

  • Los Alamos National Laboratory
View GitHub Profile
# USAGE: jq -R -s -f sacct2json.jq
# objectify/1 takes an array of string values as inputs, converts
# numeric values to numbers, and packages the results into an object
# with keys specified by the "headers" array
def objectify(headers):
# For jq 1.4, replace the following line by: def tonumberq: .;
def tonumberq: tonumber? // .;
. as $in
| reduce range(0; headers|length) as $i ({}; .[headers[$i]] = ($in[$i] | tonumberq) );
sudo xcode-select -switch /Library/Developer/CommandLineTools/
@poeli
poeli / vim
Created March 20, 2020 19:40
DOS format to UNIX
:e ++ff=dos
:set ff=unix
conda install -c anaconda ipykernel
python -m ipykernel install --user --name=$1
python3 -m http.server $1
awk '{OFS="\t"; print ">"$1"\n"$10}'
@poeli
poeli / rmSeqFromFastaByPtnFile.sh
Created June 10, 2020 05:27
remove sequences from FASTA in pattern file
#!/usr/bin/bash
awk '{ if ((NR>1)&&($0~/^>/)) { printf("\n%s", $0); } else if (NR==1) { printf("%s", $0); } else { printf("\t%s", $0); } }' \
| grep -vwf $1 - \
| tr "\t" "\n"