Skip to content

Instantly share code, notes, and snippets.

@KyonLi
KyonLi / rename_index.sh
Created January 30, 2024 09:21
Batch rename files
#!/bin/bash
ext=jpg
shopt -s nullglob
OLDIFS=$IFS
rename(){
IFS=$'\n'
local arr=( $(ls -v *.$ext) )
@KyonLi
KyonLi / README.md
Last active May 10, 2023 07:05
Debian / Ubuntu Setup Bluetooth Network Access Point (NAP)

Debian / Ubuntu Setup Bluetooth Network Access Point (NAP)

Requirements: Systemd, Network Manager

  1. Install required packages

    apt install bluez bluez-tools iptables dnsmasq-base

  2. Configure shared bridge interface br0

@KyonLi
KyonLi / README.md
Last active April 24, 2023 11:21
QNAP硬盘休眠

QNAP硬盘休眠

适用于系统盘为SSD数据盘有HDD的情况,实现开机自动解除HDD系统占用,每天4:00~4:30自动同步数据避免系统出错

  1. 启用开机自启,参考wiki,编辑autorun.sh加入以下内容
#!/bin/sh

/share/Public/scripts/disk_standby.sh start
  1. 在共享文件夹Public中创建scripts目录,向其中放入disk_standby.sh,添加执行权限chmod +x disk_standby.sh
  2. 添加定时任务
//v4.35.0+
{
"inbounds": [
{
"port": 1090, //留给本机 socks 使用
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true
proxies:
# shadowsocks
# The supported ciphers(encrypt methods):
# aes-128-gcm aes-192-gcm aes-256-gcm
# aes-128-cfb aes-192-cfb aes-256-cfb
# aes-128-ctr aes-192-ctr aes-256-ctr
# rc4-md5 chacha20-ietf xchacha20
# chacha20-ietf-poly1305 xchacha20-ietf-poly1305
- name: "ss1"
type: ss
@KyonLi
KyonLi / echo.go
Created May 22, 2019 07:56
echo server
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"net/url"
"strings"
)
@KyonLi
KyonLi / golang.sh
Created April 23, 2019 05:42
sets envs for golang
#!/bin/bash
# sets envs for golang
if [ -z "$GOPATH" ]; then
export GOROOT="/usr/local/go"
export GOPATH="$HOME/go"
export PATH="$PATH:$GOPATH/bin:$GOROOT/bin"
fi
@KyonLi
KyonLi / coin.go
Created April 1, 2019 07:56
Coin in go
func coin() {
backspace := "\b\b"
for i := 0; i < 5; i++ {
for _, c := range []string{"🌝", "🌖", "🌗", "🌘", "🌚", "🌒", "🌓", "🌔"} {
fmt.Printf("%s%s", backspace, c)
time.Sleep(33333 * time.Microsecond)
}
}
rand.Seed(int64(time.Now().UnixNano()))
if rand.Uint32() % 2 == 0 {
@KyonLi
KyonLi / S22v2ray
Created February 10, 2019 07:52
entware v2ray
#!/bin/sh
ENABLED=yes
PROCS=v2ray
ARGS="-config /opt/etc/v2ray/config.pb -format=pb"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SRC_BYPASS_IP_FILE=/opt/etc/v2ray/src_bypass_ip.txt
@KyonLi
KyonLi / fix_permission.sh
Created January 21, 2019 08:26
Fix www file permission
find /var/www -type f -exec chmod 644 {} \;
find /var/www -type d -exec chmod 755 {} \;