This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# pretty-print system uptime | |
# get uptime and idle | |
read -r u _ < /proc/uptime | |
u=${u%.*} | |
# function to calculate and print time period | |
print_period() { | |
period_seconds="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Generate a random 32-bit number to use to pick a random | |
# IPERF3 port. Random device is overridable by setting the | |
# RAND_DEVICE environment variable. | |
RAND_DEVICE=${RAND_DEVICE:-/dev/random} | |
RAND_NUMBER=$(hexdump -n4 -e '4/4 "%u"' "${RAND_DEVICE}") | |
# IPERF3 paramaters, only dynamic parameter is IPERF3_PORT. | |
IPERF3_BIN=${IPERF3_BIN:-iperf3} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import concurrent.futures | |
import socket | |
import timeit | |
import argparse | |
REGIONS = [ # https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm | |
{"region": "Australia East", "area": "Sydney", "code": "ap-sydney-1"}, | |
{"region": "Australia Southeast", "area": "Melbourne", "code": "ap-melbourne-1"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/systemd/system/iperf3.service | |
[Unit] | |
Description=iperf3 server | |
Documentation=man:iperf3(1) | |
After=network.target auditd.service | |
[Service] | |
Type=simple | |
Restart=always | |
RestartSec=15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=PPP connection for %I | |
Documentation=man:pppd(8) | |
StartLimitIntervalSec=0 | |
Before=network.target | |
Wants=network.target | |
After=network-pre.target | |
[Service] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Ensure that WLAN interface MTU is set to the maximum | |
# permitted value to prevent issues when attached to a | |
# bridge with jumbo MTU. | |
# | |
# Do not attempt to use standard UCI configuration | |
# in /etc/config/network and set the MTU with a config | |
# of type interface. It does not work consistently | |
# and in the best case works for the first WLAN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euf -o pipefail | |
# Copyright (C) rany <[email protected]>. All rights reserved. | |
# | |
# This software is licensed to you under the GNU General Public License, | |
# version 2 (GPLv2). There is NO WARRANTY for this software, express or | |
# implied, including the implied warranties of MERCHANTABILITY or FITNESS | |
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 | |
# along with this software; if not, see |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import urllib.parse | |
from enum import Enum | |
from typing import List | |
import requests | |
BASE_URL = "https://loadshedding.eskom.co.za/LoadShedding/" | |
USER_AGENT = "ZA_LOADSHEDDING/1.0 (github.com/rany2)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Start mosh-server, but first create a port redirection in the NAT | |
# router (with UPnP) and delete that redirection again just before | |
# mosh-server exits. | |
# die -- print error on stderr and exit | |
function die { | |
echo "$@" >&2 | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
unset TERM | |
export LC_ALL=C | |
if [ "$__KEXEC_REBOOT_NOHUP" != "1" ] | |
then | |
SCRIPTPATH=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) | |
__KEXEC_REBOOT_NOHUP=1 nohup "$SCRIPTPATH/$(basename -- "$0")" "$@" > /dev/null 2>&1 </dev/null & | |
exit "$?" |
NewerOlder