Skip to content

Instantly share code, notes, and snippets.

View vimagick's full-sized avatar
🐰
🐰🐰🐰🐰🐰🐰🐰🐰🐰

K̶e̶v̶i̶n̶ vimagick

🐰
🐰🐰🐰🐰🐰🐰🐰🐰🐰
View GitHub Profile
#!/bin/bash
CONTAINER_NAME=${1:?container name is empty}
NETWORK_MODE=$(docker inspect -f "{{.HostConfig.NetworkMode}}" $CONTAINER_NAME)
STATE_PID=$(docker inspect --format '{{.State.Pid}}' $CONTAINER_NAME)
VETH_NAME=
if [[ $NETWORK_MODE = "host" ]]; then
VETH_NAME="host"
else
#!/usr/local/bin/bash
#
# Background Music / Sound Effects Downloader
#
BASE_URL=https://www.tukuppt.com
IDX_URL=$BASE_URL/peiyueso/shipin5097/__zonghe_0_0_0_0_0_0_%d.html
#IDX_URL=$BASE_URL/yinxiaomuban/shipin/__zonghe_0_0_0_0_0_0_%d.html
API_URL=$BASE_URL/api/audio
TOTAL_PAGES=46
#!/usr/bin/env python3
#
# CIDR calculator: find the minimum CIDR which contains multiple ip addresses
#
# Example:
# $ cidr 142.250.66.78 142.250.204.142 142.251.130.14
# 142.250.0.0/15
#
import os
#!/bin/bash
yq -o json | jq -r '
.proxies[] |
if .type == "ss" then
(["ss://", ("\(.cipher):\(.password)"|@base64), "@\(.server):\(.port)"] | join(""))
elif .type == "vmess" then
({v:"2", ps:.name, add:.server, port:.port, id:.uuid, aid:.alterId, scy:.cipher, net:.network, host:.["ws-opts"].headers.Host, path:.["ws-opts"].path, tls:(if .tls then "tls" else "" end)} | "vmess://\(.|@json|@base64)")
elif .type == "trojan" then
("trojan://\(.password)@\(.server):\(.port)?sni=\(.sni)&allowInsecure=1" + (if .network == "ws" then "&type=\(.network)&path=\(.["ws-opts"].path)" else "" end))
#!/bin/bash
set -uo pipefail
CURSOR=${1:-1}
API_URL=https://lexica.art/api/infinite-prompts
#HTTP_PROXY=172.16.1.48:3128
OUTPUT_DIR=output
PAGE_NUM=0
MAX_PAGE_NUM=$((10**6))
#!/bin/bash
set -uo pipefail
URI=${1:?uri is empty}
LISTEN_ADDR=127.0.0.1
LISTEN_PORT=1080
CFG_FILE=/tmp/v2ray.json
PID_FILE=/tmp/v2ray.pid
#!/bin/bash
#
# shadowsocks connectivity check
#
INPUT_FILE=${1:?input file is empty}
OUTPUT_FILE=${2:?output file is empty}
LISTEN_ADDR=127.0.0.1
LISTEN_PORT=1080
#!/bin/bash
#
# Simple script to test network connectivity, and send result to a Tasmota/ESP32 RGB Light
# !!! Please implement your own "check()" function !!!
#
HTTP_API="http://192.168.1.103/cm"
MQTT_PUB="mosquitto_pub -h broker.hivemq.com -p 8883 --capath /etc/ssl/certs/ -u username -P password -q 2"
DEV_NAME="tasmota_XXXXXX"
CMND="http" # http or mqtt
@vimagick
vimagick / MJ_HT_V1.sh
Created January 26, 2024 15:41
🌡️💧🔋
#!/bin/bash
# sudo hcitool lescan
MAC="4C:65:A8:D?:??:??"
while :; do
HT=$(timeout 20 gatttool -b $MAC --char-write-req --handle=0x10 -n 0100 --listen | grep -m1 "Notification handle")
(($? == 0)) && break
sleep 5
done
@vimagick
vimagick / blescan.sh
Last active February 6, 2024 03:35
hcitool lescan (with 30 sec window)
#!/bin/bash
set -euo pipefail
BLE_DEV=hci0
DEDUP_WINDOW=30
MQTT_BROKER=broker.hivemq.com
MQTT_PORT=8883
MQTT_QOS=2
MQTT_TOPIC=blescan