Skip to content

Instantly share code, notes, and snippets.

Avatar

Chuang Zhu chuangzhu

View GitHub Profile
@chuangzhu
chuangzhu / spectrogram_to_audio.ipynb
Created Oct 30, 2021
ustclug-hackergame-2021-write-up
View spectrogram_to_audio.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pipe2tg
#!/usr/bin/env python3
import os
import requests
confpath = '.config/pipe2tg' if os.path.exists('.config/pipe2tg') else '/etc/pipe2tg'
if len(os.sys.argv) > 1:
confpath = os.sys.argv[1]
config = open(confpath).readlines()
View yqfk.py
#!/usr/bin/env python3
import re
import os
import requests
import urllib
CAS_URL = 'https://cas.dgut.edu.cn/home/Oauth/getToken/appid/yqfkdaka/state/%2Fhome.html'
YQFK_URL = 'https://yqfk-daka.dgut.edu.cn'
API_URL = 'https://yqfk-daka-api.dgut.edu.cn'
@chuangzhu
chuangzhu / 114514.py
Last active Nov 8, 2020
ustclug-hackergame-2020-write-up
View 114514.py
inner_op = ['', '+', '-', '*', '//', '%', '^', '&', '|',
'*-', '//-', '%-', '+~', '-~', '+~-', '*~', '%~',
'^-', '&-', '|-', '//~', '^~', '&~', '|~',
'+(', '-(', '*(', '%(', '^(', '&(', '|(', ')',
# '+((', '-((', '*((', '//((', '%((', '^((', '&((', '|((', '))',
')+(', ')-(', ')*(', ')//(', ')%(', ')^(', ')&(', ')|(']
# leading_op = ['', '-', '~', '-(', '-((', '~(', '~((', '(', '((']
leading_op = ['', '-', '~', '-(', '~(', '(']
# trailing_op = ['', ')', '))']
trailing_op = ['', ')']
@chuangzhu
chuangzhu / gemoji.dict.yaml
Last active Apr 27, 2020
GitHub emoji dict for RIME
View gemoji.dict.yaml
---
name: gemoji
version: "2020.4.28"
sort: by_weight
use_preset_vocabulary: true
...
😀 ugrinning
😃 usmiley
@chuangzhu
chuangzhu / breeze-dark.css
Last active Oct 18, 2020
Breeze dark theme for Standard Notes (desktop only). https://listed.to/p/ZuCytDdDW8
View breeze-dark.css
:root {
--background-1: #31363b;
--background-2: #232629;
--foreground-color: #eff0f1;
--border-color: #616569;
--highlight-color: #3daee9;
--highlight-contrast: #3daee9;
--sn-stylekit-info-color: #3daee9;
--sn-stylekit-info-contrast-color: #cccccc;
--sn-stylekit-neutral-color: #3daee9;
@chuangzhu
chuangzhu / Makefile
Created Jun 19, 2019
Programming AVR on Linux
View Makefile
MCU = atmega32
F_CPU = 16000000
PROGRAMMER = -c usbasp
AVRDUDE = avrdude $(PROGRAMMER) -p $(MCU)
CC = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) -mmcu=$(MCU)
.PHONY: hex flash clean
@chuangzhu
chuangzhu / caddy.sh
Last active Mar 10, 2020 — forked from Jamesits/caddy.sh
Install Caddy Server on Debian/Ubuntu with Systemd.
View caddy.sh
# Should work on all Debian based distros with systemd; tested on Ubuntu 16.04+.
# This will by default install all plugins; you can customize this behavior on line 6. Selecting too many plugins can cause issues when downloading.
# Run as root (or sudo before every line) please. Note this is not designed to be run automatically; I recommend executing this line by line.
apt install curl
curl https://getcaddy.com | bash -s personal dns,docker,dyndns,hook.service,http.authz,http.awses,http.awslambda,http.cache,http.cgi,http.cors,http.datadog,http.expires,http.filemanager,http.filter,http.forwardproxy,http.geoip,http.git,http.gopkg,http.grpc,http.hugo,http.ipfilter,http.jekyll,http.jwt,http.locale,http.login,http.mailout,http.minify,http.nobots,http.prometheus,http.proxyprotocol,http.ratelimit,http.realip,http.reauth,http.restic,http.upload,http.webdav,net,tls.dns.auroradns,tls.dns.azure,tls.dns.cloudflare,tls.dns.cloudxns,tls.dns.digitalocean,tls.dns.dnsimple,tls.dns.dnsmadeeasy,tls.dns.dnspod,tls.dns.dyn,tls.
@chuangzhu
chuangzhu / tree.sh
Last active Jun 20, 2019
`tree` util implemented in pure bash
View tree.sh
#!/bin/bash
# all files (include dirs) under a dir
_allunder() {
local f; for f in $1/* $1/.*; do
case $f in
"$1/*" | "$1/.*" | "$1/." | "$1/..") ;;
*) printf "$f " ;;
esac
done
@chuangzhu
chuangzhu / color.sh.py
Created Aug 28, 2018
Shell color cheatsheet.
View color.sh.py
#!/usr/bin/python
from __future__ import print_function
print()
for i in range(0, 10):
print(i, end=' ')
print('\033[{}m'.format(i), end='')
print('AaBbCcDdEeFfGg', end='')
print('\033[0m')
print()