Skip to content

Instantly share code, notes, and snippets.

View garywill's full-sized avatar
🌴
This year spending even less time on Github. Will reply but don't expect soon!

Garry W garywill

🌴
This year spending even less time on Github. Will reply but don't expect soon!
View GitHub Profile
@garywill
garywill / ytb-formats-bookmarklet.js
Last active June 25, 2025 08:51
Browser bookmarklet: get formats from youtube video page
function extractAdaptiveFormatsInfo(in_formats) {
function getStreamType(f) {
const mimeType = f.mimeType || '';
if (mimeType.startsWith('audio/')) return 'audio';
if (mimeType.startsWith('video/')) {
if (f.audioChannels && f.audioChannels > 0) {
return 'video+audio';
}
return 'video';
}
@garywill
garywill / root_overlay_sandbox_run.sh
Last active March 4, 2025 06:00
bubblewrap (bwrap) root overlay filesystem container on opensuse. Can install packages from openeuse repos, to test and try software in sandbox
#!/bin/bash
# 显示本bash脚本收到的完整参数
echo "此脚本文件接收到的来自终端的所有参数: $@"
script=$(readlink -f "$0")
@garywill
garywill / terminal-opentabs.sh
Created February 8, 2025 13:26
Terminal many tabs with different commands running in (xfce4 terminal)
#!/bin/bash
arr_tab_run_cmd=("$@")
nargs=${#arr_tab_run_cmd[@]}
terminal_args=(--window)
for ((i=0; i<nargs; i++)); do
if [ $i -eq 0 ]; then
echo "第一个tab: ${arr_tab_run_cmd[$i]}"
@garywill
garywill / trigger_github_action.sh
Created January 30, 2025 06:21
Manually trigget Github Action (CI) workflow by shell CLI (bash). 用shell手动触发一个Github Action上的workflow开始运行
#!/bin/bash
# https://docs.github.com/zh/rest/actions/workflows#create-a-workflow-dispatch-event
echo -n "Enter GitHub token: "
# Disable echo.
stty -echo
read token
@garywill
garywill / user.js
Created January 30, 2025 04:08
firefox
user_pref("browser.bookmarks.defaultLocation", "unfiled_____");
user_pref("browser.quitShortcut.disabled", true); // disable Ctrl-Q quit shortcut [LINUX] [MAC] [FF87+
// user_pref("mousewheel.default.delta_multiplier_y", 250); //鼠标滚轮速度(旧)
user_pref("mousewheel.system_scroll_override.vertical.factor", 250); //鼠标滚轮速度
user_pref("browser.tabs.closeWindowWithLastTab", false); // 最后一个标签不关闭浏览器
user_pref("browser.tabs.insertAfterCurrent", true); // 在目前标签后插入新标签
user_pref("browser.tabs.loadBookmarksInBackground", true); // 后台打开书签
user_pref("browser.tabs.loadBookmarksInTabs", true);
user_pref("browser.tabs.loadDivertedInBackground", true);
user_pref("browser.urlbar.trimURLs", false); //不隐藏部分url
@garywill
garywill / netbindpri
Created January 27, 2025 13:12
Bind (listen) <1024 ports without whole root (cap_net_bind_service), with capsh
sudo capsh --caps='cap_net_bind_service+eip cap_setpcap,cap_setuid,cap_setgid+ep' \
--keep=1 --user=non-root-user --addamb=cap_net_bind_service -- \
-c '/path/to/your/command'
@garywill
garywill / trime.custom.yaml
Created January 27, 2025 13:11
同文堂(Trime)Android 的双键14键键盘(带英文切换变26键),带左右移动 (rime)
patch:
"preset_keyboards/wubi86_double_key": #佈局ID
name: "五笔双键键盘" #方便自己辨識的名字
ascii_mode: 0 #默認進入中文狀態
height: 30 #每行高度
width: 20 #按鍵默認寬度(取所有按鍵中用得較多的寬度值,接下來就可以少寫一些width了)
# label_transform: uppercase #uppercase|none 中文模式下的字母標籤自動大寫
lock: true
main_keys_text_size: &TS
18
@garywill
garywill / Notice.txt
Last active May 23, 2025 05:14
openSUSE Leap 15.6 packages list: remove / lock (never install) / install. (Remove first, then install ! 先删再装,保证该装的装) 长列表~~
These is used by KDE theme. Make sure they are installed from main repo. Don't use obs repo one.
libimobiledevice
libplist
ifuse
#!/usr/bin/env python3
# usage:
# env mail_acc="aaa@bbb.ccc" env mail_pswd="xxx" env mail_title="Hi~" env mail_content="Hello~" smtp2self
import sys
import os
import logging
logging.basicConfig(level=logging.DEBUG)
@garywill
garywill / askopen
Last active January 9, 2025 14:48
askbrowser. (can link from xdg-open, firefox, dolphin). Ask to open, copy, cancel, pretend to success
#!/bin/bash
PARAS="$@"
TEXT="是否复制以下内容?"
if [[ "$PARAS" ]] ; then
TEXT="$TEXT\n$PARAS"
fi