Skip to content

Instantly share code, notes, and snippets.

View mobber007's full-sized avatar
🎯
Focusing

mobber007 mobber007

🎯
Focusing
View GitHub Profile
@mobber007
mobber007 / ubuntu_install.sh
Created February 11, 2023 00:30 — forked from nginx-gists/ubuntu_install.sh
Automating Installation of WordPress with NGINX Unit on Ubuntu
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ];then
>&2 echo "This script requires root level access to run"
exit 1
fi
if [ -z "${WORDPRESS_DB_PASSWORD}" ]; then
>&2 echo "WORDPRESS_DB_PASSWORD must be set"
>&2 echo "Here is a random one that you can paste:"
@mobber007
mobber007 / add-to-cart.php
Created March 4, 2021 14:11 — forked from lukecav/add-to-cart.php
WooCommerce Quantity Before Add to Cart and Product Update
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@mobber007
mobber007 / Command
Created January 22, 2021 13:07 — forked from lukecav/Command
Delete ActionScheduler comments and scheduled-action post types in WooCommerce using WP-CLI
wp comment list --field=comment_ID --'comment_author'='ActionScheduler' --number=1000 | xargs wp comment delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 | xargs wp post delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=trash | xargs wp post delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=cancel | xargs wp post delete --force
@mobber007
mobber007 / disable-comments.sh
Created January 13, 2021 10:24 — forked from jplhomer/disable-comments.sh
Disable all comments/pings in WordPress with WP-CLI
$ wp post list --format=ids | xargs wp post update --comment_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...
@mobber007
mobber007 / php-pools.md
Created December 9, 2020 11:18 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@mobber007
mobber007 / functions.php
Created May 9, 2020 14:35 — forked from butlerblog/functions.php
SMTP using wp-config.php for settings
<?php // Don't use this line.
/**
* This function will connect wp_mail to your authenticated
* SMTP server. This improves reliability of wp_mail, and
* avoids many potential problems.
*
* For instructions on the use of this script, see:
* https://www.butlerblog.com/2013/12/12/easy-smtp-email-wordpress-wp_mail/
*
@mobber007
mobber007 / install-ispconfig-nginx-ubuntu.sh
Created April 1, 2020 17:07
Install Nginx ISPConfig3 Ubuntu 18.04 64Bits
#!/bin/bash
## Install ISPConfig3 on Ubuntu 18.04 64Bits
## Author: Nilton OS blog.linuxpro.com.br
## http://blog.linuxpro.com.br/posts/instalando-ispconfig3-no-ubuntu-1404.html
## https://www.howtoforge.com/community/threads/perfect-server-for-ubuntu-16-but-with-nginx-instead-of-apache-socket-permission-issues.72883/
## https://www.howtoforge.com/tutorial/perfect-server-ubuntu-18-04-nginx-bind-dovecot-and-ispconfig-3/
## Reconfigure Dash
echo "dash dash/sh boolean false" | debconf-set-selections
{{-- Define all our servers --}}
@servers(['staging' => '', 'production' => ''])
@setup
{{-- The timezone your servers run in --}}
$timezone = 'Europe/Amsterdam';
{{-- The base path where your deployments are sitting --}}
$path = '/var/www/site.com/htdocs';
@mobber007
mobber007 / two-way-binding.js
Created May 8, 2019 11:24 — forked from straker/two-way-binding.js
Simple and small two-way data binding between DOM and data
/**
* @param {object} scope - Object that all bound data will be attached to.
*/
function twoWayBind(scope) {
// a list of all bindings used in the DOM
// @example
// { 'person.name': [<input type="text" data-bind="person.name"/>] }
var bindings = {};
// each bindings old value to be compared for changes