Skip to content

Instantly share code, notes, and snippets.

View kdoroschak's full-sized avatar

Katie Doroschak kdoroschak

View GitHub Profile
(py36) -bash-4.2$ rm -rf .git
(py36) -bash-4.2$ rm .gitattributes
(py36) -bash-4.2$ git init
Initialized empty Git repository in /disk1/pore_data/Porcupine-data/.git/
(py36) -bash-4.2$ git remote add origin git@github.com:uwmisl/Porcupine-data.git
(py36) -bash-4.2$ git add README.md; git commit -m "initial commit"
[master (root-commit) 4d255df] initial commit
1 file changed, 1 insertion(+)
create mode 100644 README.md
(py36) -bash-4.2$ git push -u --force origin master
@kdoroschak
kdoroschak / diverging_barplot
Last active June 15, 2019 21:10
Diverging barplot in python. Can flexibly include the center bar or not depending on how many categories you give it.
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
import matplotlib.patches as mpatches
sns.set(style="whitegrid", font_scale=1.8)
def diverging_stacked_bar(results, category_names=[], colors=[], symmetrical=False,
bar_width = 0.35):
if len(category_names) % 2 == 0: # even
print(len(category_names))
@kdoroschak
kdoroschak / progress_bar.py
Created October 24, 2017 03:03
Python 2.7 for loop progress bar
''' Python 2.7 progress bar
Code mostly taken from:
https://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console
I usually use this for simple for loops with long iterations to make sure it's
actually progressing without polluting stdout.
'''
import sys
@kdoroschak
kdoroschak / extract_misc.sh
Created October 17, 2017 20:07
Extract a submissions zip file downloaded from Canvas, and keep students' submissions separate.
#!/bin/bash
input=$1
if [[ $input == *.zip ]]; then
unzip -q -o -d "${input%.*}" "$input"
in_dir="${input%.*}"/*
else
in_dir=$input/*
fi
# pip install ont-fast5-api
from ont_fast5_api import fast5_file
import uuid
import numpy as np
f5_fname = "sample.fast5"
mode = "r+" # Supported modes: ['r', 'r+', 'w', 'w-', 'x'], same meanings as h5py http://docs.h5py.org/en/latest/high/file.html
f5 = fast5_file.Fast5File(fname=f5_fname, mode=mode)
@kdoroschak
kdoroschak / install_mosh_locally.sh
Last active August 27, 2017 19:22 — forked from lazywei/install_mosh_locally.sh
Install mosh server without root permission
#!/bin/sh
# this script does absolutely ZERO error checking. however, it worked
# for me on a RHEL 6.3 machine on 2012-08-08. clearly, the version numbers
# and/or URLs should be made variables. cheers, zmil...@cs.wisc.edu
install_dir=software/mosh
protobuf_version=3.4.0
mosh_version=1.3.2 # https://mosh.org/mosh-1.3.2.tar.gz
@kdoroschak
kdoroschak / rpi3b_ap_config.sh
Last active May 17, 2017 01:14
Configuration for a raspberry pi router / access point from a fresh raspbian flash. Uses the onboard rpi 3b wifi with no custom hostapd needed.
# Updates
sudo apt-get update
sudo apt-get -y dist-upgrade
# Install packages
sudo apt-get -y install vim hostapd dnsmasq
# Make my mouse poll properly
sudo vim /boot/cmdline.txt # add usbhid.mousepoll=0 to this file
# Updates
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo reboot
# Install packages
sudo apt-get -y install vim
# Make my mouse poll properly
sudo vim /boot/cmdline.txt # add usbhid.mousepoll=0 to this file