README 🥚

# Install (はじめに)
- 「JAYA」を「ダウンロード」
- 「JAYA」を「ドキュメント」に「配置」
> sudo install -v -m 0755 jaya* /usr/local/bin

# Jayachk (オプション)
> cd ~/ドキュメント && sh -x jayachk
- シェルの構文チェックや差分をチェックします。

# Jayakit (オプション)
> sudo jayakit
- 既知の脆弱性やルートキットの検査を行います。

# Jayauns (モジュール)
> jayauns firefox
- ルート権限が絶対に使えない、隔離された環境の構築。

# Jayamac (最初に一度だけ実行)
> sudo jayamac
- リース履歴を消去し、MACアドレスをランダム化します。

# Jayanta (最初に一度だけ実行)
> sudo jayanta debian-tor privoxy
- コアシステム。TOR透過プロキシとRAWプロキシの構築。
- ホストから出る全ての通信がTorを経由するようになります。

# Jayaraw (アプリケーション起動の際)
> sudo L='ja_JP.UTF-8' jayaraw env HOME='/tmp/.jaraw' jayauns sh -c 'mkdir -p /tmp/.jaraw; firefox'
> sudo L='ja_JP.UTF-8' jayaraw jayauns firefox
- RAW強制空間。(DNSもWebRTCも全てを許可する。)
- 隔離空間を作りその空間内から出る通信は、生IPで通信を行います。

# Jayator (アプリケーション起動の際)
> sudo L='ja_JP.UTF-8' jayator env HOME='/tmp/.jator' jayauns sh -c 'mkdir -p /tmp/.jator; firefox'
> sudo L='ja_JP.UTF-8' jayator jayauns firefox
- TOR強制空間。(IPリークは論理的に不可能です。)
- 隔離空間を作りその空間内から出る通信は、カーネルレベルで匿名化されます。

# Jayavpn (Jayaraw起動後にJayaraw内でのみ有効)
> sudo install -v -m 0600 vpn.conf /etc/wireguard
> sudo jayaraw true; sudo IP='[ENDPOINT_IP]' PORT='[ENDPOINT_PORT]' jayavpn
- VPN簡易空間。(匿名化目的で利用しないでください。)
- Jayarawが作る名前空間内でWireGuardを使ったVPN環境を構築します。
- 結果として、Jayaraw空間内で実行したアプリケーションは、VPN経由になります。

CONFIG 🐣

1
2
3
4
5
6
7
8
9
# yt-dlp

pipx install yt-dlp
nvim ~/.config/yt-dlp/config

-S res:480
--js-runtimes node
--remote-components ejs:github
-f 'bv+ba[language=ja]/bestvideo+bestaudio/best'

JAYACHK 🪶

#!/bin/sh

# PROJECT: Jayachk
# UPDATES: 2026-07-22 12:03:01 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
type shellcheck || exit 1; cd "$HOME/ドキュメント" || exit 2

for f in jaya*; do
  [ -f "$f" ] || exit 3
  shellcheck "$f" || exit 4
  diff -u "/usr/local/bin/$f" "$f"; case $? in 0|1) ;; *) exit 5 ;; esac
done

JAYAKIT 🪽

1
2
3
4
5
6
7
8
9
#!/bin/sh

# PROJECT: Jayakit
# UPDATES: 2026-08-19 19:17:17 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; export TMPDIR='/var/tmp'
[ "$(id -u)" -eq 0 ] || exit 1; type lynis trivy rkhunter chkrootkit || exit 2; install -d -m 1777 /var/tmp || exit 3
lynis audit system; trivy rootfs / --scanners vuln; rkhunter --update; rkhunter --sk --check; chkrootkit 2>/dev/null | grep --color='always' -E 'Warning|INFECTED'

JAYAMAC 🦉

#!/bin/sh

# PROJECT: Jayamac
# UPDATES: 2026-07-12 13:21:39 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
[ "$(id -u)" -eq 0 ] || exit 1; type macchanger || exit 2
rm -rfv -- /var/db/dhcp* /var/lib/dhcp* /var/lib/NetworkManager || exit 3

for f in /sys/class/net/*; do
  i="${f##*/}"
  [ "$i" != "lo" ] || continue
  [ -e "$f/device" ] || continue
  ip link set dev "$i" down || continue

  {
    ip addr flush dev "$i" &&
    ip neigh flush dev "$i"
  } || echo "fail: ip: $i" >&2

  macchanger -A "$i" || echo "fail: mac: $i" >&2
  ip link set dev "$i" up && echo "good: up: $i"
done

JAYANTA 🐦‍⬛

#!/bin/sh

# PROJECT: Jayanta
# UPDATES: 2026-08-05 08:46:29 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
TOR="${1:-tor}"; RAW="${2:-privoxy}"; NNS="$(ip netns identify)"

[ "$(id -u)" -eq 0 ] || exit 1; type nft tor conntrack || exit 2
[ -z "$NNS" ] || exit 3; ln -sfv /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 4
( id "$TOR" && id "$RAW" ) || { echo 'sudo sh jayanta [debian-]tor[anon] priv[tinypr]oxy'; exit 5; }
sysctl net.ipv4.ip_forward=0 net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 || exit 6

for t in nat filter; do nft add table inet $t; nft flush table inet $t; done
nft add chain inet nat output '{ type nat hook output priority dstnat; policy accept; }'
for c in input output forward; do nft add chain inet filter $c "{ type filter hook $c priority filter; policy drop; }"; done; conntrack -F expect; conntrack -F
nft add set inet nat reserved '{ type ipv4_addr; flags interval; elements = { 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.88.99.0/24, 192.168.0.0/16, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 224.0.0.0/4, 240.0.0.0/4 }; }'

nft add rule inet nat output udp dport 53 redirect to 9053
nft add rule inet nat output ip daddr 10.192.0.0/10 tcp dport '{ 80, 443 }' tcp flags syn / fin,syn,rst,ack redirect to 9040
nft add rule inet nat output skuid != "{ $TOR, $RAW }" oifname != "lo" ip daddr != @reserved tcp dport '{ 80, 443 }' tcp flags syn / fin,syn,rst,ack redirect to 9040

nft add rule inet filter input ct state vmap '{ invalid : drop, established : accept }'
nft add rule inet filter input ct state new iifname "lo" ip daddr 127.0.0.1 accept

nft add rule inet filter output ct state vmap '{ invalid : drop, established : accept }'
nft add rule inet filter output ct state new ip daddr 127.0.0.1 meta l4proto . th dport vmap '{ udp . 9053 : accept, tcp . 9040 : accept, tcp . 9050 : accept }'
nft add rule inet filter output ct state new tcp dport 443 tcp flags syn / fin,syn,rst,ack skuid "{ $TOR, $RAW }" accept
nft add rule inet filter output ct state new oifname "lo" ip daddr 127.0.0.1 accept; nft list ruleset

{
  echo "SafeSocks 1"
  echo "ReachableAddresses *:443"
  echo "User $TOR"
  echo "DataDirectory /var/lib/tor"
  echo "DNSPort 9053"
  echo "AutomapHostsOnResolve 1"
  echo "AutomapHostsSuffixes .onion"
  echo "VirtualAddrNetworkIPv4 10.192.0.0/10"
  echo "TransPort 9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort"
  echo "SocksPort 9050 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort"
} > /etc/tor/torrc; cat /etc/tor/torrc
{ sv restart tor || service tor restart || systemctl restart tor || rc-service tor restart; } >/dev/null 2>&1

JAYARAW 🕊️

#!/bin/sh

# PROJECT: Jayaraw
# UPDATES: 2026-08-15 18:30:59 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; NNS="$(ip netns identify)"
case "${SUDO_USER:-}" in ''|root) exit 1 ;; esac; type nft || exit 2
[ -z "$NNS" ] || exit 3; ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 4
printf '\033[31m█\033[0m Leak IP [Yes/no]: '; read -r YN; case "$YN" in [Yy]*) ;; *) exit 5 ;; esac
sysctl -q net.ipv4.ip_forward=0 net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 || exit 6

ip netns list | grep -qw jaraw || ip netns add jaraw

ip -n jaraw link show raw-veth1 >/dev/null 2>&1 || {
  ip link add raw-veth0 type veth peer name raw-veth1
  ip link set raw-veth1 netns jaraw
}
ip addr replace 198.18.1.0/31 dev raw-veth0
ip link set lo up; ip link set raw-veth0 up
ip -n jaraw addr replace 198.18.1.1/31 dev raw-veth1
ip -n jaraw link set lo up; ip -n jaraw link set raw-veth1 up
ip -n jaraw route replace default via 198.18.1.0 dev raw-veth1

nft add table inet nat
nft add chain inet nat postrouting '{ type nat hook postrouting priority srcnat; policy accept; }'
nft flush chain inet nat postrouting
nft add rule inet nat postrouting iifname "raw-veth0" ip saddr 198.18.1.1 masquerade

nft add table inet filter
nft add chain inet filter forward '{ type filter hook forward priority filter; policy drop; }'
nft flush chain inet filter forward
nft add rule inet filter forward ct state vmap '{ invalid : drop, established : accept }'
nft add rule inet filter forward ct state new iifname "raw-veth0" ip saddr 198.18.1.1 accept

CAPS='-bpf,-net_raw,-net_admin,-sys_rawio,-sys_ptrace,-sys_module'; IM='fcitx'
for i in all default lo raw-veth1; do ip netns exec jaraw sysctl -q net.ipv6.conf.$i.disable_ipv6=1 || exit 7; done
sysctl -q net.ipv4.conf."$(ip route get 1.1.1.1 | awk '{print $5; exit}')".forwarding=1 net.ipv4.conf.raw-veth0.forwarding=1 || exit 8
printf '\033]10;#ff6666\007'; exec setpriv --inh-caps="$CAPS" --ambient-caps="$CAPS" --bounding-set="$CAPS" ip netns exec jaraw sudo -u "$SUDO_USER" env "LANG=${L:-en_US.UTF-8}" "GTK_IM_MODULE=$IM" "QT_IM_MODULE=$IM" "XMODIFIERS=@im=$IM" "XDG_RUNTIME_DIR=/run/user/$(id -u "$SUDO_USER")" 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' sh -c '"$@"; sleep 1; printf "\033]110\007"' sh "${@:-bash}"

JAYATOR 🦅

#!/bin/sh

# PROJECT: Jayator
# UPDATES: 2026-08-15 18:31:02 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'; NNS="$(ip netns identify)"
case "${SUDO_USER:-}" in ''|root) exit 1 ;; esac; type nft tor || exit 2
[ -z "$NNS" ] || exit 3; ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime || exit 4
printf '\033[32m█\033[0m Hide IP [Yes/no]: '; read -r YN; case "$YN" in ''|[Yy]*) ;; *) exit 5 ;; esac
sysctl -q net.ipv4.ip_forward=0 net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 || exit 6

ip rule list |
grep -Eq 'iif tor-veth0.*blackhole' ||
ip rule add pref 1 iif tor-veth0 blackhole

ip netns list | grep -qw jator || ip netns add jator

ip -n jator link show tor-veth1 >/dev/null 2>&1 || {
  ip link add tor-veth0 type veth peer name tor-veth1
  ip link set tor-veth1 netns jator
}
ip addr replace 198.18.3.0/31 dev tor-veth0
ip link set lo up; ip link set tor-veth0 up
ip -n jator addr replace 198.18.3.1/31 dev tor-veth1
ip -n jator link set lo up; ip -n jator link set tor-veth1 up
ip -n jator route replace default via 198.18.3.0 dev tor-veth1

nft add table inet nat
nft add chain inet nat prerouting '{ type nat hook prerouting priority dstnat; policy accept; }'
nft flush chain inet nat prerouting
nft add rule inet nat prerouting iifname "tor-veth0" ip saddr 198.18.3.1 udp dport 53 dnat ip to 198.18.3.0:9053
nft add rule inet nat prerouting iifname "tor-veth0" ip saddr 198.18.3.1 tcp dport '{ 80, 443 }' tcp flags syn / fin,syn,rst,ack dnat ip to 198.18.3.0:9040

nft add table inet filter
for c in input forward; do nft add chain inet filter $c "{ type filter hook $c priority filter; policy drop; }"; done
nft flush chain inet filter input
nft add rule inet filter input ct state vmap '{ invalid : drop, established : accept }'
nft add rule inet filter input ct state new iifname "tor-veth0" ip saddr 198.18.3.1 ip daddr 198.18.3.0 meta l4proto . th dport vmap '{ udp . 9053 : accept, tcp . 9040 : accept, tcp . 9050 : accept }'
nft add rule inet filter input ct state new iifname "lo" ip daddr 127.0.0.1 accept

while IFS= read -r line; do grep -Fqx -- "$line" /etc/tor/torrc || echo "$line" >> /etc/tor/torrc
done <<'EOF'
SafeSocks 1
DNSPort 198.18.3.0:9053
TransPort 198.18.3.0:9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
SocksPort 198.18.3.0:9050 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
EOF
{ sv restart tor || service tor restart || systemctl restart tor || rc-service tor restart; } >/dev/null 2>&1

CAPS='-bpf,-net_raw,-net_admin,-sys_rawio,-sys_ptrace,-sys_module'; IM='fcitx'
for i in all default lo tor-veth1; do ip netns exec jator sysctl -q net.ipv6.conf.$i.disable_ipv6=1 || exit 7; done
sysctl -q net.ipv4.conf."$(ip route get 1.1.1.1 | awk '{print $5; exit}')".forwarding=1 net.ipv4.conf.tor-veth0.forwarding=0 || exit 8
printf '\033]10;#66ff66\007'; exec setpriv --inh-caps="$CAPS" --ambient-caps="$CAPS" --bounding-set="$CAPS" ip netns exec jator sudo -u "$SUDO_USER" env "LANG=${L:-en_US.UTF-8}" "GTK_IM_MODULE=$IM" "QT_IM_MODULE=$IM" "XMODIFIERS=@im=$IM" "XDG_RUNTIME_DIR=/run/user/$(id -u "$SUDO_USER")" 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' sh -c '"$@"; sleep 1; printf "\033]110\007"' sh "${@:-bash}"

JAYAVPN 🦤

#!/bin/sh

# PROJECT: Jayavpn
# UPDATES: 2026-08-18 09:02:15 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
[ "$(id -u)" -eq 0 ] || exit 1; type nft wg-quick conntrack || exit 2
ip netns exec jaraw true 2>/dev/null && [ -f /etc/wireguard/vpn.conf ] || exit 3
ip netns exec jaraw conntrack -F expect && ip netns exec jaraw conntrack -F || exit 4
ip netns exec jaraw wg show vpn 2>/dev/null || ip netns exec jaraw wg-quick up vpn || exit 5

ip netns exec jaraw nft add table inet filter; ip netns exec jaraw nft flush table inet filter
for c in input output forward; do ip netns exec jaraw nft add chain inet filter $c "{ type filter hook $c priority filter; policy drop; }"; done
ip netns exec jaraw nft add rule inet filter input ct state vmap '{ invalid : drop, established : accept }'
ip netns exec jaraw nft add rule inet filter input ct state new iifname "lo" ip daddr 127.0.0.1 accept
ip netns exec jaraw nft add rule inet filter output ct state vmap '{ invalid : drop, established : accept }'
ip netns exec jaraw nft add rule inet filter output ct state new ip daddr "${IP:-127.0.0.1}" "${PROT:-udp}" dport "${PORT:-51820}" accept
ip netns exec jaraw nft add rule inet filter output ct state new oifname '{ "vpn", "lo" }' accept

JAYAUNS 🐓

1
2
3
4
5
6
7
8
9
#!/bin/sh

# PROJECT: Jayauns
# UPDATES: 2026-08-02 00:25:11 JST
# LICENSE: The Unlicense (unlicense.org)

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
[ "$(id -u)" -ne 0 ] || exit 1; type unshare newuidmap || exit 2; [ "$(readlink /proc/self/ns/user)" != "$(readlink /proc/1/ns/user)" ] || exit 3
printf '\033]12;#6666ff\007'; exec unshare --uts --ipc --pid --fork --time --cgroup --kill-child --user --map-auto --map-current-user --mount --mount-proc --propagation private setpriv --no-new-privs env 'PATH=/usr/local/bin:/usr/bin:/bin' sh -c '"$@"; sleep 1; printf "\033]112\007"' sh "${@:-bash}"

JAYAYTD 🦩

#!/bin/sh

# PROJECT: Jayaytd
# UPDATES: 2026-08-06 18:35:11 JST
# LICENSE: The Unlicense (unlicense.org)

PATH="$HOME/.local/bin:$PATH"; pipe="$(printf '\037')"; mode='search'; type fzf mpv curl chafa ffmpeg yt-dlp || exit 1
printf 'query: '; read -r query; [ -n "$query" ] || exit 2; default="$query"; channel=''; line="${1:-20}"; page=1

while :; do
  case "$mode" in
    videos) src="$query/videos" ;;
    shorts) src="$query/shorts" ;;
    stream) src="$query/streams" ;;
    releas) src="$query/releases" ;;
    podcas) src="$query/podcasts" ;;
    playls) src="$query/playlists" ;;
    search) src="ytsearch$((page * line)):$query" ;;
  esac

  ytd="$(yt-dlp --no-warnings --skip-download --flat-playlist --playlist-end "$((page * line))" --extractor-args 'youtube:lang=ja' --print "%(id)s${pipe}%(title)s${pipe}%(channel)s${pipe}%(channel_url)s${pipe}%(thumbnails.-1.url)s" "$src")" || { [ "$mode" = "search" ] && exit 3; query="$default"; mode='search'; continue; }; [ -n "$ytd" ] || exit 4
  fzf="$(printf '%s' "$ytd" | fzf --with-nth=2 --layout='reverse' --delimiter="$pipe" --prompt="yt[$mode][$page]> " --expect='esc,left,right,ctrl-a,ctrl-d,ctrl-v,ctrl-c,ctrl-s,ctrl-r,ctrl-q,ctrl-f' --preview="[ {3} != NA ] && echo {3}; [ {5} != NA ] && thumb={5} && curl -s https://\${thumb#*//} | chafa")" || continue

  key="$(printf '%s' "$fzf" | head -n1)"
  row="$(printf '%s' "$fzf" | tail -n1)"
  vid="$(printf '%s' "$row" | cut -d"$pipe" -f1)"
  url="$(printf '%s' "$row" | cut -d"$pipe" -f4)"
  [ -n "$url" ] && [ "$url" != "NA" ] && channel="$url"

  case "$key" in
        '') case "$vid" in UC*) query="$channel"; mode='videos' ;; *) mpv -- "ytdl://$vid" ;; esac ;;
       esc) [ "$mode" != "search" ] && { query="$default"; mode='search'; } || exit 0 ;;
      left) [ "$page" -gt 1 ] && page="$((page - 1))" ;;
     right) page="$((page + 1))" ;;
    ctrl-a) yt-dlp -f bestaudio -x --audio-format='mp3' -- "$vid" ;;
    ctrl-d) yt-dlp -- "$vid" ;;
    ctrl-v) query="$channel"; mode='videos' ;;
    ctrl-c) query="$channel"; mode='shorts' ;;
    ctrl-s) query="$channel"; mode='stream' ;;
    ctrl-r) query="$channel"; mode='releas' ;;
    ctrl-q) query="$channel"; mode='podcas' ;;
    ctrl-f) query="$channel"; mode='playls' ;;
  esac
done

JAYATWD 🦚

1
2
3
4
5
6
7
8
9
#!/bin/sh

# PROJECT: Jayatwd
# UPDATES: 2026-07-28 20:14:41 JST
# LICENSE: The Unlicense (unlicense.org)

PATH="$HOME/.local/bin:$PATH"; pipe="$(printf '\037')"
type fzf mpv ffmpeg yt-dlp || exit 1; printf 'id: '; read -r id; [ -n "$id" ] || exit 2
yt-dlp --no-warnings --skip-download --flat-playlist "https://twitch.tv/$id/videos" --print "%(title)s${pipe}%(url)s" | fzf --with-nth=1 --layout='reverse' --delimiter="$pipe" | cut -d"$pipe" -f2 | xargs -r mpv

JAYATVD 🦃

#!/bin/sh

# PROJECT: Jayatvd
# UPDATES: 2026-08-06 16:47:57 JST
# LICENSE: The Unlicense (unlicense.org)

PATH="$HOME/.local/bin:$PATH"; pipe="$(printf '\037')"; mode='search'; type jq fzf mpv curl chafa ffmpeg yt-dlp || exit 1; printf 'query: '; read -r query; [ -n "$query" ] || exit 2
KEYS="$(curl -s -X POST --data 'device_type=pc' -H 'user-agent: Mozilla/5.0' 'https://platform-api.tver.jp/v2/api/platform_users/browser/create')"; UID="$(printf '%s' "$KEYS" | jq -r '.result.platform_uid')"; TOKEN="$(printf '%s' "$KEYS" | jq -r '.result.platform_token')"; [ -n "$UID" ] && [ -n "$TOKEN" ] || exit 3

while :; do
  case "$mode" in
    series) ep="$(curl -sG "https://platform-api.tver.jp/service/api/v1/callSeriesEpisodes/$sid" -H 'user-agent: Mozilla/5.0' -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'x-tver-platform-type: web' --data-urlencode "platform_uid=$UID" --data-urlencode "platform_token=$TOKEN")" || exit 4 ;;
    search) ep="$(curl -sG 'https://platform-api.tver.jp/service/api/v2/callKeywordSearch' -H 'user-agent: Mozilla/5.0' -H 'origin: https://tver.jp' -H 'referer: https://tver.jp/' -H 'x-tver-platform-type: web' --data-urlencode "keyword=$query" --data-urlencode "platform_uid=$UID" --data-urlencode "platform_token=$TOKEN")" || exit 5 ;;
  esac

  epl="$(printf '%s' "$ep" | jq -r --arg pipe "$pipe" '.result.contents[] | (.contents[]? // .) | select(.type=="episode") | .content | [ .id, .title, .seriesID, .seriesTitle, .thumbnailPath, .broadcasterName ] | join($pipe)')"; [ -n "$epl" ] || exit 6
  fzf="$(printf '%s' "$epl" | fzf --with-nth=2 --layout='reverse' --delimiter="$pipe" --prompt="tv[$mode]> " --expect='esc,ctrl-s' --preview="echo {4} {6}; thumb={5}; curl -s https://image-cdn.tver.jp/w=400\${thumb} | chafa")" || { mode='search'; continue; }

  key="$(printf '%s' "$fzf" | head -n1)"
  row="$(printf '%s' "$fzf" | tail -n1)"
  eid="$(printf '%s' "$row" | cut -d"$pipe" -f1)"
  sid="$(printf '%s' "$row" | cut -d"$pipe" -f3)"

  case "$key" in
        '') mpv -- "https://tver.jp/episodes/$eid" ;;
       esc) [ "$mode" != "search" ] && mode='search' || exit 0 ;;
    ctrl-s) [ "$mode" != "series" ] && [ -n "$sid" ] && mode='series' ;;
  esac
done

JAYAMCL ⛏️

#!/bin/sh

# PROJECT: Jayamcl
# UPDATES: 2026-08-13 07:34:33 JST
# LICENSE: The Unlicense (unlicense.org)

set -eux

PATH='/usr/sbin:/usr/bin:/sbin:/bin'
JOBS="$(command -v nproc >/dev/null 2>&1 && nproc || echo 2)"
MC_DIR="$HOME/.minecraft"; MANIFEST_URL='https://piston-meta.mojang.com/mc/game/version_manifest_v2.json'

download() {
  url="$1"; path="$2"

  [ -f "$path" ] && return 0

  mkdir -p "$(dirname "$path")"; curl -fsSL -o "$path" "$url"
}

worker_library() {
  mc_dir="$1"; url="$2"; path="$3"

  download "$url" "$mc_dir/libraries/$path"
}

worker_asset() {
  mc_dir="$1"; hash="$2"; dir="${hash%"${hash#??}"}"

  download "https://resources.download.minecraft.net/$dir/$hash" "$mc_dir/assets/objects/$dir/$hash"
}

download_version() {
  version_json="$MC_DIR/versions/$version/$version.json"
  client_jar="$MC_DIR/versions/$version/$version.jar"
  manifest_json="$MC_DIR/version_manifest.json"

  download "$MANIFEST_URL" "$manifest_json"

  version_url="$(jq -r --arg v "$version" '.versions[] | select(.id == $v) | .url' "$manifest_json")"
  if [ -z "$version_url" ]; then
    echo "unknown version: $version" >&2
    exit 2
  fi
  download "$version_url" "$version_json"

  client_url="$(jq -r '.downloads.client.url' "$version_json")"
  download "$client_url" "$client_jar"
}

download_libraries() {
  version_json="$MC_DIR/versions/$version/$version.json"

  jq -r '.libraries[]
    | select(.downloads.artifact)
    | [.downloads.artifact.url, .downloads.artifact.path]
    | @tsv' "$version_json" |
    xargs -P "$JOBS" -n 2 sh "$0" --worker-library "$MC_DIR"
}

download_assets() {
  version_json="$MC_DIR/versions/$version/$version.json"
  asset_index="$(jq -r '.assetIndex.id' "$version_json")"
  asset_json="$MC_DIR/assets/indexes/$asset_index.json"

  download "$(jq -r '.assetIndex.url' "$version_json")" "$asset_json"

  jq -r '.objects[].hash' "$asset_json" |
    xargs -P "$JOBS" -n 1 sh "$0" --worker-asset "$MC_DIR"
}

launch() {
  version_json="$MC_DIR/versions/$version/$version.json"
  client_jar="$MC_DIR/versions/$version/$version.jar"
  main_class="$(jq -r '.mainClass' "$version_json")"
  asset_index="$(jq -r '.assets' "$version_json")"

  library_classpath="$(find "$MC_DIR/libraries" -type f -name '*.jar' | paste -sd ':')"
  classpath="$client_jar:$library_classpath"

  set -- --username "$username" --version "$version" --gameDir "$MC_DIR" --assetsDir "$MC_DIR/assets" --assetIndex "$asset_index" --accessToken 0
  exec java -Duser.dir="$MC_DIR" -cp "$classpath" "$main_class" "$@"
}

main() {
  case "${1:-}" in
    --worker-library)
      shift
      worker_library "$@"
      return
    ;;
    --worker-asset)
      shift
      worker_asset "$@"
      return
    ;;
  esac

  if [ $# -lt 1 ]; then
    echo "usage: $0 <version> [username]" >&2
    exit 1
  fi

  version="$1"
  username="${2:-Player}"

  download_version
  download_libraries
  download_assets

  launch
}

main "$@"

AUTOVOL 👂️

local mp = require "mp"

local enabled = true
local FILTER = "@auto-volume:lavfi=[speechnorm=e=6.25:r=0.00001:l=1]"

local function filter()
  mp.commandv("af", "remove", FILTER)
  if enabled then
    mp.commandv("af", "add", FILTER)
  end
end

mp.add_key_binding("F1", "toggle-auto-volume", function()
  enabled = not enabled
  filter()
end)

mp.register_event("seek", filter)
mp.register_event("file-loaded", filter)

FASTMPV 👁️

local mp = require "mp"

local enabled = true
local last_start, last_end
local SPEED_SILENCE, SPEED_NORMAL = 3, 1
local FILTER = "@silence:lavfi=[silencedetect=noise=-30dB:d=1]"

local function speed(v)
  mp.set_property_number("speed", v)

  if enabled then
    mp.osd_message(string.format("Speed: %.2fx", v))
  end
end

local function check(_, meta)
  if not enabled or not meta then return end

  local s = meta["lavfi.silence_start"]
  local e = meta["lavfi.silence_end"]

  if s and s ~= last_start then
    last_start = s
    speed(SPEED_SILENCE)
  end

  if e and e ~= last_end then
    last_end = e
    speed(SPEED_NORMAL)
  end
end

local function filter()
  mp.commandv("af", "remove", FILTER)
  if enabled then
    mp.commandv("af", "add", FILTER)
  end
  last_start, last_end = nil, nil
  speed(SPEED_NORMAL)
end

mp.add_key_binding("F3", "toggle-silence-speed", function()
  enabled = not enabled
  filter()
end)

mp.register_event("seek", filter)
mp.register_event("file-loaded", filter)
mp.observe_property("af-metadata/silence", "native", check)
Edit

Pub: 05 Dec 2024 05:11 UTC

Edit: 19 Aug 2026 10:28 UTC

Views: 11583

Auto Theme: Dark