This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
import os | |
from concurrent.futures import ThreadPoolExecutor | |
import pandas as pd | |
from tqdm import tqdm | |
def fetch_page(base_url): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import attr | |
import typing | |
from collections import defaultdict | |
@attr.s(auto_attribs=True) | |
class GFF3Record: | |
seq_id : str = "" | |
source : str = "" | |
type_ : str = "" | |
start : int = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Fetch pictures in Douban Album | |
via Douban API V2(https://douban-api-docs.zce.me/photo.html) | |
""" | |
import os | |
import sys | |
import json | |
from typing import Dict, List, Iterator, Tuple | |
import shutil | |
from concurrent.futures import ThreadPoolExecutor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
from typing import Iterable, Tuple, Optional, Union, Callable, TypeVar | |
from functools import partial | |
from contextlib import ContextDecorator | |
from tqdm.auto import tqdm | |
Bin = Tuple[str, int, int] | |
Bigwig = "pyBigWig.bigWigFile" | |
BinValue = Tuple[Bin, float] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing as t | |
from pathlib import Path | |
import fire | |
import mechanicalsoup | |
from bs4 import BeautifulSoup | |
from tqdm import tqdm | |
browser = mechanicalsoup.StatefulBrowser() | |
base_urls = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(GenomicRanges) | |
library(ggbio) | |
pairs.df <- read.table("D:/tmp/ggbio_demo/ZQL-49_final.txt",header=FALSE, sep="\t")[,1:7] | |
colnames(pairs.df) <- c("read", "chr1", "pos1", "chr2", "pos2", "strand1", "strand2") | |
chromsize.df <- read.csv("D:/tmp/ggbio_demo/susScr11_ASFV_noun.fa.csv") | |
chromsize.gr <- GRanges( | |
seqnames = chromsize.df$seqnames, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nd2reader import ND2Reader | |
import matplotlib.pyplot as plt | |
from pathlib import Path | |
import numpy as np | |
import scipy.ndimage as ndi | |
import skimage.filters as F | |
import skimage.morphology as M | |
import skimage.measure as Ms | |
import skimage.exposure as E | |
from skimage.morphology.selem import disk |