Skip to content

Instantly share code, notes, and snippets.

@MarceloPedra
MarceloPedra / sendy.php
Created April 30, 2016 01:34 — forked from Pross/sendy.php
Add to mu-plugins folder, auto add every new user to a sendy list. Works with default WordPress and Woocommerce registrations.
<?php
add_action( 'user_register', 'add_user_to_sendy_list' );
function add_user_to_sendy_list( $user_id ) {
$list = 'SENDY_LIST_ID';
$url = 'http://SENDY_INSTALL_URL/subscribe';
$user = get_userdata( $user_id );
$email = $user->data->user_email;
$name = $user->data->user_nicename;
# First create a dump of your MySQL database
mysqldump -u [user] -p database_name > database_name.sql
# Convert the data
iconv -f iso-8859-15 -t utf8 database_name.sql > database_name_iconv.sql
# Import the database
mysql -u [user] -p database_name < database_name_iconv.sql
# If you still have some specific characters that do not display
@MarceloPedra
MarceloPedra / Linux Static IP
Created April 25, 2016 19:25 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@MarceloPedra
MarceloPedra / chmod.sh
Created April 25, 2016 19:24 — forked from carlosleopoldo/chmod.sh
Commands to chmod all directories except files (recursively) and chmod all files except directories (recursively)
# To recursively give directories read & execute privileges
chmod 755 $(find /path/to/base/dir -type d)
# To recursively give files read privileges
chmod 644 $(find /path/to/base/dir -type f)
@MarceloPedra
MarceloPedra / delete-orphans-postmeta.sql
Created April 25, 2016 19:24 — forked from carlosleopoldo/delete-orphans-postmeta.sql
Delete all orphans post meta in WordPress Raw
DELETE FROM wp_postmeta
WHERE post_id NOT IN (
SELECT ID FROM wp_posts
);
@MarceloPedra
MarceloPedra / delete-orphans-commentmeta.sql
Created April 25, 2016 19:24 — forked from carlosleopoldo/delete-orphans-commentmeta.sql
Delete all orphans comments meta in WordPress
DELETE FROM wp_commentmeta
WHERE comment_id NOT IN (
SELECT comment_id FROM wp_comments
);
@MarceloPedra
MarceloPedra / delete-orphans-usermeta.sql
Created April 25, 2016 19:22 — forked from carlosleopoldo/delete-orphans-usermeta.sql
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)