Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Reimu Auto Expand
// @namespace reimu-auto-expand
// @match http*://blog.reimu.net/archives/*
// @grant none
// @version 1.0
// @author -
// @description 5/8/2023, 11:41:17 PM
// ==/UserScript==
@Colerar
Colerar / add-cacert-jvm.command
Created March 12, 2023 04:33
Add cacerts to JVM for macOS
#!/usr/bin/env bash
cert_file="$1"
if [ ! -f "$cert_file" ]; then
echo "$cert_file is not exist or not a file"
exit 1
fi
echo
@Colerar
Colerar / fuck-qq-middle.user.js
Last active May 30, 2023 03:59
直接跳转被 QQ 拦截的网页 | 新版 QQNT 继承了手机版的稀烂特性,以此脚本减轻影响。
// ==UserScript==
// @name 直接跳转被 QQ 拦截的网页
// @namespace jump-qq-middlem
// @run-at document-start
// @match http*://c.pc.qq.com/*
// @grant none
// @version 1.1
// @author -
// @description 新版 QQNT 继承了手机版的稀烂特性,以此脚本减轻影响。
// ==/UserScript==
@Colerar
Colerar / asdf.zsh
Created February 6, 2023 07:53
fix OMZP::asdf completion
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
ASDF_DIR="/opt/asdf-vm"
ASDF_COMPLETIONS="$ASDF_DIR"
fi

Image Compression Snippets

Environment

The links below all go to the Homebrew Formulae page, if you're not working on macOS, just search with your own package manager.

  • Zsh 5.8.1 (already pre-installed on macOS )
  • fd, man fd for help.
  • webp, cwebp -H for help.
  • libheif, heif-enc for help.
eval "$(zoxide init zsh --no-cmd)"
\builtin unalias z &>/dev/null || \builtin true
function z() {
__zoxide_z "$@"
}
\builtin unalias zo &>/dev/null || \builtin true
function zo() {
__zoxide_zi "$@"
/* ==UserStyle==
@name bili-sub
@namespace bili-sub
@version 1
==/UserStyle== */
@-moz-document url-prefix("https://www.bilibili.com/bangumi/play/") {
.squirtle-subtitle-item-text {
font-size: 24px !important;
}
alias ls='lsd'
alias l='lsd --long'
alias la='lsd --almost-all --long'
alias lha='lsd --all --long'
alias llm='lsd --timesort --long'
alias lS='lsd -1'
alias lt='lsd --tree --depth=2'
// ==UserScript==
// @name Wikipedia zh Autojump
// @version 0.1
// @description Autojump zh.wikipedia.org/language-tag/xxx to zh.wikipedia.org/wiki/xxx
// @author Colerar
// @downloadURL https://gist.github.com/Colerar/d324ffdd2a773907071ed483dda01289/raw/wikipedia-zh-autojump.user.js
// @updateURL https://gist.github.com/Colerar/d324ffdd2a773907071ed483dda01289/raw/wikipedia-zh-autojump.user.js
// @match *://zh.wikipedia.org/*
// @match *://zh.m.wikipedia.org/*
// @run-at document-start
import kotlinx.datetime.DayOfWeek
import java.time.DayOfWeek.*
private val enFull = Regex("""^(mon|tues?|wed(nes)?|thurs?|fri|sat(ur)?|sun)(day|\.)?$""", RegexOption.IGNORE_CASE)
fun parseDayOfWeek(expr: String): DayOfWeek? {
if (expr.isBlank()) return null
val trim = expr.trim()