Skip to content

Instantly share code, notes, and snippets.

@mkweskin
mkweskin / gist:2b1a1daad1cc68707e77fe3f6a2729c5
Created September 7, 2018 18:58
Ping an ip every 5 seconds and log output. ping options work on Mac, not sure about other OS's
while [ 1 ]; do date; ping -o -q -t 3 x.x.x.x >/dev/null && echo PASS || echo FAIL; sleep 5; done >~/pinglog
@mkweskin
mkweskin / conda-orffinder.sh
Created September 6, 2017 14:33
Use conda's libgcc for NCBI's ORFfinder
#Create new env with conda libgcc
conda create -n ORFfinder -c anaconda libgcc
source activate ORFfinder
#Setup scripts to set LD_LIBRARY_PATH
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
mkdir -p $CONDA_PREFIX/etc/conda/deactivate.d
cat <<EOF >$CONDA_PREFIX/etc/conda/activate.d/LD_PATH.sh
export LD_LIBRARY_PATH_CONDA_BACKUP=$LD_LIBRARY_PATH
@mkweskin
mkweskin / rmssh
Created May 2, 2017 13:21
Removes a line from ~/.ssh/known_hosts. Takes a number as an argument or prompts for number. (written for sed version of macOS, YMMV)
#!/bin/bash
if [ -n "$1" ] #If input arg is non-empty then move on, but if it is prompt for number
then
LINE="$1"
else
echo "Enter line to delete of ~/.ssh/known_hosts:"
read LINE
fi
@mkweskin
mkweskin / avgQseq
Created April 6, 2017 19:00
Gives the average Q value for each sequence in a fastq
#!/usr/bin/env python
import numpy as np
from Bio import SeqIO
for record in SeqIO.parse("test_R1.fq", "fastq"):
print ('{}\t{}'.format(record.id, np.mean(record.letter_annotations["phred_quality"])))
@mkweskin
mkweskin / avgQseq
Created April 6, 2017 19:00
Gives the average Q value for each sequence in a fastq
#!/usr/bin/env python
import numpy as np
from Bio import SeqIO
for record in SeqIO.parse("test_R1.fq", "fastq"):
print ('{}\t{}'.format(record.id, np.mean(record.letter_annotations["phred_quality"])))
@mkweskin
mkweskin / gist:9214338
Created February 25, 2014 18:03
Git clone with no cert check
env GIT_SSL_NO_VERIFY=true git clone https://...
@mkweskin
mkweskin / keep-longest.py
Last active March 15, 2019 14:10
Keep longest sequence when there are duplicate descriptions in FASTA file: Reads a FASTA file and if >1 sequence has the same description line, it only keeps the longest sequence. It outputs all the sequencs to stdout when complete.
#!/usr/bin/python
"""
Reads a FASTA file and if >1 sequence has the same description line,
it only keeps the longest sequence. It outputs all the sequencs to stdout
when complete.
"""
@mkweskin
mkweskin / gist:5831102
Created June 21, 2013 13:25
Mount the volume named "Time Machine" from the terminal (Mac)
diskutil mount `diskutil list | grep "Time Machine" | awk {'print $7'}`
@mkweskin
mkweskin / gist:5542669
Created May 8, 2013 18:50
MacOS utility to enable/disable root access (don't call with sudo, the program authenticates for you)
dsenableroot
@mkweskin
mkweskin / gist:5495586
Last active December 16, 2015 20:49
Basic symbolic link: first is source, second is link name
ln -s SATe-2.2.7 SATe