Skip to content

Instantly share code, notes, and snippets.

View kepocnhh's full-sized avatar

Stanley Wintergreen kepocnhh

View GitHub Profile
@kepocnhh
kepocnhh / on_stop.sh
Created May 5, 2026 11:55
codex hooks on stop
#!/usr/local/bin/bash
FILE_DIR="$(TZ='utc' date +%Y/%m/%d)"
JSON_INPUT="$(cat)"
CODEX_SESSION_ID=$(echo "${JSON_INPUT}" | yq .session_id)
CODEX_TURN_ID=$(echo "${JSON_INPUT}" | yq .turn_id)
CODEX_WORKDIR=$(echo "${JSON_INPUT}" | yq .cwd)
CODEX_TRANSCRIPT_PATH=$(echo "${JSON_INPUT}" | yq .transcript_path)
CODEX_RESPONSE=$(echo "${JSON_INPUT}" | yq .last_assistant_message)
@kepocnhh
kepocnhh / service_monitor.sh
Last active May 2, 2026 22:12
service monitor
#!/usr/local/bin/bash
if test $# -ne 1; then
echo 'Wrong arguments!'; exit 1; fi
SERVICE_NAME="$1"
if test -z "${SERVICE_NAME}"; then
echo "Service name \"${SERVICE_NAME}\" is empty!"; exit 1; fi
#!/usr/local/bin/bash
ARCH='amd64'
PLATFORM="linux/${ARCH}"
HOST='docker.io'
NAMESPACE='kepocnhh'
ISSUER='debian'
ISSUER_VERSION='trixie'
REPOSITORY="${ISSUER}-${ISSUER_VERSION}-${ARCH}"
IMAGE_VERSION='10'
@kepocnhh
kepocnhh / teleproxy.service
Created May 2, 2026 12:43
teleproxy.service
[Unit]
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=32
StartLimitBurst=1
[Service]
User=johndoe
Type=simple
WorkingDirectory=/home/johndoe
@kepocnhh
kepocnhh / send_message.sh
Last active May 2, 2026 12:18
Telegram bot send message
#!/usr/local/bin/bash
if test $# -ne 4; then
echo 'Wrong arguments!'; exit 1; fi
TG_BOT_ID="$1"
TG_BOT_TOKEN="$2"
TG_CHAT_ID="$3"
TG_MESSAGE="$4"
@kepocnhh
kepocnhh / xray.service
Created May 1, 2026 12:01
xray.service
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
User=johndoe
Type=simple
WorkingDirectory=/home/johndoe
ExecStart=/home/johndoe/.local/bin/xray run -c /home/johndoe/.config/xray/config.json
AmbientCapabilities=CAP_NET_BIND_SERVICE
@kepocnhh
kepocnhh / build_baseline.sh
Last active April 29, 2026 19:23
build baseline
#!/usr/local/bin/bash
echo "Enter dir:"
read -e ISSUER
ROOT_DIR="$(realpath "${ISSUER}")"
if test $? != 0; then
echo "Read dir \"${ISSUER}\" error!"; exit 1; fi
@kepocnhh
kepocnhh / xray_config.sh
Created April 19, 2026 14:35
xray_config.sh
#!/usr/local/bin/bash
rm config.json
LOGLEVEL='warning'
INBOUND_PROTOCOL='vless'
INBOUND_LISTEN='0.0.0.0'
INBOUND_PORT=443
@kepocnhh
kepocnhh / teleproxy_start.sh
Last active April 19, 2026 11:22
teleproxy_start.sh
#!/usr/local/bin/bash
TELEPROXY_PORT=443
###
MTPROTO_SECRETS_PATH="${HOME}/.config/mtproto/mtproto_secrets.txt"
ISSUER="${MTPROTO_SECRETS_PATH}"
if [[ ! -f "${ISSUER}" ]]; then
@kepocnhh
kepocnhh / mtproxy_start.sh
Created April 19, 2026 09:53
mtproxy_start.sh
#!/usr/local/bin/bash
MTPROXY_DATETIME="$(TZ=utc date +%Y%m%d%H%M%S)"
MTPROXY_LOCAL_PORT=8888
MTPROXY_PORT=8443
###
MTPROXY_SECRETS_PATH="${HOME}/.config/mtproxy/mtproxy_secrets.txt"