Skip to content

Instantly share code, notes, and snippets.

View AllanChain's full-sized avatar
💭
I may be slow to respond.

Allan Chain AllanChain

💭
I may be slow to respond.
View GitHub Profile
@AllanChain
AllanChain / PKUAutoClick.user.js
Last active February 24, 2024 08:47
PKU Auto Click
// ==UserScript==
// @name PKU Auto Click
// @namespace https://gist.github.com/AllanChain/c0782061f9e9836e2807a81acfe3b254
// @version 3.5
// @description 自动点击 PKU IAAA,教学网和邮箱的登录键,首次使用需手动点击一次以使插件记录密码。
// @icon https://www.pku.edu.cn/favicon.ico
// @author Allan Chain
// @copyright 2020 - 2024, Allan Chain
// @homepageURL https://gist.github.com/AllanChain/c0782061f9e9836e2807a81acfe3b254
// @supportURL https://gist.github.com/AllanChain/c0782061f9e9836e2807a81acfe3b254
@AllanChain
AllanChain / logseq-live-math.json
Last active January 3, 2024 07:51
My Logseq Live Math plugin settings
{
"triggerSettings": null,
"dollarTrigger": false,
"selectEdit": false,
"selectModifier": "Shift",
"formatSettings": null,
"preferDisplay": false,
"preferMultiline": true,
"smartFormat": true,
"mathliveSettings": null,
@AllanChain
AllanChain / pimg.py
Created October 26, 2023 08:08
Pin image on desktop after spectacle screenshot. Works on Wayland.
#!/usr/bin/python3
import sys
import subprocess
from PySide6 import QtCore, QtWidgets, QtGui
class MyWidget(QtWidgets.QLabel):
def __init__(self):
super().__init__()
@AllanChain
AllanChain / netease_music_dl.py
Created June 29, 2021 03:37
网易云音乐歌单下载,保留 ID3 属性
from bs4 import BeautifulSoup
from pathlib import Path
from dataclasses import dataclass
import urllib.request
import re
from unicodedata import normalize
from mutagen.mp3 import EasyMP3
DOWNLOAD_TEMPLATE = "http://music.163.com/song/media/outer/url?id=%s.mp3"
@AllanChain
AllanChain / _scancel.zsh
Last active October 13, 2023 13:30
Custom ZSH completion for Slurm's `scancel`
# Learn from https://mrigank11.github.io/2018/03/zsh-auto-completion/
function _scancel {
_describe 'command' "($(squeue -h -o '%i:%T-%j' -u $USER))"
}
compdef _scancel scancel
@AllanChain
AllanChain / tailwind.sty
Last active October 9, 2023 13:36
Tailwind color palette for LaTeX
%
% Copyright (c) Tailwind Labs, Inc.
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
@AllanChain
AllanChain / lunafast.py
Created June 12, 2023 13:31
自然快手辅助码转移
zrmfast = {}
for line in open('./zrmfast.dict.yaml'):
if not '\t' in line or not '[' in line:
continue
char, code, *_ = line.strip().split('\t')
zrmfast[char] = code.split('[')[1]
lines = []
for line in open('/usr/share/rime-data/luna_pinyin.dict.yaml'):
if not '\t' in line:
@AllanChain
AllanChain / start-if-charging.sh
Created December 28, 2022 00:38
Start programs if laptop is charging
#!/bin/bash
bat_status=$(cat /sys/class/power_supply/BAT1/status)
if [[ $bat_status != "Discharging" ]]; then
# More programs before Wayland tray is reday
sleep 30 # wait for Wayland tray
/usr/bin/safeeyes &
# More...
fi
@AllanChain
AllanChain / .tmux.conf.local
Last active November 18, 2022 13:09
Custom tmux config based on oh-my-tmux
# : << EOF
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
tmux_conf_24b_colour=auto
# default theme
tmux_conf_theme_colour_1="#2e3440" # dark gray
tmux_conf_theme_colour_2="#3b4252" # gray
@AllanChain
AllanChain / .tmux.conf
Created October 25, 2022 02:49
oh my tmux nord theme.
tmux_conf_theme_colour_1="#2e3440" # dark gray
tmux_conf_theme_colour_2="#3b4252" # gray
tmux_conf_theme_colour_3="#4c566a" # light gray
tmux_conf_theme_colour_4="#5e81ac" # light blue
tmux_conf_theme_colour_5="#ebcb8b" # yellow
tmux_conf_theme_colour_6="#2e3440" # dark gray
tmux_conf_theme_colour_7="#e5e9f0" # white
tmux_conf_theme_colour_8="#2e3440" # dark gray
tmux_conf_theme_colour_9="#ebcb8b" # yellow
tmux_conf_theme_colour_10="#d08770" # pink