Skip to content

Instantly share code, notes, and snippets.

View sunziping2016's full-sized avatar
๐Ÿ‘

Ziping Sun sunziping2016

๐Ÿ‘
View GitHub Profile
@sunziping2016
sunziping2016 / .zshrc
Last active October 29, 2024 17:13
Forward Windows GnuPG to WSL2
SSH_AUTH_SOCK="/run/user/$(id -u)/gnupg/S.gpg-agent.ssh"
export SSH_AUTH_SOCK
# There may be concurrency conflicts during WSL startup.
# Let's wrap program luanching with locks.
flock -n -o ~/.local/state/zshrc.init.lock -c ~/.zshrc.init || true
@sunziping2016
sunziping2016 / index.js
Last active April 3, 2024 03:31
Kubenetes remote command client (i.e., kubectl exec) implementation with Node.js and WebSocket
// npm install ws
const WebSocket = require("ws");
const KUBERNETES_HOST = "127.0.0.1:443";
const KUBERNETES_NAMESPACE = "default";
const KUBERNETES_TOKEN = "CHANGEME";
const pod = "changeme";
if (!process.stdin.isTTY && !process.stdout.isTTY) {
console.error("not tty");
#!/usr/bin/env python3
import regex as re
from glob import iglob
def main():
pattern = re.compile(r'([\p{ishan}]+)', re.unicode)
total = 0
for filename in sorted(iglob('data/chap*.tex')):
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from datetime import datetime
import os
from wsgiref.handlers import format_date_time
from time import mktime
import hashlib
import base64
import hmac