Все Новый

user:thomas фрагментов создано пользователем

title:mygist фрагментов с указанным заголовком

description:sync gists with given description

filename:myfile.txt фрагменты содержащие файлы с указанным именем

extension:yml фрагменты, содержащие файлы с указанным расширением

language:go фрагменты, содержащие файлы с указанным языком

topic:homelab фрагменты с заданной темой

all:systemctl search all fields

Регистрация

Войти

Все Новый Регистрация Войти

nuno

Зарегистрирован 2 months ago

Свежие сверху по дате создания
Свежие снизу по дате создания
Свежие сверху по дате обновления
Свежие снизу по дате обновления
Все фрагменты 570

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 core
2 |-- app
3 | |-- context.sh
4 | |-- core.sh
5 | |-- json.sh
6 | `-- json_helper.py
7 |-- core.sh
8 |-- framework
9 | |-- color.sh
10 | |-- command.sh

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 data=$(json::activity_aggregate \
2 "$(ctx::fw_events_log)" "$(ctx::events_log)" \
3 "$(config::interface)" "$(ctx::net)" \
4 "$(ctx::clients)" "$(ctx::meta)" \
5 "$hours" "$filter_peer" "$service_ip" "$exclude_str" 2>/dev/null)
6 fi
7
8 local accept_data=""
9 if ! $drop_only; then
10 local since_arg="" ext_flag="0"

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 def activity_aggregate(fw_file, wg_file, wg_interface, net_file,
2 clients_dir, meta_dir, hours, filter_peer,
3 filter_service_ip):
4 """
5 Aggregate activity data for wgctl activity.
6 Output:
7 peer|name|rx_bytes|tx_bytes|drop_count
8 service|peer_name|dest_display|drop_count
9 """
10 hours = int(hours) if hours else 24

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 #!/usr/bin/env bash
2 # ui/activity.module.sh — rendering for wgctl activity
3
4 # ui::activity::peer_row <name_pad> <rx_pad> <tx_pad> <drops> <drop_word> <w_drops>
5 function ui::activity::peer_row() {
6 local name_pad="${1:-}" rx_pad="${2:-}" tx_pad="${3:-}" \
7 drops="${4:-0}" drop_word="${5:-drops}" w_drops="${6:-1}"
8
9 printf " \033[1m%s\033[0m \033[2m↓\033[0m%s \033[2m↑\033[0m%s %${w_drops}s %s\n" \
10 "$name_pad" "$rx_pad" "$tx_pad" "$drops" "$drop_word"

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 root@wireguard:/etc/wireguard/wgctl# sed -n '/dest_display/,/accept_dest_row/p' \
2 /etc/wireguard/wgctl/commands/activity.command.sh | head -20
3 local dest_display
4 local raw_suffix=""
5 local resolved="${_DEST_RESOLVE_CACHE[$spec]:-${d_ip}:${d_port}/${d_proto}}"
6 local dest_display="$resolved"
7 if [[ "$show_ports" == "true" && "$resolved" != "${d_ip}:"* && "$resolved" != "${d_ip} "* ]]; then
8 # Append dim raw IP:port — use printf to expand ANSI
9 dest_display=$(printf "%s \033[2m(%s:%s)\033[0m" "$resolved" "$d_ip" "$d_port")
10 fi

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 _render_peer_accept_dests() {
2 local peer_name="$1"
3 local keys="${_ACCEPT_DEST_KEYS[$peer_name]:-}"
4 [[ -z "$keys" ]] && return 0
5 for d_key in $keys; do
6 local dest_stats="${_ACCEPT_DEST[$d_key]:-}"
7 [[ -z "$dest_stats" ]] && continue
8 local d_bytes_orig d_bytes_reply d_count
9 IFS='|' read -r d_bytes_orig d_bytes_reply d_count <<< "$dest_stats"
10 local rest_key="${d_key#${peer_name}:}"

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 local filter_peer="" filter_service="" filter_ip="" filter_type=""
2 local hours=24
3 local accept_only=false drop_only=false external_only=false
4
5 while [[ $# -gt 0 ]]; do
6 case "$1" in
7 --peer) filter_peer="$2"; shift 2 ;;
8 --service) filter_service="$2"; shift 2 ;;
9 --ip) filter_ip="$2"; shift 2 ;;
10 --type) filter_type="$2"; shift 2 ;;

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month ago
1 const {
2 Client,
3 GatewayIntentBits,
4 ButtonBuilder,
5 ButtonStyle,
6 ActionRowBuilder,
7 EmbedBuilder,
8 REST,
9 Routes,
10 SlashCommandBuilder,

nuno / gistfile1.txt

0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 month 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) : ;;
Новее Позже

Работает на Opengist ⋅ Load: 108ms⋅

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