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 / AmazonS3FastDownloads.php
Last active March 7, 2021 23:53
Script for uploading files to an AWS S3 bucket and using it as a fast download server
<?php
require('aws.phar');
use Aws\S3\S3Client;
const BUCKET_NAME = '<BUCKET_NAME>';
// Requires the ListBucket, GetObject, GetObjectAcl, PutObject, PutIpConfiguration, PutInventoryConfiguration, DeleteObject, and PutObjectAcl IAM permissions
$s3 = S3Client::factory(array(
@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 / SymbolicLinkCSVSync.bat
Last active March 20, 2020 16:52
Batch script that creates symbolic links from Documents to Saved Games, to reduce clutter
@echo off
setlocal enabledelayedexpansion
set Folders=Test1,Test2
set Documents=D:\Users\Nicholas\OneDrive\Documents
set SavedGames=D:\Users\Nicholas\Saved Games
call :parse "%Folders%"
goto :eos
@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 / MergeConfigs.sh
Last active August 12, 2019 08:00
Script that merges SCP:SL configuration files with keys in-place
#!/bin/bash
scpsl=.
if [ -n "$1" ]
then
server=$1
else
server="*"
fi
@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
@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