Skip to content

Instantly share code, notes, and snippets.

@prehensilecode
prehensilecode / python_emacs.txt
Created May 4, 2022 23:56
Python modules for Emacs integration
python-lsp-server
importmagic
epc
pycodestyle
mccabe
pyflakes
pylint
rope
yapf
ipython
@prehensilecode
prehensilecode / calc.py
Created March 24, 2022 19:31
Sample numpy for git demo
#!/usr/bin/env python
import sys
import os
import numpy as np
text = [[4, 3, 8, 9, 5, 1, 2, 7, 6], [8, 3, 4, 1, 5, 9, 6, 7, 2],
[6, 1, 8, 7, 5, 3, 2, 9, 4], [6, 9, 8, 7, 5, 3, 2, 1, 4],
[6, 1, 8, 7, 5, 3, 2, 1, 4], [6, 1, 3, 2, 9, 4, 8, 7, 5]]
text = np.array(text)
@prehensilecode
prehensilecode / update_unpack_blastdbs.sh
Last active March 14, 2022 17:44
Updates and unpacks NCBI BLAST dbs
#!/bin/bash
module use /ifs/opt/modulefiles
module load python/gcc/3.9.1
module load ncbi-blast
### About the db sources:
### - ncbi provides .tar.gz files, which need to be extracted
### - gcp and aws provide all the db files directly
logfile=/var/log/blast.log
@prehensilecode
prehensilecode / crosh-font.css
Last active September 16, 2021 19:24
crosh font
@font-face {
font-family: 'Meslo LG';
src: url('https://github.com/powerline/fonts/raw/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
#!/usr/bin/env python3
import sys
import os
print('hello, world')
@prehensilecode
prehensilecode / munge_listserv_subcriber_report.py
Created April 6, 2021 13:30
Take a Listserv subscriber report and extract just full names and emails
#!/usr/bin/env python3
import sys
import os
import csv
import argparse
import pathlib
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--debug', action='store_true', help='Debug')
parser.add_argument('-i', '--infile', type=argparse.FileType('r'), help='CSV file from LISTSERV')
@prehensilecode
prehensilecode / ncbi_ngs_build_rhel8.md
Last active November 2, 2023 00:35
HOWTO Build NCBI NGS on RHEL 8
@prehensilecode
prehensilecode / change_categories_cm9.py
Created August 4, 2020 21:03
Programmatically update node categories in Bright Cluster Manager 9.0 using Python
#!/usr/bin/env python3
import sys
import os
from pythoncm.cluster import Cluster
from pythoncm.settings import Settings
from pythoncm.entity import *
debug_p = False
cluster = Cluster()
#!/usr/bin/env python3.6
import numpy as np
import tensorflow as tf
# Mash-up of:
# - https://stackoverflow.com/a/49497004
# - https://ml-with-tensorflow.info/2017/03/01/svm-with-tensorflow/
X = np.zeros([157, 128])
Y = np.zeros([157], dtype=np.int32)
@prehensilecode
prehensilecode / ge2openmpi.sh
Last active October 23, 2019 15:01
Convert Grid Engine PE_HOSTFILE to Open MPI hostfile
#!/bin/bash
awk '{print $1, "slots=" $2, "maxslots=" $2}' ${PE_HOSTFILE} > myhostfile.${JOB_ID}