Skip to content

Instantly share code, notes, and snippets.

@nosoop
nosoop / RouteDumper.php
Created December 17, 2015 08:04
List routes in Slim 3
class RouteDumper extends \Slim\Router {
public static function getAllRoutes($app) {
return $app->getContainer()->get('router')->routes;
}
}
// Pass instance of \Slim\App() to function
$routes = RouteDumper::getAllRoutes($app);
@nosoop
nosoop / localization_db.py
Created January 14, 2016 13:45
Pull localized strings from TF2's language files and stick them into an sqlite database
import vdf
import sqlite3
import os
# Prereq:
# pip install vdf
GAME_DIR = r'/path/to/tf'
LANGUAGE_DB = GAME_DIR + '/addons/sourcemod/data/sqlite/language-db.sq3'
@nosoop
nosoop / koth_vanguard_rc1.ugc510126304.cfg
Created May 30, 2016 04:36
Stripper:Source fix for point capturing in koth_vanguard
; koth_vanguard_rc1.ugc510126304.cfg -- Fixes control point not capturing.
modify:
{
match:
{
"hammerid" "11142821"
}
insert:
{
@nosoop
nosoop / tar_dry_run.sh
Created July 5, 2016 09:50
test to see what files would be added to a tarball
#!/bin/bash
tar cvf - -C / /srv/ 2>&1 > /dev/null | less
@nosoop
nosoop / nginx-sites
Last active July 29, 2016 14:28
Site configuration manager for nginx.
#!/usr/bin/python3
# This script allows slightly easier management of nginx vhosts.
import sys, os, argparse, subprocess
SUDO_BIN = '/usr/bin/sudo'
NGINX_CONF = '/etc/nginx/'
SITES_AVAILABLE = 'sites-available/'
@nosoop
nosoop / community-quickplay-us-west.txt
Created August 1, 2016 17:49
US-West filter results for Community Quickplay
$ ./master_query.py
430 servers to query, hoo boy
('45.32.72.105', 27035) 0/24 b'EVGA Gaming | Capture The Flag | LA'
('199.230.104.4', 27015) 0/24 b'NewbsTF2.com #05 NO CLASS LIMITS (24/7 2Fort) [Koans Kingdom]'
('24.4.131.124', 27084) 0/24 b'USA.VM4GAME.COM_TF2_ORIGINAL_#84'
('74.91.118.10', 27015) 0/32 b'Jadatness Gaming'
('174.29.191.67', 27015) 0/24 b"Kraken's Breath"
('66.150.214.212', 27015) 0/24 b'Cafe of Broken Dreams'
('24.4.131.124', 27083) 0/24 b'USA.VM4GAME.COM_TF2_ORIGINAL_#83'
@nosoop
nosoop / tf2ii_tests.sp
Created September 6, 2016 16:15
A few tests to make sure quirks are worked out.
#pragma semicolon 1
#include <sourcemod>
#include <tf2itemsinfo>
#pragma newdecls required
#define PLUGIN_VERSION "0.0.0"
public Plugin myinfo = {
name = "[TF2] TF2ItemsInfo Tests",
/**
* Adds another punch angle to the player view.
*
* Equivalent to CBasePlayer::ViewPunch(const QAngle &angleOffset)???
*/
stock void AddPlayerViewPunch(int client, const float vecAngleOffset[3]) {
float vecAnglePlayer[3], vecAngleAdditive[3];
GetEntPropVector(client, Prop_Data, "m_vecPunchAngleVel", vecAnglePlayer);
@nosoop
nosoop / dump_sorted_datamaps.awk
Last active October 28, 2016 02:55
awk script to dump datamaps by entity name to individual files
BEGIN {
output_filename="";
}
match($0, /^[A-Za-z0-9_]+ - [A-Za-z0-9_]+$/) {
output_filename= ($0 ".txt");
print ("Starting dump of " $0);
}
{
if (output_filename != "") {
print $0 > output_filename;
@nosoop
nosoop / spray_disabler.sp
Last active November 24, 2016 10:14
Hooks the spray command, disabling its use.
/**
* Disables the spray command.
*/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools_hooks>
#pragma newdecls required