Skip to content

Instantly share code, notes, and snippets.

View chrisdavidmiles's full-sized avatar
💙

Chris David Miles chrisdavidmiles

💙
View GitHub Profile
@ka215
ka215 / wp-emergency.php
Created June 16, 2017 14:39
This is the tool for WordPress to manually deactivate any plugins and rollback to default theme.
<?php
/**
* WordPress Emergency Tools v1.0
*
* This is a tool to manually deactivate a theme and any plugins when you can not
* access the admin panel due to WordPress theme or plugins bug etc.
* Usage it please place this file in the same directory as "wp-config.php" and
* access it directly from the browser.
* Please delete this file promptly after use (If this file will remain, it will
* be a serious security hole for your service).
@nitrag
nitrag / convert_m4b.sh
Last active July 9, 2025 01:54
Audibook convert m4b to mp3. This will split into chaptered mp3 files and automatically reconfigure proper ID3v2 tags.
#!/bin/bash
#
# sudo apt-get install id3v2 ffmpeg
#
# USAGE:
# cd /book title/
# bash ~/this_script_path.sh
# rm *.m4b (you need to manually remove the original in case something goes wrong)
#
#
@gschoppe
gschoppe / gjs-disable-attachment-pages.php
Last active January 18, 2024 13:49
WordPress plugin to properly disable attachment pages. This is not a redirect or forced 404. Attachment pages will simply not exist, and the slug will remain available for other posts and pages..
<?php if( ! defined( 'ABSPATH' ) ) { die(); }
/**
* Plugin Name: Disable Attachment Pages
* Plugin URI: https://gschoppe.com/wordpress/disable-attachment-pages
* Description: Completely disable attachment pages the right way. No forced redirects or 404s, no reserved slugs.
* Author: Greg Schoppe
* Author URI: https://gschoppe.com/
* Version: 1.0.0
**/
@dikiaap
dikiaap / git-io-custom-url.md
Last active July 6, 2025 12:12
git.io custom URL

Update: As of 11 January 2022, git.io no longer accepts new URLs.

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
@Tras2
Tras2 / cloudflare-ddns-update.sh
Last active August 18, 2025 04:46
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# 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
@robwent
robwent / check-upload-filename.php
Created March 17, 2019 16:29
Stops WordPress uploading images if the filename contains certain words.
<?php
/*
Plugin Name: Check Upload Filename
Plugin URI: https://www.robertwent.com/
Description: Prevents image uploads by filename
Version: 1.0
Author: Robert Went
*/
add_filter('wp_handle_upload_prefilter', 'check_for_lazy_people_uploads' );
@nbonfire
nbonfire / mysubaru.py
Created May 20, 2019 15:49
MySubaru python samples
import requests, json
from subarucreds import username,password,pin # just a "subarucreds.py" that has some variables i didn't want to share
import datetime
#login
s=requests.Session()
loginr=s.post('https://www.mysubaru.com/login', data = {'username':username,'password':password})
#should return a response 200
#Where's my subaru?
<?php
$text = "NAVID";
$image = imagecreatefrompng('image.png');
$textColor = imagecolorallocate($image, 255, 255, 254);
$white = imagecolorallocate($image, 255, 255, 255);
$col_transparent = imagecolorallocatealpha($image, 255, 255, 255, 127);
imagefill($image, 0, 0, $col_transparent);
@wpmu-authors
wpmu-authors / skeleton.php
Created February 8, 2021 13:26
skeleton.php
add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function register_my_dashboard_widget() {
wp_add_dashboard_widget(
'my_dashboard_widget',
'My Dashboard Widget',
'my_dashboard_widget_display'
);
}