This file contains hidden or 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 typing import Any, Iterable | |
| from operator import add, sub, mul, truediv, neg | |
| op_func: dict[str, Any] = {"+": add, "-": sub, "*": mul, "/": truediv, "**": pow, "--": neg} | |
| op_param: dict[str, int] = {"+": 2, "-": 2, "*": 2, "/": 2, "**": 2, "--": 1} | |
| priority: dict[str, int] = {"+": 0, "-": 0, "*": 2, "/": 2, "**": 5, "--": 4} | |
| op_set = ["**", "*", "+", "-", "/", "(", ")"] | |
| num_set = "0123456789." | |
This file contains hidden or 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 alpine | |
| WORKDIR /usr/local/bin | |
| # samtools | |
| ENV samtools_version 1.16.1 | |
| RUN apk add g++ make ncurses-dev zlib-dev xz-dev bzip2-dev curl-dev | |
| RUN wget https://github.com/samtools/samtools/releases/download/${samtools_version}/samtools-${samtools_version}.tar.bz2 && \ | |
| tar -xjf samtools-${samtools_version}.tar.bz2 && \ | |
| cd samtools-${samtools_version}/ && \ | |
| ./configure && \ |
This file contains hidden or 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 docker.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 | |
| RUN apt update -y && apt install -y python3-pip | |
| RUN pip install tensorflow torch torchvision tqdm pillow |
This file contains hidden or 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 time | |
| while True: | |
| print(f"{time.ctime():30s}", end="") | |
| print("\b" * 30, end="", flush=True) | |
| time.sleep(10) |
This file contains hidden or 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 {File} from 'fetch-blob/file.js' | |
| import {Blob} from 'buffer' | |
| import {default: Busboy} from 'busboy' | |
| async function readForm(req) { | |
| // My implementation is similar to | |
| // https://github.com/cloudflare/miniflare/blob/master/packages/core/src/standards/http.ts#L302 | |
| const data = {} | |
| await new Promise( (resolve) => { |
This file contains hidden or 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
| """ | |
| Airflow Example: Build a dynamic read-mapping DAG for multiple samples | |
| Author: linnil1 | |
| Run bowtie2(read-maper) on two samples to a reference fasta | |
| 1. Prepare data like this | |
| ``` | |
| $ ls /home/linnil1/airflow/data/ |
This file contains hidden or 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
| # Replacing all UID, GID in directorary | |
| # Requirement: python3.6 | |
| # Usage: python3 replace_uidgid.py old_etc_passwd old_etc_group new_etc_passwd new_etc_group /home --dry-run -vv | |
| # Author: linnil1 | |
| import os | |
| import argparse | |
| from collections import defaultdict | |
| import pathlib | |
This file contains hidden or 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
| # Example of running aiohttp and aiocron together | |
| # | |
| # Packages: aiohttp==3.8.1 aiocron==1.8 | |
| # Tested python version: python:3.10.0 | |
| # Issue: aircron not working once aiohttp start | |
| # Solution Concept: Both share the same event loop | |
| import logging | |
| import asyncio | |
| import aiocron | |
| from aiohttp import web |
This file contains hidden or 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 csv | |
| import os | |
| import shutil | |
| def hash_id(id): | |
| # input 12 | |
| # output 000/dataset_12.dat | |
| s = str(id) | |
| l = len(s) |
This file contains hidden or 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 asyncio | |
| import hmac | |
| import json | |
| from aiohttp import web | |
| # custom import | |
| from datetime import datetime | |
| from pprint import pprint | |