Skip to content

Instantly share code, notes, and snippets.

View leoleoasd's full-sized avatar
🥰
slackin'

Yuxuan Lu leoleoasd

🥰
slackin'
View GitHub Profile
@leoleoasd
leoleoasd / fileops.py
Created March 1, 2026 05:41
NCCL Broadcast/Gather file
"""
nccl_file_ops.py
Broadcast files/directories across Ray actors using torch.distributed + NCCL.
Supports async pipelined chunked transfers to overlap disk I/O with network.
Usage:
import ray
from nccl_file_ops import broadcast_files
@leoleoasd
leoleoasd / fetch_all_reviews.py
Created January 12, 2026 00:46
Fetch all of your own openreview reviews (including private)
import openreview
def get_base_urls(client):
baseurl_v1 = "http://localhost:3000"
baseurl_v2 = "http://localhost:3001"
if "https://devapi" in client.baseurl:
baseurl_v1 = "https://devapi.openreview.net"
baseurl_v2 = "https://devapi2.openreview.net"
if "https://api" in client.baseurl:
@leoleoasd
leoleoasd / drawing.svg
Created April 15, 2023 17:12
bjut logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leoleoasd
leoleoasd / wandb_bug_reproduce.py
Last active March 20, 2022 05:40
wandb_bug_reproduce.py
import wandb
import torch.multiprocessing as mp
wandb.init(project="test", entity="leoleoasd", group="123")
def train(group):
wandb.init(project="test", entity="leoleoasd", group=group)
wandb.log({
'loss': 1
})
@leoleoasd
leoleoasd / psql.sty
Last active November 30, 2021 06:45
Run psql and capture it's output from LaTeX.
\ProvidesPackage{psql}
\RequirePackage{minted}
\RequirePackage{fancyvrb}
\RequirePackage{tcolorbox}
\def\run{\FV@Environment{}{run}}
\def\FVB@run{%
\@bsphack
\begingroup
\FV@UseKeyValues
\FV@DefineWhiteSpace
@leoleoasd
leoleoasd / bjut_network.py
Created October 24, 2021 13:13
bjut_network.py
#!/usr/bin/env python3
import os
import json
import sys
import argparse
import requests
import re
from os.path import expanduser
def main():
@leoleoasd
leoleoasd / user-data.yml
Created September 5, 2021 13:21
My user-data for autoinstall ubuntu server.
#cloud-config
autoinstall:
apt:
geoip: true
preserve_sources_list: false
primary:
- arches: [amd64, i386]
uri: http://mirrors.tuna.tsinghua.edu.cn/ubuntu
- arches: [default]
uri: http://ports.ubuntu.com/ubuntu-ports
@leoleoasd
leoleoasd / main.js
Created June 15, 2021 13:50
学习通题目批量导出
for(let i of $("div.TiMu").toArray()){
question = i.querySelector("p").innerText;
answers = Array.from(i.querySelectorAll("li")).map(v => v.innerText.replace("\n\n", ""));
correct = i.querySelector(".Py_answer span").innerText;
q.push({question, answers, correct})
}
@leoleoasd
leoleoasd / gpg2qrcodes.sh
Created February 15, 2021 17:13 — forked from joostrijneveld/gpg2qrcodes.sh
Producing printable QR codes for persistent storage of GPG private keys
# Heavily depends on:
# libqrencode (fukuchi.org/works/qrencode/)
# paperkey (jabberwocky.com/software/paperkey/)
# zbar (zbar.sourceforge.net)
# Producing the QR codes:
# Split over 4 codes to ensure the data per image is not too large.
gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp
split temp -n 4 IMG
for f in IMG*; do cat $f | qrencode -o $f.png; done
@leoleoasd
leoleoasd / zfjw.js
Created January 7, 2021 05:15
北工大正方教务导出 ics 课表
// ==UserScript==
// @name 新版正方教务系统导出课程表
// @namespace http://tampermonkey.net/
// @version 4.0
// @description 通过对新版正方教务系统的课表页面的解析,实现导出一个适用于大部分ics日历的文件
// @author 31415926535x
// @modified_by leoleoasd
// @compatible chrome
// @compatible firefox
// @license MIT