Skip to content

Instantly share code, notes, and snippets.

@Nanguage
Nanguage / chatroom.py
Created May 15, 2019 09:02
A simple chat room.
#!/usr/bin/env python
"""
A simple chat room.
https://codeburst.io/building-your-first-chat-application-using-flask-in-7-minutes-f98de4adfa5d
$ pip install flask flask-socketio
$ python chatroom.py
Servies run on http://127.0.0.1:5000
@Nanguage
Nanguage / cuda_9.0_cudnn_7.0.sh
Created August 20, 2018 07:37 — forked from ashokpant/cuda_9.0_cudnn_7.0.sh
Install CUDA Toolkit v9.0 and cuDNN v7.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v9.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb)
CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb"
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda-9-0
@Nanguage
Nanguage / add_subtitles.py
Last active August 20, 2018 04:07
Add subtitles to videos use ffmpeg
"""
Add subtitles to video.
Subtitles files should be in same directory with videos,
and with same file name.
usage:
$ python add_subtitles.py INPUT_DIR OUTPUT_DIR
"""
@Nanguage
Nanguage / extract_urls.py
Created August 19, 2018 14:04
Use you-get download youtube playlist
"""
Extract the urls from YouTube playlist page html file.
usage:
$ python extract_urls.py PLAYLIST.html OUTPUT.txt
"""
import re
import sys
#!/usr/bin/python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@Nanguage
Nanguage / tabs2spaces.py
Last active July 17, 2018 03:41 — forked from amoilanen/tabs2spaces.py
Python script to replace tabs with spaces recursively for all files matching a specified file mask regex, the number of spaces if configurable
USAGE = '''
Usage example:
python tabs2spaces.py . 4 ".*\.py$"
'''
import io
import argparse
import os
@Nanguage
Nanguage / install-ffmpeg.sh
Last active July 7, 2018 06:25 — forked from sparrc/install-ffmpeg.sh
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding (tested on Ubuntu 16.04)
#!/usr/bin/env bash
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few
# other common libraries
# binary will be at ~/bin/ffmpeg
sudo apt update && sudo apt upgrade -y
mkdir -p ~/ffmpeg_sources ~/bin
export PATH="$HOME/bin:$PATH"
"""
提取 S1 壁纸战页面中的壁纸链接并下载
https://bbs.saraba1st.com/2b/thread-1579059-1-1.html
"""
import os
import pathlib
import re
import urllib3
@Nanguage
Nanguage / call_variance.sh
Created August 24, 2017 01:51
call variance with picard, GATK and samtools
#!/bin/bash
# call variance with picard, GATK and samtools
reference=$1
sample=$2
# path to software
PICARD="/path/to/picard.jar" # broadinstitute-picard-2.9.2-6-gbb529af
SAMTOOLS="/path/to/samtools" # samtools 1.2
@Nanguage
Nanguage / deseq2-analysis-template.R
Created August 21, 2017 13:42 — forked from stephenturner/deseq2-analysis-template.R
Template for analysis with DESeq2
## RNA-seq analysis with DESeq2
## Stephen Turner, @genetics_blog
# RNA-seq data from GSE52202
# http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=gse52202. All patients with
# ALS, 4 with C9 expansion ("exp"), 4 controls without expansion ("ctl")
# Import & pre-process ----------------------------------------------------
# Import data from featureCounts