Skip to content

Instantly share code, notes, and snippets.

View chrisdavidmiles's full-sized avatar
💙

Chris David Miles chrisdavidmiles

💙
View GitHub Profile
@chrisdavidmiles
chrisdavidmiles / wp-config.php
Created July 1, 2017 21:26
Dynamically set WordPress home and siteurl
define('WP_SITEURL', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']);
@chrisdavidmiles
chrisdavidmiles / tor-redirect.js
Created July 3, 2017 22:52
Detect Tor Browser users and redirect them to the .onion version of my site.
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
chrisdavidmiles / functions.php
Created July 5, 2017 17:41
Reduce Jetpack wp-cron usage
add_filter( 'jetpack_sync_incremental_sync_interval', function() { return 'hourly'; } );
add_filter( 'jetpack_sync_full_sync_interval', function() { return 'daily'; } );
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrisdavidmiles
chrisdavidmiles / bulk_dig.sh
Last active September 9, 2024 16:48
Bulk DNS Lookup bash script
#!/bin/bash
# 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='1.1.1.1' # Is using Cloudflare's 1.1.1.1.
#
@chrisdavidmiles
chrisdavidmiles / PostMessageToSlackChannel.php
Created June 6, 2020 22:06 — forked from nadar/PostMessageToSlackChannel.php
Post a message to a slack channel with PHP
<?php
/**
* Send a Message to a Slack Channel.
*
* In order to get the API Token visit: https://api.slack.com/custom-integrations/legacy-tokens
* 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
chrisdavidmiles / wmms.sh
Created September 24, 2021 04:54
Windows Movie Maker Shitposting Script
#!/usr/bin/env bash
#
# Windows Movie Maker Shitposting Script by @chrisdavidmiles
#
# This script generates a video of text in the style of 2007 era Windows Movie
# Maker youtube tutorials. I'm not really sure why I made this script tbh.
#
# This script requires ffmpeg and imagemagick to run.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@chrisdavidmiles
chrisdavidmiles / continue.sh
Created October 13, 2021 04:11
Press ENTER to continue (bash)
continue_prompt () {
echo "Press ENTER to continue"
read -n 1 confirm
if [ ! "$confirm" = "" ]; then
exit
fi
}
@chrisdavidmiles
chrisdavidmiles / bitnami_aws_wordpress_image_setup_notes.md
Last active December 7, 2021 18:06
Bitnami AWS WordPress Image Setup Notes
@chrisdavidmiles
chrisdavidmiles / cloudflare-ddns-update.sh
Last active November 29, 2021 18:45 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/usr/bin/env bash
#
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
zone=example.com