Skip to content

Instantly share code, notes, and snippets.

View Yixf-Self's full-sized avatar

Yi Xianfu Yixf-Self

View GitHub Profile
#!/usr/bin/python
"""
%prog [options] pair_1.fastq pair_2.fastq
filter reads from paired fastq so that no unmatching reads remain.
output files are pair_1.fastq.trim and pair_2.fastq.trim
see: http://hackmap.blogspot.com/2010/09/filtering-paired-end-reads-high.html
"""
from subprocess import Popen, PIPE
import sys
@Yixf-Self
Yixf-Self / clock.R
Created July 9, 2016 00:41 — forked from drewconway/clock.R
Generate an animated clock in R with ggplot2
# Generate digitial clock face
first.nine <- c('00', '01', '02', '03', '04', '05', '06', '07', '08', '09')
hours <- c(first.nine, as.character(seq(10,23,1)))
mins <- c(first.nine, as.character(seq(10,59,1)))
time.chars.l <- lapply(hours, function(h) paste(h, ':', mins, sep=''))
time.chars <- do.call(c, time.chars.l)
# Generate analog clock face
hour.pos <- seq(0, 12, 12/(12*60))[1:720]
min.pos <-seq(0,12, 12/60)[1:60]
@Yixf-Self
Yixf-Self / automation.md
Created June 27, 2016 06:36 — forked from cube-drone/automation.md
Automation For The People

Automation for the People

Long ago, the first time I read "The Pragmatic Programmer", I read some advice that really stuck with me.

"Don't Use Manual Procedures".

This in the chapter on Ubiquitous Automation. To summarize, they want you to automate all the things.

The trouble was that I hadn't much of an idea how to actually go

@Yixf-Self
Yixf-Self / gist:b6f3f8c0f6f404672d16f668ede9a947
Created May 4, 2016 04:43 — forked from allex/gist:11203573
Ubuntu 安装中文字体

环境 (Environment)

版本:Ubuntu 14.04 LTS 默认语言:English(United States)

安装 (Setup)

Debian 和 Ubuntu 下对中文支持比较好的字体有: fonts-droid、ttf-wqy-zenhei 和 ttf-wqy-microhei 等,除了文泉驿系列字体外,比较流行的免费中文字体还有文鼎提供的楷体和上海宋,包名分别是: fonts-arphic-ukai 和 fonts-arphic-uming。

@Yixf-Self
Yixf-Self / notifyosd.zsh
Created October 20, 2015 07:47 — forked from ihashacks/notifyosd.zsh
pseudo undistract-me implementation in zsh Original undistract-me: http://mumak.net/undistract-me/
# commands to ignore
cmdignore=(htop tmux top vim)
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
retval=$?
if [[ ${cmdignore[(r)$cmd_basename]} == $cmd_basename ]]; then
return
else
if [ ! -z "$cmd" ]; then
@Yixf-Self
Yixf-Self / notifyosd.zsh
Created October 20, 2015 07:40 — forked from vlad-shatskyi/notifyosd.zsh
Displays a notification when a command, that takes over 10 seconds to execute, finishes and only if the current window isn't the terminal. Add to your .zshrc: [ -e path/to/notifyosd.zsh ] && . path/to/notifyosd.zsh
function active-window-id {
echo `xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}'`
}
# end and compare timer, notify-send if needed
function notifyosd-precmd() {
if [ ! -z "$cmd" ]; then
cmd_end=`date +%s`
((cmd_time=$cmd_end - $cmd_start))
fi
@Yixf-Self
Yixf-Self / tmux.cheat
Last active August 29, 2015 14:26 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@Yixf-Self
Yixf-Self / tmux-ref.md
Last active August 29, 2015 14:26 — forked from ursooperduper/tmux-ref.md
tmux reference

tmux Reference

Creating Sessions

Command Description
tmux new-session Create new session without a name. (Alt: tmux or tmux new)
tmux new -s development Creates new session called "development."
tmux new -s development -n editor Create new session called "development" and a first window called "editor."
tmux attach -t development Attaches to a session called "development."
@Yixf-Self
Yixf-Self / itan.R
Last active August 29, 2015 14:24 — forked from even4void/itan.R
itan <- function(x, keys=NULL, digits=3, no.resp=4) {
# x is an n subjects by k items matrix
# keys is a vector with the correct keys (A, B, C, D)
stopifnot(ncol(x)>1)
if (is.null(keys)) keys <- rep("A", ncol(x))
require(ltm)
raw.resp <- matrix(nr=ncol(x), nc=no.resp)
colnames(raw.resp) <- LETTERS[1:no.resp]
for (i in 1:ncol(x)) {
tmp <- table(x[,i])
Mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}