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 / drawing.svg
Created April 15, 2023 17:12
bjut logo
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
@leoleoasd
leoleoasd / pinyin-comp.zsh
Created January 7, 2021 04:56
zsh拼音自动补全
# use pinyin-comp to perform completion based upon pinyin acronym
function _pinyin_comp()
{
# chsdir print one candidate per line
# this looks weird, bug IFS='\n' does not work in interactive shell
local IFS=$'\n'
reply = ($(~/.oh-my-zsh/pinyin-test 0 $*))
echo reply
# reply=($(pinyin-comp 0 $*))
@leoleoasd
leoleoasd / DoublePendulum.py
Created December 28, 2020 07:27
DoublePendulum
start_time = 0
end_time = 60
from manimlib.imports import *
from manimlib import constants
from numpy import sin, cos
import numpy as np
import scipy.integrate as integrate
# Stolen from https://matplotlib.org/3.1.1/gallery/animation/double_pendulum_sgskip.html