Skip to content

Instantly share code, notes, and snippets.

View Buzut's full-sized avatar

Buzut

View GitHub Profile
@Buzut
Buzut / sync-users-orders.php
Created November 5, 2020 12:59
Link WooCommerce guest orders to existing customer account and create account if no user matches order billing email
<?php
// Make sure to allow a sufficient amount of ram to load all orders in memory
define('WP_MEMORY_LIMIT', '512M');
// Load WordPress core & plugins
require_once('wp-load.php');
// Get all completed orders
$query = new WC_Order_Query([
'type' => 'shop_order',
@Buzut
Buzut / checks.json
Last active July 21, 2016 12:31
Sensu servers metrics alert
{
"checks": {
"serverAlert": {
"command": "/etc/sensu/plugins/serverMetricsAlert.js",
"interval": 60,
"handlers": ["default"],
"subscribers": ["monit"]
}
}
@Buzut
Buzut / httpd.sh
Last active March 29, 2019 13:56
Various simple Sensu checks
#!/bin/bash
# check if given host returns HTTP status 200
# usage: httpd.sh [host:port]
# ex: httpd localhost:3000
# if no arguments, default to localhost:80
if [ -z "$1" ]
then
httpd=`curl -s -D - localhost -o /dev/null | sed -n '/HTTP/p'`
@Buzut
Buzut / handlers.json
Last active June 30, 2017 17:21
Sensu handler for InfluxDB
{
"handlers": {
"influxdb": {
"type": "pipe",
"comman": "/etc/sensu/handlers/influx.js"
}
}
}