All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Register

Login

All New Register Login

nuno

Joined 4 months ago

Recently created
Least recently created
Recently updated
Least recently updated
All gists 582

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 const {
2 Client,
3 GatewayIntentBits,
4 ButtonBuilder,
5 ButtonStyle,
6 ActionRowBuilder,
7 EmbedBuilder,
8 } = require("discord.js");
9 const cron = require("node-cron");
10

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function wgctl::dispatch() {
2 local raw_cmd="${1:-help}"
3 shift || true
4
5 local cmd
6 cmd="$(wgctl::resolve_alias "$raw_cmd")"
7
8 case "$cmd" in
9 help) wgctl::help; return ;;
10 shell) : ;;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 def config_load(file):
2 """
3 Load wgctl.json and output KEY=value pairs for all config fields.
4 Automatically handles nested sections — add fields to JSON, they appear here.
5 """
6 import os
7 if not os.path.exists(file):
8 return
9 try:
10 with open(file) as f:

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 def accept_aggregate(file, net_file, clients_dir, since='',
2 filter_peer='', external_only='0'):
3 """
4 Aggregate accept events per peer — total bytes, packets, top destinations.
5 Used by wgctl activity to show accepted traffic alongside drops.
6
7 external_only='1': only show traffic to external IPs (non-private)
8 external_only='0': only show traffic to internal IPs (default)
9
10 Output:

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function ui::activity::service_row() {
2 local dest_display="${1:-}" drop_count="${2:-0}" drop_word="${3:-drops}" \
3 drops_col="${4:-30}" w_drops="${5:-1}"
4
5 # Align drop count with peer drop column
6 # Service row visible prefix: " → " (6 visible) + ${#dest_display}
7 # But "→" is 3 bytes, 1 visible — arrow_prefix bytes = 8, visible = 6
8 local arrow_prefix=" → "
9 local prefix_bytes=${#arrow_prefix} # 8 bytes due to → being 3 bytes
10 local prefix_len=$(( prefix_bytes + ${#dest_display} ))

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1
2 function cmd::activity::run() {
3 local filter_peer="" filter_service="" filter_ip="" filter_type=""
4 local hours=24 dropped_only=false
5 local accept_only=false drop_only=false external_only=false
6
7 while [[ $# -gt 0 ]]; do
8 case "$1" in
9 --peer) filter_peer="$2"; shift 2 ;;
10 --service) filter_service="$2"; shift 2 ;;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function ui::activity::peer_row() {
2 local name_pad="${1:-}" rx_pad="${2:-}" tx_pad="${3:-}" \
3 drops="${4:-0}" drop_word="${5:-drops}" w_drops="${6:-1}"
4
5 printf " \033[1m%s\033[0m \033[2m↓\033[0m%s \033[2m↑\033[0m%s %${w_drops}s %s\n" \
6 "$name_pad" "$rx_pad" "$tx_pad" "$drops" "$drop_word"
7 }
8
9 function ui::activity::peer_row_table() {
10 local name="${1:-}" rx_fmt="${2:-}" tx_fmt="${3:-}" \

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::activity::run() {
2 local filter_peer="" filter_service="" filter_ip="" filter_type=""
3 local hours=24 dropped_only=false
4 local accept_only=false drop_only=false external_only=false
5
6 while [[ $# -gt 0 ]]; do
7 case "$1" in
8 --peer) filter_peer="$2"; shift 2 ;;
9 --service) filter_service="$2"; shift 2 ;;
10 --ip) filter_ip="$2"; shift 2 ;;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 root@wireguard:/etc/wireguard/wgctl# wgctl activity
2
3 ────────────────────────────────────────────────
4 Activity Monitor (last 24h)
5 ────────────────────────────────────────────────
6
7 desktop-roboclean ↓14MB ↑509MB 0 drops
8
9 laptop-nuno ↓270MB ↑217MB 0 drops
10 laptop-nuno ↓ 585KB ↑ 187KB 810 conns

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2 # activity.command.sh — WireGuard activity snapshot
3
4 # ============================================
5 # Lifecycle
6 # ============================================
7
8 function cmd::activity::on_load() {
9 load_module net
Newer Older

Powered by Opengist ⋅ Load: 99ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ KrilHub