Skip to content

Instantly share code, notes, and snippets.

View Ethorbit's full-sized avatar

Ethorbit Ethorbit

View GitHub Profile
CreateConVar("ulx_afk_flagminutes", 8, FCVAR_ARCHIVE, "How many minutes an player can be AFK before being flagged as AFK.")
CreateConVar("ulx_afk_kickminutes", 10, FCVAR_ARCHIVE, "How many minutes an player can be AFK before being kicked.")
CreateConVar("ulx_afk_ignoreadmins", 1, FCVAR_ARCHIVE, "Should we ignore AFK admins? (1=yes, 0=no).")
CreateConVar("ulx_afk_kickonafk", 1, FCVAR_ARCHIVE, "Should AFK players be kicked from the server at all? (1=yes, 0=no).")
CreateConVar("ulx_afk_kickonlywhenfull", 0, FCVAR_ARCHIVE, "Should the script only kick afk players when the server is full? (1=yes, 0=no).")
local Ranks = {"superadmin", "admin", "Owner", "Admin+", "Moderator", "operator", "Co-Owner", "Server Manager"}
if SERVER then
function ulx.CheckAFK( pl )
@Ethorbit
Ethorbit / point_checkpoint.as
Created September 8, 2022 16:18
Sven Co-op Checkpoint with +use instead of Touch
/*
* point_checkpoint
* This point entity represents a point in the world where players can trigger a checkpoint
* Dead players are revived
*/
enum PointCheckpointFlags
{
SF_CHECKPOINT_REUSABLE = 1 << 0, //This checkpoint is reusable
}
@Ethorbit
Ethorbit / iptables_toggle_http.sh
Last active October 12, 2022 07:43
Toggle HTTP traffic to desired domains using iptables (For hardened systems that don't need to communicate with the outside world, but may need updates/packages)
#!/bin/bash
enable_http=-1
chain_out="HTTP_OUTPUT"
while [ -v 1 ]; do
case $1 in
-E | --enable)
enable_http=1
;;
-D | --disable)
@Ethorbit
Ethorbit / homenas.sh
Last active October 28, 2022 23:24
Personal homenas script which can add,remove,list samba users/shares and view hardware usage & temperatures.
#!/bin/bash
# Prerequisites:
# Samba server
USER_SHARE_DIR="/home" # Each user gets their own directory, choose the path for this to take place. WARNING: permissions for this directory are handled by this script, set to a subdirectory if this worries you.
SAMBA_INCLUDES_FILE="/etc/samba/includes.conf" # This is where we will inject the includes of each user's .conf file. You need to do include = <what you set this variable to> in your smb.conf file so that our changes actually work with samba.
SAMBA_USER_CONF_DIR="/etc/samba/smb.conf.d" # This directory is where the script will add each samba user entry into.
SAMBA_GUEST_USER="guest" # If you have a guest user, put it here so that it can't get removed by this script.
help()
@Ethorbit
Ethorbit / libvirt-isolate-cores.sh
Created October 28, 2022 21:52
Dynamically isolate CPU cores for each virtual machine without any conflicts using systemd
#!/bin/bash
if [ $(id -u) -ne 0 ]; then
echo "You must run this as root."
exit;
fi
IS_VERBOSE="0"
# Create temporary file to manage active core isolations (for all virtual machines)
ISOLATED_CPU_FILE="/tmp/libvirt-isolated-cpus.txt"
@Ethorbit
Ethorbit / pa-toggle-mic.sh
Last active November 1, 2022 12:34
Personal PulseAudio microphone script which also creates a loopback from host to VM guest, giving me great flexibility
#!/bin/bash
# Personal PulseAudio microphone toggle script
# Allows me to mute/unmute mic as well as send/stop sending microphone output to a virtual machine for
# maximum flexibility (e.g simultaneously using discord on linux, game voice chat on windows) and only needing to configure one mic ever
source_microphone="alsa_input.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo" # Main microphone
source_we_wanna_send_to_vm="PulseEffects_mic.monitor" # This is PulseEffects mic output (since it improves the quality of the Main microphone)
sink_wired_to_vm_sound="alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo" # A soundcard that is quite literally wired to another soundcard which is passed in a Virtual Machine. Lmao. Hey, it works..
pid_file="/tmp/pa_mic_loopback.pid" # Where the last pactl module ID will be saved to.
# Arguments
@Ethorbit
Ethorbit / mount-wait.sh
Last active November 20, 2022 14:53
Haults execution until the specified mount is valid or the specified wait duration has been reached.
#!/bin/bash
MAX_WAIT="10"
[[ -z "$1" ]] && exit 1 || MOUNT="$1"
if [[ ! -z "$2" ]]; then
reg="^[0-9]+$" && [[ ! "$2" =~ $reg ]] && exit 1
MAX_WAIT="$2"
fi
@Ethorbit
Ethorbit / yt-dlp-wrapper.sh
Created December 18, 2022 07:10
Personal wrapper script for yt-dlp with options
#!/bin/bash
maxnum="99999999"
while getopts ":c:d:a:n:" opt; do
case "$opt" in
c) content=$OPTARG ;;
d) dest=$OPTARG ;;
a) audio=$OPTARG ;;
n) maxnum=$OPTARG ;;
@Ethorbit
Ethorbit / switch-session-user.sh
Last active April 2, 2024 13:49
Switch Steam Deck desktop user with a single sudo command.
#!/bin/bash
user="$1"
if ! [[ `id "$user" 2> /dev/null` ]]; then
echo "Not a valid user" 1>&2 && exit 1
fi
if [[ `echo "$user" | grep "|"` ]]; then
echo "Username cannot have '|'" 1>&2 && exit 1
fi
@Ethorbit
Ethorbit / default-desktop.service
Created June 13, 2023 04:55
Systemd service to set the default Steam Deck desktop session
[Unit]
Description=Forces gamescope to be the desktop session on boot
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'grep gamescope /etc/sddm.conf.d/zz-steamos-autologin.conf || sudo -u deck /usr/sbin/steamos-session-select gamescope'
[Install]
WantedBy=multi-user.target