Skip to content

Instantly share code, notes, and snippets.


Chris David Miles chrisdavidmiles

View GitHub Profile
chrisdavidmiles / PostMessageToSlackChannel.php
Created Jun 6, 2020 — forked from nadar/PostMessageToSlackChannel.php
Post a message to a slack channel with PHP
View PostMessageToSlackChannel.php
* Send a Message to a Slack Channel.
* In order to get the API Token visit:
* The token will look something like this `xoxo-2100000415-0000000000-0000000000-ab1ab1`.
* @param string $message The message to post into a channel.
* @param string $channel The name of the channel prefixed with #, example #foobar
chrisdavidmiles /
Last active Apr 15, 2021
Bulk DNS Lookup bash script
# Bulk DNS Lookup
# Generates a CSV of DNS lookups from a list of domains.
# File name/path of domain list:
domain_list='domains.txt' # One FQDN per line in file.
# IP address of the nameserver used for lookups:
ns_ip='' # Is using Cloudflare's
View onion.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Simple socket server using threads
import socket
import sys
HOST = '' # Symbolic name, meaning all available interfaces
PORT = 8888 # Arbitrary non-privileged port
chrisdavidmiles / functions.php
Created Jul 5, 2017
Reduce Jetpack wp-cron usage
View functions.php
add_filter( 'jetpack_sync_incremental_sync_interval', function() { return 'hourly'; } );
add_filter( 'jetpack_sync_full_sync_interval', function() { return 'daily'; } );
chrisdavidmiles / tor-redirect.js
Created Jul 3, 2017
Detect Tor Browser users and redirect them to the .onion version of my site.
View tor-redirect.js
var myoniondomain = 'chrisdm326o2d7iq.onion';
var thecurrentdomain = window.location.hostname;
if (myoniondomain != thecurrentdomain) {
function isTorBrowser() {
var img = document.createElement('img');
img.src = 'data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==';
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
var ctx = canvas.getContext('2d');
chrisdavidmiles / wp-config.php
Created Jul 1, 2017
Dynamically set WordPress home and siteurl
View wp-config.php
define('WP_HOME', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']);
chrisdavidmiles / functions.php
Created Jun 14, 2017
Disable WordPress password authentication. User/Pass combination will always return false, even if correct password is used. Use only if alternate login methods are in place.
View functions.php
remove_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
chrisdavidmiles / functions.php
Created Jun 14, 2017
Disable WordPress password reset notification email
View functions.php
add_filter( 'send_email_change_email', '__return_false' );
chrisdavidmiles / .htaccess
Created Jun 13, 2017
301 redirect http:// to https:// for specified domain
View .htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www.)?example\.com$
RewriteRule ^(.*)$ "https\:\/\/example\.com\/$1" [R=301,L]