Skip to content

Instantly share code, notes, and snippets.

@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 / CleanLogs.sh
Last active September 22, 2018 22:35
Removes extraneous lines from SCP: Secret Laboratory logs to prevent gigabytes of log accumulation
#!/bin/bash
# Copyright (c) 2018, Nicholas Solin
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
@PatPeter
PatPeter / ServerStatistics.sh
Last active August 25, 2018 20:46
Scans SCP:SL files for Steam IDs and aggregates on a per-day and per-day/SteamID basis
#!/bin/bash
scpsl=.
for dir in $scpsl/servers/*
do
if [ ! -d $dir ]
then
continue
fi
@PatPeter
PatPeter / TeamSpeak3GameStatistics.php
Created May 1, 2017 04:19
Scans TeamSpeak 3 logs for "Last played" chat messages and prints out two CSVs
<?php
$prefix = 'D:\\Users\\Nicholas\\AppData\\Roaming\\TS3Client\\chats\\M1dQMnhKRVE3RHBjd3luMTdCcG8xOVBpMUZ3PQ==';
$years = array('2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017');
$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
$filename = 'channel_';
$extension = '.txt';
$games = array();
@PatPeter
PatPeter / TeamSpeak3ChatLogSplitter.php
Last active April 13, 2017 00:53
Divides channel.html/txt and server.html/txt files into folders by year and files by month
<?php
$directories = array('M1dQMnhKRVE3RHBjd3luMTdCcG8xOVBpMUZ3PQ==_2012-03-18', 'M1dQMnhKRVE3RHBjd3luMTdCcG8xOVBpMUZ3PQ==_2012-11-05/M1dQMnhKRVE3RHBjd3luMTdCcG8xOVBpMUZ3PQ==', 'M1dQMnhKRVE3RHBjd3luMTdCcG8xOVBpMUZ3PQ==_2013-11-10/M1dQMnhKRVE3RHBjd3luMTdCcG8xOVBpMUZ3PQ==', 'M1dQMnhKRVE3RHBjd3luMTdCcG8xOVBpMUZ3PQ==');
$filenames = array('channel', 'server');
$extensions = array('.html', '.txt');
foreach ($directories as $directory) {
foreach ($filenames as $filename) {
foreach ($extensions as $extension) {
$sourceFile = fopen($directory . '/' . $filename . $extension, 'r');
@PatPeter
PatPeter / GameTrackerProtocolConverter.php
Last active December 4, 2016 08:16
GameTracker HTTP to HTTPS banner converter
<?php
const DEBUG = false;
const BANNER_PATH = '/gametracker';
function convert_banner($url) {
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $url);
@PatPeter
PatPeter / GTAVLocalFix.bat
Created January 23, 2016 21:47
Fixes the Local剜捯獫慴⁲慇敭屳呇⁁屖湥楴汴浥湥⹴湩潦 file created by GTAV
chcp 65001
move "%USERPROFILE%\AppData\Local剜捯獫慴⁲慇敭屳呇⁁屖湥楴汴浥湥⹴湩潦" "%USERPROFILE%\AppData\Local\Rockstar Games\GTA V\entitlement.info"
mklink "%USERPROFILE%\AppData\Local剜捯獫慴⁲慇敭屳呇⁁屖湥楴汴浥湥⹴湩潦" "%USERPROFILE%\AppData\Local\Rockstar Games\GTA V\entitlement.info"
attrib +h +s "%USERPROFILE%\AppData\Local剜捯獫慴⁲慇敭屳呇⁁屖湥楴汴浥湥⹴湩潦" /l
@PatPeter
PatPeter / CustomClasses.reg
Last active September 18, 2016 23:35
Collection of Windows registry keys for game files
Windows Registry Editor Version 5.00
; <<< acffile
[HKEY_CLASSES_ROOT\.acf]
@="acffile"
"Content Type"="text/plain"
"PerceivedType"="text"
[HKEY_CLASSES_ROOT\acffile]
@="App Cache File"