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 / 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 / mysql-debug.sql
Last active September 23, 2021 14:50
MySQL Debug Cheatsheet
-- These are mostly MySQL Specific commands.
-- probe your query log settings. This will show you if its on or not and where its going (db or file)
SHOW VARIABLES LIKE 'general%'
;
-- saves the query log to a table in mysql. This is usually easier to get to.
SET GLOBAL log_output = 'table'
;
@derak-kilgo
derak-kilgo / rd-class-text-extraction.php
Created August 4, 2020 22:48 — forked from nickrouty/rd-class-text-extraction.php
Class for extraction the text from doc, docx, xlsx, pptx and wrapper for 3rd party pdf to text library.
<?php
/**
* Class RD_Text_Extraction
*
* Example usage:
*
* $response = RD_Text_Extraction::convert_to_text($path_to_valid_file);
*
* For PDF text extraction, this class requires the Smalot\PdfParser\Parser class.
@derak-kilgo
derak-kilgo / list-remote-tags.sh
Last active May 13, 2020 16:15
List the 5 most recent tags in a remote git repo without cloning it.
#!/bin/bash
git ls-remote --tags --refs --sort="v:refname" git@github.com:sebastianbergmann/phpunit.git | tail -n5 | sed 's/.*\///'
@derak-kilgo
derak-kilgo / md5.js
Created September 17, 2019 16:09 — forked from vor0nwe/md5.js
/*
* http://www.myersdaily.org/joseph/javascript/md5-text.html
*/
(function (global) {
var md5cycle = function (x, k) {
var a = x[0],
b = x[1],
c = x[2],
d = x[3];
@derak-kilgo
derak-kilgo / diy-activation-link.php
Created May 10, 2019 15:46
An example creating an activation link which allows you to set your own password.

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; }