Skip to content

Instantly share code, notes, and snippets.

View zl190's full-sized avatar

Y.Lab3 zl190

View GitHub Profile
@zl190
zl190 / yield-curve-spread-10y3m.py
Created June 8, 2026 06:03
US yield-curve 10yr-3mo spread vs NBER recessions — D-screen artifact for [[note-us-treasury-debt]] §12 (fetch Treasury daily CSV + plot)
#!/usr/bin/env -S uv run --with matplotlib --python 3.12 python
"""
D-screen artifact for [[note-us-treasury-debt]] §12 (yield curve + inversion).
Self-contained & reproducible: fetchescomputesplots. The PNG is a
disposable output (gitignored binary); THIS SCRIPT is the durable artifact.
DATA SOURCE (provenance)
US TreasuryDaily Treasury Par Yield Curve Rates (authoritative; not FRED).
Endpoint (CSV, per calendar year, no API key):
@zl190
zl190 / aimd_vs_martingale.py
Created January 27, 2026 23:36
AIMD vs Martingale simulation - comparing TCP-style risk management with gambling strategy
#!/usr/bin/env python3
"""
Simulation comparing AIMD (TCP-style) vs Martingale gambling strategies.
"""
import random
from dataclasses import dataclass
from typing import List, Tuple
@dataclass
@zl190
zl190 / renaming_files.py
Created April 18, 2021 02:15
renaming_files.py
import os
from glob import glob
from tqdm import tqdm
dir_root = '/mnt/SSD_1/ge_noncancer'.replace('/', os.path.sep)
fn_lis = glob(os.path.join(dir_root, '**', '*.png'), recursive=True)
for fn in tqdm(fn_lis):
@zl190
zl190 / iou.py
Created March 29, 2021 16:45 — forked from doiken23/iou.py
IoU
def iou(boxes1, boxes2):
"""
Arguments:
boxes1 (numpy.array): [[x_min, y_min, x_max, y_max]] [N, 4]
boxes2 (numpy.array): [[x_min, y_min, x_max, y_max]] [M, 4]
Returns:
ious (numpy.array): 2D array shape of [N, M]
"""
N, M = len(boxes1), len(boxes2)
assert N > 0
@zl190
zl190 / fileOperation.py
Last active March 13, 2021 06:32
helper_funcs
#!/usr/bin/env python
import os, sys
import shutil
from glob import glob
def move_all_out(dir_root):
fn_lis = glob(os.path.join(dir_root, '*', '*'))
for fn in fn_lis:
# move out
@zl190
zl190 / pip_mirror.sh
Created July 9, 2020 10:29 — forked from schnell18/pip_mirror.sh
setup pip mirror in China
mkdir ~/.pip
cat <<EOF > ~/.pip/pip.conf
[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple
EOF
@zl190
zl190 / dataset_info.json
Created May 20, 2020 06:04
dataset_info of nih_chest_xray
{
name: "nih_chest_xray"
description: "ChestX-ray dataset comprises 112,120 frontal-view X-ray images of 30,805 unique patients with the text-mined fourteen disease image labels (where each image can have multi-labels), mined from the associated radiological reports using natural language processing. Fourteen common thoracic pathologies include Atelectasis, Consolidation, Infiltration, Pneumothorax, Edema, Emphysema, Fibrosis, Effusion, Pneumonia, Pleural_thickening, Cardiomegaly, Nodule, Mass and Hernia, which is an extension of the 8 common disease patterns listed in our CVPR2017 paper. Note that original radiology reports (associated with these chest x-ray studies) are not meant to be publicly shared for many reasons. The text-mined disease labels are expected to have accuracy >90%.Please find more details and benchmark performance of trained models based on 14 disease labels in our arxiv paper: 1705.02315"
citation: "@InProceedings{wang2017chestxray,author = {Wang, Xiaosong and Peng, Yifan and Lu, Le an
@zl190
zl190 / scratch.sh
Created April 13, 2020 20:41
install different version of python
mkdir ~/src
wget https://www.python.org/ftp/python/3.4.10/Python-3.4.10.tgz
tar -zxvf Python-3.4.10.tgz
cd Python-3.4.10
mkdir ~/.localpython
./configure --prefix=$HOME/.localpython
make
make install
@zl190
zl190 / oj_week3_p3_sol.py
Created April 13, 2020 07:20
强迫症老板和他的洗碗工
"""
强迫症老板和他的洗碗工10
题目内容
洗碗工小明碰上了一位强迫症老板老王餐厅一共就10只盘子
老板给仔细编上了09等10个号码并要求小明按照从0到9的编号来洗盘子
当然每洗好一只盘子就必须得整齐叠放起来
小明洗盘子期间经常就有顾客来取盘子当然每位顾客只能从盘子堆最上面取1只盘子离开
老王在收银台仔细地记录了顾客依次取到盘子的编号比如1043257689”,
这样他就能判断小明是不是遵照命令按照0123456789的次序来洗盘子了
你也能像老王一样作出准确的判断吗

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>