Skip to content

Instantly share code, notes, and snippets.

View WTFox's full-sized avatar

A. Fox WTFox

View GitHub Profile
// assert fails the test if the condition is false.
func assert(tb testing.TB, condition bool, msg string, v ...interface{}) {
if !condition {
_, file, line, _ := runtime.Caller(1)
fmt.Printf("\033[31m%s:%d: "+msg+"\033[39m\n\n", append([]interface{}{filepath.Base(file), line}, v...)...)
tb.FailNow()
}
}
// ok fails the test if an err is not nil.
@WTFox
WTFox / postgres_queries_and_commands.sql
Created May 19, 2020 15:29 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@WTFox
WTFox / redditr.py
Created June 19, 2020 05:06
Python script to automate reddit posts
import time
import praw
USERNAME = ""
PASSWORD = ""
CLIENT_ID = ""
CLIENT_SECRET = ""
@WTFox
WTFox / dbd-launcher.ahk
Last active December 15, 2020 07:26
AHK script to run DBD in 16:9 on a widescreen monitor
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; dbd-launcher.ahk
;
; This script makes running DeadByDaylight on a widescreen monitor little less dumb.
;
; It does the following: