Skip to content

Instantly share code, notes, and snippets.

View ianthekid's full-sized avatar

Ian Ray ianthekid

View GitHub Profile
@ianthekid
ianthekid / gist:2b3bb2ad751a3558739f
Created February 25, 2015 06:19
Repair Permissions CentOS / Apache
find . -type d -exec chmod 755 {} + ; find . -type f -exec chmod 644 {} +
@ianthekid
ianthekid / gist:b1d17a6208589dd1d421
Created February 25, 2015 06:18
Delete orphan wp_postmeta rows
SELECT *
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@ianthekid
ianthekid / gist:17eee00d0d19045e31a7
Created February 15, 2015 19:08
Wordpress update database for staging
/*
* Wordpress Staging/Development
*/
UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL');
@ianthekid
ianthekid / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/*
* Cron job: Backup database
* Works with cPanel Cron Scheduler
*/
mysqldump -u $user -p$password -h $dbhost $database > /path/to/db_bak_`date +\%Y\%m\%d`.sql
@ianthekid
ianthekid / gist:f070fb8374d117b3ff39
Created October 16, 2014 15:17
Create multi-part tar archives of large directory
/*
* Create multi-part archive of ./www/
*/
tar czf - www|split -b 1073741824 - www_backup.tar.
/*
* Extract multi-part archive
@ianthekid
ianthekid / gist:7b4d3fbf0e3ea74378ec
Created October 16, 2014 15:13
mysql export and import via ssh
/*
* Export database
*/
mysqldump -u $username -p -h $host $database > database_backup.sql
/*
* Import database
<div id='woobox-root'></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//woobox.com/js/plugins/woo.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'woobox-sdk'));</script>