Skip to content

Instantly share code, notes, and snippets.

View alienzj's full-sized avatar
🦀
MAGs lives matter

alienzj

🦀
MAGs lives matter
View GitHub Profile
@zarzen
zarzen / spacemacs-cpp.md
Last active January 23, 2024 13:06
C++ development environment setup in Spacemacs
@pthom
pthom / CLion_Ninja.md
Last active December 21, 2020 07:50 — forked from nevkontakte/CLion_Ninja.md
Ninja support for CLion IDE

Ninja support for CLion IDE

This script enables Ninja-powered builds in CLion IDE by wrapping around CMake, which it uses. See my blog post for details.

Disclaimer

This script is provided AS IS with no guarantees given or responsibilities taken by the author. This script relies on undocumented features of CLion IDE and may lead to instability of build and/or IDE. Use it on your own risk under WTFPL terms.

@ryerh
ryerh / tmux-cheatsheet.markdown
Last active June 28, 2025 06:14 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@slowkow
slowkow / counts_to_tpm.R
Last active June 24, 2025 14:00
Convert read counts to transcripts per million (TPM).
#' Convert counts to transcripts per million (TPM).
#'
#' Convert a numeric matrix of features (rows) and conditions (columns) with
#' raw feature counts to transcripts per million.
#'
#' Lior Pachter. Models for transcript quantification from RNA-Seq.
#' arXiv:1104.3889v2
#'
#' Wagner, et al. Measurement of mRNA abundance using RNA-seq data:
#' RPKM measure is inconsistent among samples. Theory Biosci. 24 July 2012.

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@iamalbert
iamalbert / cjk.tex
Created December 15, 2015 07:12
XeLaTex 中文
\usepackage{fontspec} %加這個就可以設定字體
\usepackage{xeCJK} %讓中英文字體分開設置
\setCJKmainfont{微軟正黑體} %設定中文為系統上的字型,而英文不去更動,使用原TeX字型
\XeTeXlinebreaklocale "zh" %這兩行一定要加,中文才能自動換行
\XeTeXlinebreakskip = 0pt plus 1pt %這兩行一定要加,中文才能自動換行
\defaultCJKfontfeatures{AutoFakeBold=6,AutoFakeSlant=.4} %以後不用再設定粗斜
\newCJKfontfamily\Kai{標楷體} %定義指令\Kai則切換成標楷體
\newCJKfontfamily\Hei{微軟正黑體} %定義指令\Hei則切換成正黑體
\newCJKfontfamily\NewMing{新細明體} %定義指令\NewMing則切換成新細明體
@marcelm
marcelm / bambai
Created December 8, 2015 13:20
Index a BAM file while sorting it
#!/bin/bash
set -euo pipefail
if [ $# -ne 1 -o x$1 == x-h -o x$1 == x--help ]; then
echo \
"Usage:
samtools sort -O bam -T prefix ... | bambai BAMPATH
Read a sorted BAM file from standard input, write it to BAMPATH and
index it at the same time (creating BAMPATH.bai)."
@gregcaporaso
gregcaporaso / notes.md
Last active June 23, 2022 15:57
vsearch-based sequence dereplication through generation of a biom table

This depends on biom version >= 2.1.5, < 2.2.0 and vsearch >= 1.7.0.

Please note that all of this is highly experimental. I'm keeping these notes as I work with this approach. For published work, I still recommend using standard pipelines, such as those in QIIME 1.9.1.

$ biom --version
biom, version 2.1.5

$ vsearch --version
vsearch v1.7.0_osx_x86_64, 16.0GB RAM, 8 cores
@marcelm
marcelm / mismatches.py
Created September 16, 2015 09:06
Use pysam and pyfaidx to find mismatches in an interval
from pysam import AlignmentFile
from pyfaidx import Fasta
def has_mismatch_in_interval(reference, bamfile, chrom, start, end):
"""
Return whether there is a mismatch in the interval (start, end) in any read mapping to the given chromosome.
reference -- a pyfaidx.Fasta object or something that behaves similarly
"""
for column in bamfile.pileup(chrom, start, end):
@marcelm
marcelm / snakemake-pure-python.py
Last active November 29, 2023 00:45
pure Python module that uses snakemake to construct and run a workflow
#!/usr/bin/env python3
"""
Running this script is (intended to be) equivalent to running the following Snakefile:
include: "pipeline.conf" # Should be an empty file
shell.prefix("set -euo pipefail;")
rule all:
input: