Skip to content

Instantly share code, notes, and snippets.

@dfinnema
dfinnema / unifi_delete_vouchers.js
Created August 24, 2020 09:48
Upload file to server. Then run "mongo --port 27117 < unifi_delete_vouchers.js"
/*
* This will delete all Unifi vouchers which creation date is older then the days set.
*
* WARNING: applies to all sites
*
* Tested on Version 5.13.x
*/
// keep N-day worth of data
@dfinnema
dfinnema / Parked Domain Email Records.txt
Created November 29, 2020 22:36
SPF and DMARC TXT Records
;; TXT Records
. 1 IN TXT "v=spf1 -all"
_dmarc. 1 IN TXT "v=DMARC1; p=reject; pct=100; sp=reject;"

For those that need this functionality to work after updating to the newer version of LocalWP. You can install https://ngrok.com/. You can use the command:

Replace MYDOMAIN with your .local domain

If Using SSL

ngrok http -host-header=rewrite MYDOMAIN.local:443

If not using SSL

@dfinnema
dfinnema / Backupify TimeZone to NZ.user.js
Created March 28, 2021 22:06
UserScript for Backupify to get local DateTime Formatting
// ==UserScript==
// @name Backupify TimeZone to NZ
// @version 0.1
// @description Backupify with local DateTime's with DD/MM formating
// @match https://*.backupify.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.33/moment-timezone.min.js
// @grant GM_addStyle
@dfinnema
dfinnema / acf_set_default.php
Last active February 26, 2024 20:35
Wordpress - ACF - Adds all the fields with default values to the Post Meta for Advanced Custom Fields
/**
* Sets the ACF Fields for the specified post
* @param int $post_id
* @param string $post_type
*/
function set_post_defaults_acf($post_id=0,$post_type='') {
if ($post_id &&
$post_type &&
function_exists('update_field')
) {