Skip to content

Instantly share code, notes, and snippets.

@mkweskin
mkweskin / gist:5414303
Last active June 28, 2024 14:39
Convert markdown to mediawiki with pandoc
pandoc -f markdown -t mediawiki test.md -o test.wiki
# Thanks to @tillmanj for the updated formatting
@mkweskin
mkweskin / gist:5484040
Created April 29, 2013 19:25
Convert markdown to docx
pandoc -w docx file.md -o file.docx
@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
@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: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 / 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:9214338
Created February 25, 2014 18:03
Git clone with no cert check
env GIT_SSL_NO_VERIFY=true git clone https://...
@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 / 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