Skip to content

Instantly share code, notes, and snippets.

Ryan Underdown underdown

Block or report user

Report or block underdown

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@underdown
underdown / wp-post-revisions.sql
Created Dec 12, 2019
Grab revisions from a wordpress post/page
View wp-post-revisions.sql
# Find the initial post id by looking at a revision and then seeing what the post parent is. CHandler is 814
SELECT * FROM `wp_posts` WHERE `post_parent` = "814" ORDER BY ID DESC
@underdown
underdown / cloudflare-letsencrypt-ubuntu-16.04.sh
Created Feb 13, 2019
set up auto renewing lets encrypt cert on a website behind cloudflare on ubuntu 16.04
View cloudflare-letsencrypt-ubuntu-16.04.sh
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python-certbot-apache
sudo apt install python3-pip
sudo pip3 install certbot-dns-cloudflare
sudo touch ~/cloudflare.txt
sudo printf 'dns_cloudflare_email = user@mail.com \n
@underdown
underdown / sendy.sql
Last active Nov 14, 2018
some queries
View sendy.sql
INSERT INTO subscribers (email, name, list, confirmed)
SELECT email, name, "1", "1" FROM tmp1;
UPDATE `subscribers` SET `list`=3, `confirmed`=1 WHERE 1
INSERT INTO subscribers (email, name, list, confirmed)
SELECT email, name, "1", "1" FROM tmp1
@underdown
underdown / oc-orders-products.sql
Created Nov 8, 2018
Add product details to orders data in opencart
View oc-orders-products.sql
SELECT
*
FROM
oc_order o
LEFT JOIN
oc_order_product op
ON (o.order_id = op.order_id)
WHERE EXISTS (
SELECT
*
@underdown
underdown / queryCustomers.php
Created Oct 19, 2018
OpenCart query select all orders
View queryCustomers.php
SELECT
*
FROM
oc_order o
LEFT JOIN
oc_customer oc
ON (o.customer_id = oc.customer_id)
WHERE EXISTS (
SELECT
*
View affiliate-tracking.php
<?php
foreach($_GET as $k=>$v)
$affline=$affline."&".urlencode($k)."=".urlencode($v);
$affline=substr($affline,1);
?>
//place this at the very top of the page
//decorate links with: <a href="http://mydomain.com/?<?php echo $affline; ?>">link</a>
@underdown
underdown / dkim-gen.sh
Created Jul 18, 2018
generate dkim keys
View dkim-gen.sh
mkdir /opt/dkim-keys
chmod 700 /opt/dkim-keys
pushd /opt/dkim-keys
openssl genrsa -out news.healinghempproducts.com.key 2048 # private key mailtrain.example.com.key
openssl rsa -in news.healinghempproducts.com.key -out news.healinghempproducts.com.pub -pubout -outform PEM # public key mailtrain.example.com.pub
@underdown
underdown / mailtrain-install.sh
Last active Jul 18, 2018
edited mailtrain setup script enabling verp bounce handling and setting smtp port to 25
View mailtrain-install.sh
#!/bin/bash
# This installation script works on Ubuntu 14.04 and 16.04
# Run as root!
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
View mysql-reset-root-pass
sudo /etc/init.d/mysql stop
sudo mysqld --skip-grant-tables &
mysql -u root mysql
UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
View gist:11f016e486f68b4045c8d5edd3cdf7d9
sudo apt-get update && sudo apt-get upgrade
sudo apt-get update
sudo apt-get install pwgen
curl https://gist.githubusercontent.com/underdown/7445a9c7deaba590b879d37a895263e3/raw/43d1c7e72efcdfb08a3aaf6e5abab2c9ac43b481/mailtrain-install.sh | sudo bash
You can’t perform that action at this time.