Skip to content

Instantly share code, notes, and snippets.

View sloppycoder's full-sized avatar
🎯
Focusing

Li Lin sloppycoder

🎯
Focusing
  • Singapore
View GitHub Profile
# Sightly AI Privacy Policy
_Last updated: 2026-04-24_
Sightly AI ("the app") is a tourist-aid application that uses the camera,
microphone, and location sensors on your device to help you understand the
places around you — museums, historical sites, churches, restaurants, and
street scenes — and to translate menus and signs. This document describes
what data the app collects, how it is used, and which third-party services
receive it.
@sloppycoder
sloppycoder / xray_conf.py
Last active April 8, 2026 14:14
xray config and QR generator
#!/usr/bin/env python3
"""
Generate an Xray VLESS+REALITY config, write it to config.json,
and generate a QR code via qrencode.
Usage: python3 xray_conf.py --tag NAME [--png OUTPUT.png] [--ip SERVER_IP]
"""
import argparse
import ipaddress
import json
@sloppycoder
sloppycoder / tmuxssh
Created August 30, 2025 09:54
ssh tmux command into GCP VM
#!/bin/bash
VM_NAME=$1
if [ "$VM_NAME" = "" ]; then
echo please specify vm name
exit 0
fi
USER=$2
if [ "$USER" = "" ]; then
@sloppycoder
sloppycoder / 01_install_v2ray_on_debian.md
Last active July 4, 2025 15:50
V2Ray setup, server, client and APT setting, etc

Install V2Ray on Debian Linux, including Raspberry Pi OS

Download V2Ray release from V2Fly Github repo, install it using the following steps

# run all below commands as root
# create v2ray user and config directory
mkdir /usr/local/etc/v2ray
useradd --system --no-create-home --shell /usr/sbin/nologin v2ray
chown v2ray:v2ray /usr/local/etc/v2ray
@sloppycoder
sloppycoder / super6.sh
Created December 18, 2023 08:50
execute command on remote hosts
#!/bin/bash
CMD=$1
run() (
HOST=$1
ssh $HOST "$CMD"
)
@sloppycoder
sloppycoder / sh
Created November 16, 2023 07:17
export and import data from redis
redis-cli --scan --pattern "openai*" | while read key; do redis-cli PERSIST $key; done
redis-cli KEYS 'openai*' | while read key; do
echo "Key: $key" >> redis_data.txt
redis-cli DUMP "$key" | xxd -p >> redis_data.txt
echo "" >> redis_data.txt
done
@sloppycoder
sloppycoder / key2secret.sh
Last active August 11, 2023 05:53
create an k8s secret from a ssh private key
#!/bin/bash
balk() {
echo $1
echo key2secret.sh "<private_key> <namespace> <secret_name> <ssh_host>"
exit 1
}
if [ "$1" = "" ]; then
balk "please specify private key"
@sloppycoder
sloppycoder / batt.py
Last active August 3, 2025 14:28
Raspberry PI Compute Module 4 with Wavesahre CM4-POE-UPS board setup
#! /usr/bin/python3
# sudo apt install -y python3-smbus
import smbus
import time
# Config Register (R/W)
_REG_CONFIG = 0x00
# SHUNT VOLTAGE REGISTER (R)
@sloppycoder
sloppycoder / totp.py
Last active June 7, 2023 03:26
Generate TOTP registration QR and print values, compatible with Google Authenticator
import qrcodeT
import pyotp
import time
def totp_url(secret, issuer, user):
return f"otpauth://totp/{issuer + ':' + user}?secret={secret}&issuer={issuer}&algorithm=SHA1&digits=6&period=30"
secret = pyotp.random_base32()
@sloppycoder
sloppycoder / pg_delay
Last active June 16, 2021 05:47
Delay a query in PostgreSQL
drop table if exists dummy_data;
create table dummy_data (index int, delay decimal, account_name varchar);
insert into dummy_data
values
(1, 0.01, 'ACCOUNT1'),
(2, 0.1, 'ACCOUNT2'),
(3, 0.5, 'ACCOUNT3'),
(4, 1, 'ACCOUNT4'),