Skip to content

Instantly share code, notes, and snippets.

@r-a-y
r-a-y / cuemaker.py
Last active April 6, 2024 16:28 — forked from joshbarrass/cuemaker.py
Python code to generate cue sheets (.cue files) from YouTube timestamps
"""
A script for automatically generating CUE files from a list of timestamps and titles, like
those commonly seen in YouTube descriptions.
Usage:
python cuemaker.py --output="Filename without extension" "timestamps.txt" "Album name" "Artist name"
"timestamps.txt" should be a text file containing a list of timestamps and titles like:
00:00 Track 1
@r-a-y
r-a-y / _readme.md
Last active February 12, 2024 09:03
Using Git for Windows (PortableGit) with a portable HOME directory

Prologue

I develop on Windows (yeah, I hear your jeers, linux users!), so to use Git, I use Git for Windows

However, I use Git For Windows (portable version) so I can keep my dev environment centrally located. This is so I can reuse this environment simply by copying my msysgit directory to a USB drive.

Installation

@r-a-y
r-a-y / blogs.php
Last active March 15, 2017 20:28
Modify SQL query for BP's Sites Directory
<?php
/**
* Modify BP's site query for non-super-admins.
*/
add_action( 'bp_include', function() {
// If you're doing checks against More Privacy Options, make sure MPO is active.
if ( ! class_exists( 'ds_more_privacy_options' ) ) {
return;
}
@r-a-y
r-a-y / _bp_rbe_imap_object_cache.php
Last active July 28, 2016 22:21
BP Reply By Email - IMAP Object Cache extension. Replaces the default filesystem IMAP locking system in RBE with a persistent object cache.
<?php
/*
Plugin Name: BP Reply By Email - IMAP Object Cache extension
Description: Replaces the default filesystem IMAP locking system in RBE with a persistent object cache.
Author: r-a-y
Author URI: http://profiles.wordpress.org/r-a-y
License: GPLv2 or later
*/
/*
@r-a-y
r-a-y / bp-page-title.php
Created June 13, 2016 05:53
Use page title as set in admin area on BP directory pages.
/**
* Use page title for BP directory pages.
*/
function my_set_bp_page_title() {
// Check to see if current reset post is a BP directory; if not, bail.
if ( false == in_array( $GLOBALS['post']->ID, bp_core_get_directory_page_ids() ) ) {
return;
}
// Use WP page title for the_title().
@r-a-y
r-a-y / xmlrpc.php
Created May 13, 2016 23:19
Block all XMLRPC requests on WordPress
<?php
// Put this in /wp-content/mu-plugins/.
add_action( 'plugins_loaded', function() {
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && false !== strpos( $_SERVER['SCRIPT_NAME'], '/xmlrpc.php' ) ) {
// Reject with 403.
header( 'HTTP/1.1 403 Forbidden' );
exit;
}
}, 0 );
@r-a-y
r-a-y / gestures.js
Last active February 20, 2016 22:14
Mouse gestures script for the Conkeror browser - http://conkeror.org
// Mouse Gestures for Conkeror by r-a-y.
//
// Modified from the Mouse Gestures By Sing Chu userscript:
// http://userscripts-mirror.org/scripts/show/162193
var BTN_RIGHT = 2;
var SENSITIVITY = 15; //Pixels moved until gesture is registered
var startX;
var startY;
var gesture = "";
@r-a-y
r-a-y / cbox-distro
Last active August 29, 2015 14:21
CBOX wp.org distro bash script
#!/bin/bash
# CBOX wp.org distro script
#
# Before using:
# 1. Ensure that 1.0.x branch has pinned all plugins to latest version.
# 2. Checkout a new branch for wp.org. @todo decide on a branch name.
# 3. Create the following folder - 'includes/zip'
#
# Next, run this bash script.
@r-a-y
r-a-y / warnings.php
Last active August 17, 2023 11:46
Suppress warnings created by certain plugins and themes in WordPress.
/**
* Suppress errors generated by specified WordPress plugins.
*
* Put this in /wp-content/mu-plugins/
*
* @param string $errno The error number.
* @param string $errstr The error message.
* @param string $errfile Path to the file that caused the error.
* @param int $errline Line number of the error.
* @return bool True to suppress error reporting; false to use default error handler.
@r-a-y
r-a-y / wp-ms-login.php
Last active May 17, 2016 12:12
WordPress - Redirects login attempts from sub-sites to the main site to login. Supports mapped domains created by WPMU Domain Mapping.
<?php
/**
* Get login URL.
*
* If redirect URL is passed, this function attempts to see if the redirect
* is using a mapped domain. If so, we switch out the mapped domain with the
* original subdomain and force logins from the main site.
*
* @param string $redirect_to The redirect URL