Skip to content

Instantly share code, notes, and snippets.

@scmc
scmc / tableprefix_dump
Created January 22, 2013 00:08
dump all tables with a specific table prefix in MySQL
mysqldump -u root -pPASSWORD DATABASENAME `echo "show tables like 'TABLEPREFIX_%';" | mysql -u root -pPASSWORD DATABASENAME | sed '/Tables_in/d'` > db.dump
@scmc
scmc / gist:b84bb224a5a4d138a5c0
Last active August 29, 2015 14:20
WordPress .htaccess security rules
### Start Security Rules
# Stop spam attack logins and comments
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .(wp-comments-post|wp-login)\.php*
RewriteCond %{HTTP_REFERER} !.*(example.ubc.ca|.ubc.ca).* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://0.0.0.0/$ [R=301,L]
</ifModule>