Skip to content

Instantly share code, notes, and snippets.

View derak-kilgo's full-sized avatar

Derak Kilgo derak-kilgo

View GitHub Profile

Keybase proof

I hereby claim:

  • I am derak-kilgo on github.
  • I am derak (https://keybase.io/derak) on keybase.
  • I have a public key ASCWPamiL3ZKgx9LtL9AHPnU7x5ULNBZy8gHyqB8R1QVego

To claim this, I am signing this object:

@derak-kilgo
derak-kilgo / apache-redirect.conf
Created February 18, 2019 15:36
Apache mod_rewrite - Send requests for missing images to another server.
#Often the test system is using a subset of our live data. We don't include media in those copies.
#In QA; Rewrite missing images to the live server.
RewriteEngine On
#RewriteBase / #Use this if your placing this in a .htaccess file.
RewriteCond %{REQUEST_URI} \.(jpe?g|bmp|png)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ https://somelivedomain.test/$1 [L,R=302]
@derak-kilgo
derak-kilgo / slack-night-mode-custom.css
Last active February 13, 2019 15:11 — forked from sandheepgr/slack-night-mode-custom.css
Night mode css file for slack
body { background: #404040; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #404040; }
@derak-kilgo
derak-kilgo / adhoc-profiler.php
Created February 12, 2019 21:13
A ad-hoc method profiler for locating slow code in a legacy environment without xdebug.
<?php
function stopwatch($key){
static $log;
static $tstart;
$returnVal = 0.0;
if(empty($log)){
$log = array();
}
@derak-kilgo
derak-kilgo / ssl-skip-peer-verify.php
Created July 10, 2018 20:56
A plugin for local dev to disable ssl peer verification on SSL sites.
/*
Plugin Name: Skip SSL Verify
Plugin URI: http://www.damiencarbery.com
Description: Skip SSL verify in curl downloads - fixes: Download failed. error:0D0890A1:asn1 encoding routines:func(137):reason(161).
Author: Damien Carbery
Version: 0.1
*/
function ssv_skip_ssl_verify($ssl_verify) {
return false;
@derak-kilgo
derak-kilgo / divi-disable-maps.php
Created July 10, 2018 20:36 — forked from lots0logs/child-functions.php
WordPress :: Divi Builder :: Disable Google Maps
<?php
/**
* @package Divi_Disable_Maps
* @version 1.0
*/
/*
Plugin Name: Divi Disable Maps
Description: Enable only if you are not using the map module. Fixes "Google Maps JavaScript API warning: NoApiKeys" wanring in the console.
Author: lots0logs
Author URI: https://gist.github.com/lots0logs/67d639070dc54505eef1
@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);
<?php
/**
* @author https://stackoverflow.com/users/308825/maerlyn
* Based off the one in Symfony's Jobeet tutorial.
*/
function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
@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
@derak-kilgo
derak-kilgo / gitolite-to-gogs.php
Last active August 10, 2017 22:18
A script to load gitolite's bare git repositories into gogs database.
#!/usr/bin/env php
<?php
/* A tool to import repos from gitolite to gogs (db version 17)
*
* Gogs and gitolite use bare repos when hosting your repositories.
* You can add repositories directly into the gogs-repo directory but gogs won't see
* them until they are also added to the database.
*
* This script adds entries into the repository, access, watch and team_repo tables.