Skip to content

Instantly share code, notes, and snippets.

View chrisdavidmiles's full-sized avatar
💙

Chris David Miles chrisdavidmiles

💙
View GitHub Profile
@ryandonsullivan
ryandonsullivan / stop-rss-feed-crawl
Created March 22, 2023 14:21
Stop web crawlers from spending crawl budget on RSS feeds, without interrupting RSS feed functionality.
# Block Feed and Comments
User-agent: *
Disallow: /feed/
Disallow: /feed/$
Disallow: /comments/feed
Disallow: /trackback/
Disallow: */?author=*
Disallow: */author/*
Disallow: /author*
Disallow: /author/
@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'
);
}
<?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);
@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?
@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' );
@Tras2
Tras2 / cloudflare-ddns-update.sh
Last active March 26, 2024 10:38
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
@dikiaap
dikiaap / git-io-custom-url.md
Last active August 5, 2023 04:21
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
@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
**/
@nitrag
nitrag / convert_m4b.sh
Last active March 3, 2024 12:45
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)
#
#