Skip to content

Instantly share code, notes, and snippets.

@PatPeter
PatPeter / ttt2roles.cfg
Last active September 10, 2021 06:37
TTT2 Role Configuration Master List
//
// AMNESIAC
// https://steamcommunity.com/sharedfiles/filedetails/?id=2001213453&searchtext=ttt2+role
//
// enable or disable this role
ttt_amnesiac_enabled 0
// the percentage of players that are spawned as this role
ttt_amnesiac_pct 0.17
// the limit of players that spawn as this role each round, this overwrites the percentage
ttt_amnesiac_max 1
@PatPeter
PatPeter / Code.gs
Created March 26, 2020 02:24
Zis to English Translator 1.5
function TRANSLATE_TO_ENGLISH(text) {
return translate('zi_en', text);
}
function TRANSLATE_TO_ZIS(text) {
return translate('en_zi', text);
}
@PatPeter
PatPeter / form.gs
Created March 25, 2020 17:31
Zisian to English Translator
/**
* A special function that inserts a custom menu when the spreadsheet opens.
*/
function onOpen() {
//var menu1 = [{name: 'Translate from Zisian to English', functionName: 'translateZisianToEnglish_'}];
//var menu2 = [{name: 'Translate from English to Zisian', functionName: 'translateEnglishToZisian_'}];
//SpreadsheetApp.getActive().addMenu('Translate Zisian-English', menu1);
//SpreadsheetApp.getActive().addMenu('Translate English-Zisian', menu2);
// https://developers.google.com/apps-script/reference/spreadsheet/sheet#getdatarange
@PatPeter
PatPeter / PatreonValidation.sh
Last active October 7, 2019 07:22
Validates the PatreonRanks.csv file with a CSV downloaded from Patreon
#!/bin/bash
echo -en "" > ReservedSlots.txt
echo "76561197974998697 # PatPeter" >> ReservedSlots.txt
echo "76561198096889432 # 11 Corgis on a Computer" >> ReservedSlots.txt
#echo "76561198309869930 # LostInMyThoughts" >> ReservedSlots.txt
#echo "76561198005366267 # Roartex" >> ReservedSlots.txt
echo "76561198170933298 # Craz" >> ReservedSlots.txt
#echo "76561198098544254 # SentinelBlue" >> ReservedSlots.txt
#echo "76561198201989204 # TheBlade" >> ReservedSlots.txt
@PatPeter
PatPeter / scoreboard_colors.lua
Last active May 11, 2019 08:43
Set name and karma colors for TTT scoreboards using TTTScoreboardColorForPlayer and TTTScoreboardColumns
local namecolor = {
dev = Color(100, 240, 105, 255), -- light green
superadmin = Color(220, 180, 0, 255), -- gold
admin = Color(255, 0, 0, 255), -- red
supermod = Color(0, 255, 0, 255), -- green
moderator = Color(0, 0, 255, 255), -- blue
trial = Color(255, 128, 0, 255), -- orange
member = Color(128, 0, 192, 255), -- purple
regular = Color(0, 255, 255 ,255), -- light blue
default = COLOR_WHITE,
@PatPeter
PatPeter / VerifyConfig.sh
Created May 5, 2019 07:33
Verifies that config files are symlinked in each server directory.
#!/bin/bash
servers=( scp1 scp2 scp3 scp4 scp5 scp6 scp7 scp8 )
for s in ${servers[@]}
do
if [ -d "servers/$s" ]
then
rm -f servers/$s/config_gameplay.txt
ln -s ~/scp/servers/$s/config.txt ~/scp/servers/$s/config_gameplay.txt
echo Created symbolic link servers/$s/config_gameplay.txt
@PatPeter
PatPeter / unigamia.bootloader.sh
Last active April 14, 2019 04:41
Bootloader and Initialization scripts for Unigamia game servers
#!/bin/bash
servername=
read -p "Please enter the name of the server... " servername
if [ -z $servername ]
then
echo "Server name must be provided!"
exit
fi
@PatPeter
PatPeter / FixServerLogsDates.sh
Created February 28, 2019 00:56
Applies the Last Modified timestamp in a filename to the file itself
#!/bin/bash
# Finished 2019-01-05 04:41 PM
# https://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file
# Takes files with date format
# Round 2018-07-10 12.42.38.txt
# And applies this date to the Last Modified date of the file
find ServerLogs/Round* -print | while read filename
do
if [ "$filename" = "ServerLogs" ]
@PatPeter
PatPeter / fixbackups.sh
Created October 21, 2018 00:44
Fix cPanel backups returned with format %m.%d.%Y_%H-%M-%S
#!/bin/bash
backups=~/backups
suffix=_website
cd $backups
for file in `ls $backups`
do
if [[ $file == "backup-"* && $file == *"$suffix.tar.gz" ]]
then
dt=$file
@PatPeter
PatPeter / MAServerStatistics.sh
Last active August 12, 2019 06:48
Scans MultiAdmin files for Steam IDs and aggregates on a per-day and per-day/SteamID basis
#!/bin/bash
scpsl=.
regex='^\[([0-9]+:[0-9]+:[0-9]+)\] Accepted authentication token of user ([0-9]+) with global ban status ([0-9]) signed by ([A-Za-z0-9 ]+) server\.$'
for dir in $scpsl/servers/*
do
if [ ! -d $dir ]
then
continue