Skip to content

Instantly share code, notes, and snippets.

View derak-kilgo's full-sized avatar

Derak Kilgo derak-kilgo

View GitHub Profile
@derak-kilgo
derak-kilgo / confetti.js
Created March 4, 2026 18:30
xss confetti
<script>
(function () {
// Avoid double-injection
if (window.__confettiRunning) return;
window.__confettiRunning = true;
// Create canvas
var cv = document.createElement('canvas');
var ctx = cv.getContext('2d');
cv.style.position = 'fixed';
@derak-kilgo
derak-kilgo / card-deck.php
Created January 16, 2026 14:59
Deck of cards with emoji.
$deck = [
'SPA'=>['suite'=>'spade','value'=>'ace', 'char'=>'U+1F0A1'],
'SP2'=>['suite'=>'spade','value'=>'2', 'char'=>'U+1F0A2'],
'SP3'=>['suite'=>'spade','value'=>'3', 'char'=>'U+1F0A3'],
'SP4'=>['suite'=>'spade','value'=>'4', 'char'=>'U+1F0A4'],
'SP5'=>['suite'=>'spade','value'=>'5', 'char'=>'U+1F0A5'],
'SP6'=>['suite'=>'spade','value'=>'6', 'char'=>'U+1F0A6'],
'SP7'=>['suite'=>'spade','value'=>'7', 'char'=>'U+1F0A7'],
'SP8'=>['suite'=>'spade','value'=>'8', 'char'=>'U+1F0A8'],
@derak-kilgo
derak-kilgo / check-tweak.sh
Created April 14, 2025 18:23
check for common kernel network settings in RHEL 5 and 6
#!/bin/bash
echo Tweaking the linux kernel...
echo disable pmtu discovery
echo /proc/sys/net/ipv4/ip_no_pmtu_disc:
cat /proc/sys/net/ipv4/ip_no_pmtu_disc
echo recommended value is 1
echo enable workaround when broken window scaling is detected.
@derak-kilgo
derak-kilgo / stranger_things.sketch
Created December 1, 2017 20:13
An arduino sketch for "stranger things" style message wall with ALITOVE WS2811 RGB LED Pixel Lights. http://a.co/bxTfwT6
//@see http://www.woodlandmanufacturing.com/articles/news/how-to-make-a-stranger-things-alphabet-sign-with-lights-code
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 50
#define DATA_PIN 5
#define BRIGHTNESS 255
// Define the array of leds
#!/bin/bash
# Make sure only root can run our script
FILE="/tmp/out.$$"
GREP="/bin/grep"
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@derak-kilgo
derak-kilgo / noip-update.sh
Created June 25, 2015 19:20
noip.com cli update script
#!/bin/bash
# Updates ip address in the noip DDNS serivce.
# Assumes curl + gnu tools
# Param descriptions taken from API docs.
# http://www.noip.com/integrate/request
#Config
@derak-kilgo
derak-kilgo / testsmtp.sh
Last active May 18, 2023 21:36
Test SMTP with telnet using bash.
#!/bin/bash
#
# Solution based on https://stackoverflow.com/a/11988455/119829
# Thank you balanv.
#
base_domain=test.example.com;
command -v telnet >/dev/null 2>&1 || { echo >&2 "I require telnet but it's not installed. Aborting."; exit 1; }
@derak-kilgo
derak-kilgo / post2log.php
Created February 24, 2022 22:10
post2log - tool to debug anything that sends data via POST request with php
<?php
$file = __DIR__ . DIRECTORY_SEPARATOR . 'post2log.txt';
$post = $_POST;
if(!empty($post)){
$post['timestamp'] = date('r');
file_put_contents($file,print_r($post,true),FILE_APPEND);
http_response_code(202);
print_r($post);
}else{
http_response_code(405);
@derak-kilgo
derak-kilgo / mp4-to-gif.php
Created August 17, 2016 18:30
Convert a mp4 clip into a gif with php, imagemagick and ffmpeg. From OSX, these are easy to install with homebrew.
<?php
$video = __DIR__ . '/video.mp4';
$fps = 4;
# Convert an MP4 to a GIF - Requires ffmpeg
`ffmpeg -i "$video" -pix_fmt rgb24 -r $fps "$video.gif"`
# optimize the gif - Requires imagemagick
# via http://superuser.com/questions/436056/how-can-i-get-ffmpeg-to-convert-a-mov-to-a-gif
@derak-kilgo
derak-kilgo / wordpress-config-extract.php
Last active October 29, 2021 14:16
Extract database and other constants from a wp-config.php file without "including" it.
<?php
/**
* Extract key and value from all "define" constants in a wp-config.php file using built-in php tokenizer functions.
* Does not "include" the file so it won't pollute the current scope or cause side effects.
*
* NOTE: Works with constants defined as string, bool or number
* Method can extract values from statements like:
* define( 'DB_NAME', 'wordpress' );
* define('WP_DEBUG', true);
* define('SOMEINT', 1234567);