Skip to content

Instantly share code, notes, and snippets.

View shenwei356's full-sized avatar
🎯
Focusing

Wei Shen shenwei356

🎯
Focusing
View GitHub Profile
@shenwei356
shenwei356 / doc.md
Last active April 3, 2017 08:46
Effect of random seed on results of 'seqkit sample'
@shenwei356
shenwei356 / howto.md
Last active October 31, 2019 14:35 — forked from killercup/pandoc.css
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)

pandoc -f markdown -t html -c pandoc.css -s -o report.html

#!/bin/sh
# Test data
#
# Retrieve 1M reads from any Illumina reads
#
# seqkit head -n 1000000 xxxx_1.fq.gz -o test.fq.gz
#
# Or
#
@shenwei356
shenwei356 / add-timestamp-for-media-file.sh
Last active September 27, 2023 02:59
Adding create time to image/video files
#!/bin/sh
while read file; do
if [[ $string =~ .*=.* ]]; then
continue
fi
t=$(exiftool "$file" \
| grep "^Create Date" | head -n 1 \
| sed -r "s/\s+/ /g" | cut -d " " -f 4 \
@shenwei356
shenwei356 / test.go
Created July 4, 2018 16:41
inverse-bloom-filter
package main
import (
"compress/gzip"
"fmt"
"os"
"strconv"
boom "github.com/tylertreat/BoomFilters"
)
  8            .          .           TEXT ·__mm_add_epi32(SB),0,$0 
  9        640ms      640ms               VMOVDQU x+0(FP), Y0 
 10        5.62s      5.62s               VMOVDQU y+32(FP), Y1 
 11        4.81s      4.81s               VPADDD  Y1, Y0, Y0 
 12        1.16s      1.16s               VMOVDQU Y0, q+64(FP) 
 13        1.30s      1.30s               VZEROUPPER 

14 . . RET

@shenwei356
shenwei356 / benchmark-encoding.md
Last active August 13, 2022 17:36
k-mer encoding and decoding

Functions:

# encoding: ACTG

def nuc2int_nochecking(b):
    return (ord(b) >> 1) & 3, True
    
def nuc2int_if(b):
    if b == 'a' or b == 'c' or b == 'g' or b == 't' \

or b == 'A' or b == 'C' or b == 'G' or b == 'T':