Skip to content

Instantly share code, notes, and snippets.

View crazyhottommy's full-sized avatar
🎯
Focusing

Ming Tang crazyhottommy

🎯
Focusing
View GitHub Profile
human mouse
A1BG A1bg
A1CF A1cf
A2LD1 A2ld1
A2M A2m
A4GALT A4galt
A4GNT A4gnt
AAAS Aaas
AACS Aacs
AADAC Aadac
@crazyhottommy
crazyhottommy / bkup_dotfiles_configs.md
Last active November 27, 2022 07:31 — forked from sbamin/bkup_dotfiles_configs.md
How to rsync dot files and directories of remote server

backup dotfiles

  • Following will copy all of dot ~/. files and directories (including its contents) directly underneath home directory.
  • To avoid copying cache and other local configs, e.g., that of web browser, java apps, etc., preferably query directory size tool under entire home $HOME/, using ncdu $HOME of similar tool.
  • Exclude all those large directories using rsync --exclude=.local --exclude=.cache format
  • Avoid rsync password, ssh keys, .bash_history, etc. if you are uploading to github, etc.
  • rsync home dotfiles and configs as follows:
# in your local machine
@crazyhottommy
crazyhottommy / data-ggplot-evolution-vol1.r
Created September 9, 2022 18:42 — forked from z3tt/data-ggplot-evolution-vol1.r
Data for the blog post "The Evolution of a ggplot (Vol. 1)"
library(tidyverse)
df_students <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-05-07/student_teacher_ratio.csv")
df_world_tile <- readr::read_csv("https://gist.githubusercontent.com/maartenzam/787498bbc07ae06b637447dbd430ea0a/raw/9a9dafafb44d8990f85243a9c7ca349acd3a0d07/worldtilegrid.csv") %>%
mutate(
## Namibias two-digit country code is handled as `NA` - let us fix that
alpha.2 = if_else(name == "Namibia", "NA", alpha.2),
## We are going to split "Americas" into "North America" and "Sout America"
region = if_else(region == "Americas", sub.region, region),
@crazyhottommy
crazyhottommy / example_modulefile.lua
Created September 15, 2021 15:41 — forked from sbamin/example_modulefile.lua
Advanced Modulefile using lua syntax
--[[
## Modulefile in lua syntax
## Author: Samir Amin
## Read about Lmod
## https://lmod.readthedocs.io/en/latest/015_writing_modules.html
## https://lmod.readthedocs.io/en/latest/050_lua_modulefiles.html
## https://lmod.readthedocs.io/en/latest/020_advanced.html
--]]
@crazyhottommy
crazyhottommy / auto-insert-python.el
Created August 25, 2020 14:47 — forked from michaelmhoffman/auto-insert-python.el
Template for Python scripts
(defun new-copyright ()
"Generate new copyright string."
(format-time-string "Copyright %Y Michael M. Hoffman <michael.hoffman@utoronto.ca>"))
(define-auto-insert 'python-mode
`(
"Description: "
"#!/usr/bin/env python3.6" \n
"\"\"\"" (setq basename (buffer-file-basename)) ": " str \n
"\"\"\"" \n \n
@crazyhottommy
crazyhottommy / merge_then_call_consensus.sh
Created July 17, 2020 20:09 — forked from taoliu/merge_then_call_consensus.sh
Merge multiple peak files (BED format) then call the consensus regions
#!/bin/bash
#
# This script will find the consensus peak regions from peak files (in
# BED format) of multiple samples by:
#
# 1. Converting the peak file of each sample into non-overlapping 3
# cols BED file and concatenating them;
#
# 2. Sorting the concatenated file and Building a genome coverage
# track in BedGraph, of which the value (the 3rd col) indicates the
@crazyhottommy
crazyhottommy / iterm2-solarized.md
Created March 26, 2020 04:16 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@crazyhottommy
crazyhottommy / Pkgdown deploy from Travis.md
Created February 13, 2020 18:38 — forked from gaborcsardi/Pkgdown deploy from Travis.md
Walkthrough: deploy a pkgdown site from Travis

Run usethis::use_pkgdown_travis()

usethis::use_pkgdown_travis()
✔ Setting active project to '/Users/gaborcsardi/works/ps'Adding 'docs/' to '.gitignore'Set up deploy keys by running `travis::use_travis_deploy()`Insert the following code in '.travis.yml'
  before_cache: Rscript -e 'remotes::install_cran("pkgdown")'
@crazyhottommy
crazyhottommy / BSdownload.md
Created August 23, 2019 03:51 — forked from lh3/BSdownload.md
Download files from Illumina's BaseSpace

References:

Steps:

  1. Follow steps 1-5 in the first link above to acquire access_token. This will take a while, but you only need to do this once. Never share this token!!
  2. Find the file you want to download. Copy the link, which looks something like: https://basespace.illumina.com/sample/9804795/files/tree/NA12878-L1_S1_L001_R1_001.fastq.gz?id=515013503. The "id" is the unique file identifier.
  3. Download the file with: wget -O filename 'https://api.basespace.illumina.com/v1pre3/files/{id}/content?access_token={token}', where {token} is from step 1 and {id} from step 2.
DATASETS = ["PBMC_8K", "PBMC_4k"]
SALMON = "$BINS/salmon-0.14.0_linux_x86_64/bin/salmon"
rule all:
input: expand("quants/{dataset}/alevin/quants_mat.gz", dataset=DATASETS)
rule salmon_quant:
input:
r1 = "reads/{sample}_1.fastq",