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 / nhexc
Created January 9, 2025 14:41
bash nohup, and more. Redirect to /dev/null. Don't output anything to terminal. You can close terminal
#!/bin/bash
echo "nohup execute : $*"
setsid -f nohup $* >/dev/null 2>&1 &
sleep 1
disown -a
sleep 1
exit
@garywill
garywill / urldecode
Created January 9, 2025 14:38
bash script decode URL string
#!/bin/bash
urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
urldecode $1
@garywill
garywill / kwin-restart
Created January 9, 2025 01:25
Find correct tty (X11) and user, then force restart KWin (KDE bug workaround). Need '0newline' script
#!/bin/bash
# 获取当前用户ID
CURRENT_USER_ID=$(id -u)
echo "CURRENT_USER_ID=$CURRENT_USER_ID"
# 遍历/proc,找到属于当前用户,且 exec 指向 /usr/bin/plasmashell 的进程
for dir in /proc/*; do
# echo "checking dir = $dir"
if [ -d $dir ] && [[ $dir =~ /proc/[0-9]* ]]; then
@garywill
garywill / imapread
Created January 9, 2025 01:22
用mutt在终端里收邮件,用IMAP,不下载
#!/bin/bash
TDIR=$(mktemp -d /dev/shm/imapread-XXXXX)
cd "$TDIR"
touch alias mutt_certificates mutthistory postponed sent signature
mkdir Mail mbox spool tmp
account="$1"
declare -A server_addrs
@garywill
garywill / gitt
Created January 9, 2025 01:18
Just some git commands
#!/bin/bash
echo -n -e "NOW: $(date)\n"
echo
git branch |more
echo
git status -suno
echo
case $1 in
"log")
@garywill
garywill / 0newline
Created January 9, 2025 01:16
Print text file correctly, which 0x00 is newline. '\n'在某种文本文件里被用0x00表示了,正确打印出这种文本文件内容
#!/bin/bash
xargs -0 -L1 -a "$@"
@garywill
garywill / skin.xml
Created January 1, 2025 14:56
TrafficMonitor skin 只管了了展开的(layout_l)。用微软雅黑10号字体
<root>
<skin>
<text_color>16777215,10022341,16777215,16777215,16777215,16770992,16770992,16770992,16770992</text_color>
<specify_each_item_color>0</specify_each_item_color>
<skin_author>m</skin_author>
<font name="Microsoft YaHei" size="8" style="0"/>
<display_text>
<up>上传 </up>
<down>下载 </down>
<cpu>CPU </cpu>
@garywill
garywill / tcpuart.py
Created November 23, 2024 04:09
Use MCU as simple TCP UART middle server (简单无线串口中间服务器). Tested on ESP32-C3 with MicroPython 1.24.0
# On Linux PC
# socat pty,link=/tmp/ttyV0,raw tcp:192.168.X.X:2000
# picocom /tmp/ttyV0
# esptool.py --before no_reset --after no_reset --port /tmp/ttyV0
# rshell -p /tmp/ttyV0 --buffer-size 5000
showTCP=False
showUART=False
try:

开源扩展「大术专搜」更新!Chrome用户体验大提升与Firefox看齐

https://github.com/garywill/BigSearch

[u]以 灵活又顺手 的方式 在(切换) 任意一个 或 (连续)多个 搜索引擎(或任意网站)进行搜索。[/u] 新手友好,专家满意。包括日常、娱乐及工作。

俱有 多搜索引擎工具 该有的基本功能,如:

  • 内置 百度,Google,B站,Youtube,Github,淘宝
  • GET/POST
@garywill
garywill / amo-api-edit-addon-desc.sh
Created January 29, 2024 14:03
Use bash and python to edit AMO addon description
#!/bin/sh -e
# modified from https://github.com/mikhirev/mozjwt
# External dependencies: openssl. python3
ADDON='' ## write your addon here
# obtain this values at https://addons.mozilla.org/en-US/developers/addon/api/key/
# secrets