Skip to content

Instantly share code, notes, and snippets.

View AllanChain's full-sized avatar

Allan Chain AllanChain

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 / dockertags
Last active February 29, 2020 02:07
List docker image tags with 163 mirror
#!/bin/bash
# From https://stackoverflow.com/a/39454426/8810271
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
EXAMPLE:
@AllanChain
AllanChain / wtContextMenu.reg
Last active October 4, 2021 01:46
Add "open wt" and "wt with profile" to context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\openwtMore]
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\wtMore"
"MUIVerb"="wt with Profile"
"Icon"="D:\\Syncthing\\Material\\Img\\wt.ico"
[HKEY_CLASSES_ROOT\Directory\ContextMenus\wtMore]
[HKEY_CLASSES_ROOT\Directory\ContextMenus\wtMore\shell]
@AllanChain
AllanChain / hole.py
Last active June 18, 2022 03:30
网页版树洞渐变色
'''
网页版树洞从 Alice 到 Zombie Zach 的颜色渐变
https://pkuhelper.pku.edu.cn/hole/##1264962
参考了网页版树洞的颜色生成机制,值越接近则颜色越接近。
可以通过更改 i 的值(0 到 1)来改变从谁开始
'''
NAMES = [
'Alice',
@AllanChain
AllanChain / profiles.json
Last active April 24, 2020 13:31
Windows Terminal Configuration
// This file was initially generated by Windows Terminal 0.11.1121.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@AllanChain
AllanChain / remove_parentheses.pyw
Created September 27, 2020 01:38
Removes parentheses in filename. Very useful for files downloaded from course.pku.edu.cn
from sys import argv
import os
import re
pattern = re.compile(r'^(.*?)(\(\d+\))+\.(.*?)$')
if __name__ == "__main__":
for file_to_rename in argv[1:]:
if os.path.isfile(file_to_rename):
match_result = re.match(pattern, file_to_rename)
@AllanChain
AllanChain / 00-startup.py
Created December 7, 2020 02:02
My ipython profile for experiment reports
import numpy as np
from numpy import sqrt
import pandas as pd
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = (10, 8)
plt.rcParams["font.size"] = 14
def read_excel(sheet):
CoordMode, Mouse, Screen
WinActivate, FRD-AL10
WinGetPos, X, Y, Width, Height, FRD-AL10
if ErrorLevel
MsgBox, Error
ButtonX := X + (Width / 2)
ButtonY := Y + (Height * 5 / 6)
MouseMove, ButtonX, ButtonY
; MsgBox %X%, %Y%, %Width%, %Height%, %ButtonX%, %ButtonY%
Loop, 100
@AllanChain
AllanChain / color.html
Last active December 21, 2020 15:28
Simple color picker page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Color Picker</title>
<style>
:root {
--current-color: #000000;
}
@AllanChain
AllanChain / big-sc.mplstyle
Created January 17, 2021 04:02
My Matplotlib style file.
figure.figsize: 10, 8
font.family: sans-serif
font.sans-serif: Noto Sans CJK SC
axes.unicode_minus: false
font.size: 16 # controls default text sizes
axes.titlesize: 20 # fontsize of the axes title
axes.labelsize: 20 # fontsize of the x and y labels
xtick.labelsize: 16 # fontsize of the tick labels
ytick.labelsize: 16 # fontsize of the tick labels
legend.fontsize: 16 # legend fontsize