Skip to content

Instantly share code, notes, and snippets.

View supersonictw's full-sized avatar
🦋

不知火 Shiranui supersonictw

🦋
View GitHub Profile
@supersonictw
supersonictw / rproxy.sh
Last active November 4, 2025 06:01
Quickly add a reverse proxy via the Caddy Admin API
#!/bin/bash
# rproxy.sh - Quickly add a reverse proxy via the Caddy Admin API
# Usage: rproxy <UPSTREAM_ADDR> <LISTEN_ADDR>
# Example: rproxy localhost:3000 :8080
# 0. Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "Error: This script requires 'jq'. Please install jq first." >&2
exit 1
fi
@supersonictw
supersonictw / go-avahi-cname.service
Created November 4, 2025 05:24
Lightweight mDNS publisher of subdomains for your machine. https://github.com/grishy/go-avahi-cname
[Install]
WantedBy=multi-user.target
[Unit]
Description=Lightweight mDNS publisher of subdomains for your machine
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
# Generated by Powerlevel10k configuration wizard on 2025-10-27 at 22:26 CST.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 11390.
# Wizard options: nerdfont-complete + powerline, small icons, unicode, lean, 12h time,
# 1 line, compact, many icons, concise, transient_prompt, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
#!/bin/sh
tee /lib/systemd/system/acpitz-patch.service <<EOF
[Unit]
Description=acpitz patch for thermal
[Service]
ExecStart=/bin/sh -c 'echo disabled > /sys/class/thermal/thermal_zone1/mode'
[Install]
#!/bin/sh
# cron-exec - Execute a command from cron, capture output and exit status, log to target
# SPDX-License-Identifier: MIT (https://ncurl.xyz/s/Kkn2DQsNR)
LOG_TARGET="/dev/fd/1" # Log output destination
TASK_DATETIME="$(date -R)" # Current date/time in RFC-2822 format
TASK_CMD="$@" # Command to execute, passed as arguments
# Execute the command, capture both stdout and stderr
{
"mtu": 1450,
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
},
"default-network-opts": {
"bridge": {
"com.docker.network.driver.mtu": "1450"
services:
desktop:
image: dorowu/ubuntu-desktop-lxde-vnc:latest
container_name: desktop
ports:
- "6080:80"
- "5900:5900"
environment:
- VNC_PASSWORD=${VNC_PASSWORD}
volumes:
@supersonictw
supersonictw / alpine-wifi-txpower.sh
Created August 22, 2025 03:01
Set legal Tx-Power for Taiwan 2.4GHz
sudo tee /etc/network/if-up.d/wifi-txpower > /dev/null << 'EOF'
#!/bin/sh
# Only apply to wlan0 interface
[ "$IFACE" = "wlan0" ] || exit 0
# Set legal Tx-Power for Taiwan 2.4GHz
iwconfig wlan0 txpower 15
# Disable Wi-Fi power-save (optional)
iw dev wlan0 set power_save off
@supersonictw
supersonictw / jsconfig.json
Created August 18, 2025 06:02
Vue's jsconfig.json
{
"allowJs": true,
"compilerOptions": {
"lib": ["es6"],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"types": ["vite-plugin-vue-layouts/client"]
},
@supersonictw
supersonictw / install-irustic.sh
Last active July 30, 2025 05:33
Execute rustic and sends a notification upon successful completion.
#!/bin/sh
# irustic.sh - Execute rustic and sends a notification upon successful completion.
# SPDX-License-Identifier: MIT (https://ncurl.xyz/s/Kkn2DQsNR)
set -e
# rustic-rs/rustic
# https://github.com/rustic-rs/rustic
DIR_RUSTIC="/root/.config/rustic"