Skip to content

Instantly share code, notes, and snippets.

View chuangzhu's full-sized avatar
😅
GitHub IPv6 when

Chuang Zhu chuangzhu

😅
GitHub IPv6 when
View GitHub Profile
requests==2.28.1
pycryptodome==3.15.0
@chuangzhu
chuangzhu / caddy.sh
Last active February 6, 2023 10:45 — forked from Jamesits/caddy.sh
Install Caddy Server on Debian/Ubuntu with Systemd.
# 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 / phosh.patch
Created February 23, 2023 05:26
Set bottom bar the same height as status bar, move the clock to the right
diff --git a/src/home.h b/src/home.h
index a34b7155..7f6fb730 100644
--- a/src/home.h
+++ b/src/home.h
@@ -12,7 +12,7 @@
#define PHOSH_TYPE_HOME (phosh_home_get_type())
-#define PHOSH_HOME_BUTTON_HEIGHT 40
+#define PHOSH_HOME_BUTTON_HEIGHT 32
@chuangzhu
chuangzhu / dgutcourses2ics.py
Last active September 19, 2023 19:39
Convert DGUT courses table to iCalendar
#!/usr/bin/env python3
# SPDX-License-Identifier: AGPL-3.0
# Convert courses table from https://jw.dgut.edu.cn → 学生服务→ 网上选课→ 选课结果 to iCalendar
# Usage: copy the query result to a spreadsheet application, export it as CSV, then run:
# ./dgutcourses2ics.py 2023-09-04 < courses.csv > courses.ics
# ^ first monday of the semester
import csv
import sys
from datetime import datetime, date, time, timedelta
@chuangzhu
chuangzhu / mcmods.nix
Created January 7, 2024 20:51
A example for packaging Minecraft mods from Modrinth and Curseforge in Nix, with updaters, which I use personally with https://github.com/Ninlives/minecraft.nix
{ lib, fetchurl, writeShellScript, curl, jq, common-updater-scripts }:
let
fetchModrinth = { meta, passthru ? {}, ... } @ args: fetchurl args // {
meta = meta // {
position = let p = builtins.unsafeGetAttrPos "url" args; in "${p.file}:${toString p.line}";
};
passthru = passthru // {
updateScript = writeShellScript "update" ''
set -xeu -o pipefail