Skip to content

Instantly share code, notes, and snippets.

View AllanChain's full-sized avatar

Allan Chain AllanChain

View GitHub Profile
@ManiaciaChao
ManiaciaChao / article-style.css
Last active February 11, 2024 18:42 — forked from bangedorrunt/article-style.css
GoldenDict Arc Dark Theme
/* mkdir ~/.goldendict/styles/arc-dark/
then put this stylesheet there */
body {
margin-top: 1px;
margin-right: 3px;
margin-left: 2px;
margin-bottom: 3px;
background: #4b5162;
color: white;
font-family: Noto Serif CJK SC, Noto Serif, Bookerly, Segoe UI,
@tgroshon
tgroshon / index.ts
Last active January 26, 2024 13:41
Tailwind CSS GIMP Color Palette
// Execute with "bun run index.ts > tailwind.gpl"
//
import colors from 'tailwindcss/colors'
type RGB = {r: number, g: number, b: number};
function isObj(data: any): data is object {
return data !== null && typeof data === 'object' && !Array.isArray(data)
}
@alexdevero
alexdevero / markdown.reg
Last active January 3, 2024 08:48
Add markdown as an item to “New” context menu in Windows 10 (https://superuser.com/questions/638755/add-item-to-new-context-menu-in-windows-8#640486).
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.md]
@="markdown"
[HKEY_CLASSES_ROOT\.md\ShellNew]
"NullFile"=""
[HKEY_CLASSES_ROOT\markdown]
@="Blank Markdown file"
@vankesteren
vankesteren / Adamopt.jl
Last active February 25, 2023 05:35
Julia implementation of Adam optimizer
module Adamopt
# This is a module implementing vanilla Adam (https://arxiv.org/abs/1412.6980).
export Adam, step!
# Struct containing all necessary info
mutable struct Adam
theta::AbstractArray{Float64} # Parameter array
loss::Function # Loss function
grad::Function # Gradient function
@diastremskii
diastremskii / create-new-file.ahk
Last active October 24, 2022 06:25
AutoHotKey: Create a new file with Alt+N keyboard shortcut in Windows Explorer
; This is part of my AutoHotKey [1] script. When you are in Windows Explorer it
; allows you to press Alt+N and type a filename, and that file is created
; in the current directory and opened in the appropriate editor (usually
; [gVim](http://www.vim.org/) in my case, but it will use whatever program is
; associated with the file in Windows Explorer).
; This is much easier than the alternative that I have been using until now:
; Right click > New > Text file, delete default filename and extension (which
; isn't highlighted in Windows 7), type the filename, press enter twice.
; (Particularly for creating dot files like ".htaccess".)
@dschaehi
dschaehi / index.css
Last active September 17, 2022 09:06
Jupyterlab Solarized Dark Theme
/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/
/*
The following CSS variables define the main, public API for styling JupyterLab.
These variables should be used by all plugins wherever possible. In other
words, plugins should not define custom colors, sizes, etc unless absolutely
necessary. This enables users to change the visual theme of JupyterLab
@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 / 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)