Skip to content

Instantly share code, notes, and snippets.

View chrisdavidmiles's full-sized avatar
💙

Chris David Miles chrisdavidmiles

💙
View GitHub Profile
@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'; } );
@chrisdavidmiles
chrisdavidmiles / .htaccess
Last active July 6, 2017 07:16
Prevent POST requests to wp-login.php
<Files "wp-login.php">
ErrorDocument 403 default
RewriteCond %{REQUEST_METHOD} POST
RewriteRule .* - [F,L]
</Files>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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 / 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 / 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
@chrisdavidmiles
chrisdavidmiles / bitnami_aws_wordpress_image_setup_notes.md
Last active December 7, 2021 18:06
Bitnami AWS WordPress Image Setup Notes
@chrisdavidmiles
chrisdavidmiles / 720p.sh
Last active January 19, 2022 01:41
A utility for resizing windows from the command line on OSX.
#!/usr/bin/env bash
#
# 720p
# A utility for resizing windows from the command line on OSX.
# Taken from: https://lostechies.com/derickbailey/2012/09/08/screencasting-tip-resize-your-app-to-720p-1280x720-in-osx/
# Archived copy: https://archive.is/5kr9m
# Archived code: https://gist.github.com/chrisdavidmiles/1b786c4ea62e1883ba31117ca357a838
#
echo "Setting $1 bounds to 720p"
@chrisdavidmiles
chrisdavidmiles / 404.html
Created April 30, 2022 03:06
Internet Explorer 4 - Default 404 Page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>404 - Page Not Found</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" />
<style type="text/css">
<!--
body { background-color: white; color: black; }
#container { width: 400px; }