Skip to content

Instantly share code, notes, and snippets.

@dantheman213
dantheman213 / Xbox Controller (Gamepad).txt
Last active February 19, 2023 03:24
Wii U CEMU Xbox Controller Profiles
# Wii U / Cemu Xbox controller profile
# Located at: cemu\controllerProfiles
[General]
emulate = Wii U GamePad
api = XInput
controller = 0
[Controller]
rumble = 0
@dantheman213
dantheman213 / exponential_backoff.go
Last active December 10, 2022 16:10
Golang exponential back off simple example
package main
import "fmt"
import "time"
import "math"
var exponentialBackoffCeilingSecs int64 = 14400 // 4 hours
func main() {
fmt.Println("Hello World")
@dantheman213
dantheman213 / Tomb Raider 1.cfg
Created September 29, 2022 02:02
Tomb Raider (1996) PC JoyToKey Xbox One controller config
[General]
FileVersion=69
NumberOfJoysticks=2
NumberOfButtons=32
DisplayMode=2
UseDiagonalInput=0
UseDiagonalInput2=0
UsePOV8Way=0
RepeatSameKeyInSequence=0
Threshold=20
@dantheman213
dantheman213 / word-scramble.pl
Created September 28, 2022 20:40
word scramble solver
#!/usr/bin/perl
use strict;
use warnings;
#
# Complete the 'SearchForWord' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts following parameters:
@dantheman213
dantheman213 / timeDiff.go
Created August 3, 2022 20:26
Golang get time diff from a, b, formatted pretty
// e.g. returns 00:00:25
func getTimeDiff(a, b time.Time) string {
d := b.Sub(a)
hour := int(d.Seconds() / 3600)
minute := int(d.Seconds() / 60) % 60
second := int(d.Seconds()) % 60
return fmt.Sprintf("%02d:%02d:%02d", hour, minute, second)
}
@dantheman213
dantheman213 / import_db_structure.sh
Last active April 19, 2022 13:12
Batch import all *.sql files in a folder recursively into your Postgres or PostgreSQL database
#!/bin/sh
# AUTHOR
# DANIEL E. GILLESPIE (2016)
# https://github.com/dantheman213
# DESCRIPTION
# Import all *.sql files in a folder recuresively into your PostgreSQL database
# Batch export all table schemas and stored functions with this script located here:
#!/usr/bin/env bash
# ex: ./charles_convert_raw_hexdump_to_bin.sh hexdumpraw.txt hexformatted.txt data.bin
# hexdumpraw.txt ex:
## 00000510 0a 6d 6f 64 65 6c 5f 6e 61 6d 65 12 07 4e 65 78 model_name Nex
## 00000520 75 73 20 35 1a 20 0a 11 61 72 63 68 69 74 65 63 us 5 architec
## 00000530 74 75 72 65 5f 6e 61 6d 65 12 0b 61 72 6d 65 61 ture_name armea
## 00000540 62 69 2d 76 37 61 1a 19 0a 0b 64 65 76 69 63 65 bi-v7a device
## 00000550 5f 6e 61 6d 65 12 0a 68 61 6d 6d 65 72 68 65 61 _name hammerhea
@dantheman213
dantheman213 / youtube-dl_cheatsheet.md
Last active January 23, 2022 01:40
youtube-dl best way to download video or entire to high quality mp3

youtube-dl cheat sheet

Docs and Binary for youtube-dl are located here:

https://github.com/rg3/youtube-dl/

Install dependencies

apt-get install libav-tools ffmpeg # Linux (either one of either should do) brew install ffmpeg # OSX choco install ffmpeg # Windows

@dantheman213
dantheman213 / PostgresFunctionsCheatsheetReadme.md
Last active January 11, 2022 18:15
PostgreSQL & PL/pgSQL Stored Functions Cheatsheet

PostgreSQL & PL/pgSQL Stored Functions Cheatsheet

Boiler-plate stored function

CREATE OR REPLACE FUNCTION public.sp_user_ins_status(status smallint)
  RETURNS integer
  LANGUAGE plpgsql
AS $function$