Skip to content

Instantly share code, notes, and snippets.

View goodmuyis's full-sized avatar
🏠
Working from home

goodmuyis

🏠
Working from home
View GitHub Profile
@goodmuyis
goodmuyis / linux-usb-file-copy-fix.md
Created December 29, 2020 21:10 — forked from 2E0PGS/linux-usb-file-copy-fix.md
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

@goodmuyis
goodmuyis / export-single-day.php
Created August 20, 2020 21:46 — forked from birgire/export-single-day.php
WordPress Plugin: Enhance the native XML export - with a single day selection
<?php
/**
* Plugin Name: Single Day Posts Export
* Plugin URL: http://wordpress.stackexchange.com/a/199527/26350
* Plugin Author: Birgir Erlendsson (birgire)
* Version: 0.0.1
*/
/**
* Add our extra HTML
@goodmuyis
goodmuyis / htaccess-redirect-load-images-from-production
Created January 9, 2020 14:57 — forked from rxnlabs/htaccess-redirect-load-images-from-production
htaccess - Redirect image and file request from the localhost to the production host if the file does not exist on the localhost. Needs to be placed in the root htaccess if you're using WordPress or another system that redirects all request to a index.php file.
#place above all other rewrite rules if using a cms or program that redirects all request to index.php file (e.g. WordPress, Drupal, Laravel, etc...)
#if a file or directory does not exist on the local host, 302 redirect the request to the production host so the browser doesn't cache the file in case you replace the file locally
<IfModule mod_rewrite.c>
RewriteEngine On
#Redirect WordPress uploads
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*)$ http://www.example.com/wp-content/uploads/$1 [R=302,L,NC]
#Redirect Nextgen Gallery uploads
@goodmuyis
goodmuyis / mysql-docker.sh
Created October 4, 2019 11:03 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@goodmuyis
goodmuyis / pmpro_ngn_currency_format.php
Last active February 16, 2019 20:21 — forked from ideadude/pmpro_xof_currency_format.php
Add Nigerian Naira currency to Paid Memberships Pro
<?php
/**
* Add Nigerian Naira currency to Paid Memberships Pro
* Add this code into a custom plugin. https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_ngn_currency_format( $pmpro_currencies ) {
$pmpro_currencies['XOF'] = array(
'name' => __( 'Nigerian Naira', 'paid-memberships-pro' ),
'decimals' => '2',
'thousands_separator' => ',',
@goodmuyis
goodmuyis / um_function.php
Last active January 30, 2019 17:20 — forked from dave-mills/example.php
Example Callback function for Ultimate Member dropdown field
function getCities() {
//get the value from the 'parent' field, sent via the AJAX post.
$choice = $_POST['parent_option'];
//Depending on the value of $choice, return a different array.
switch($choice) {
case "France":
$cities = [
"Paris" =>"Paris",