Skip to content

Instantly share code, notes, and snippets.

@gboudreau
gboudreau / wordpress-retry-failed-wp_mail.md
Last active February 20, 2024 01:49
Retry failed emails sent by Wordpress

Wordpress plugin to retry failed emails

When using Wordpress wp_mail() function, there is no easy way to schedule retries, when the email fails to be sent.
There is probably a few plugins available that could handle this, but I didn't find any that would just do that.
And so, I decided to code it myself.

Of note: I added this code to a custom (unpublished) plugin I maintain. If you don't have your own plugin to add this to, either Google how to create your own Wordpress plugin, or use one of the numerous available plugins that allows you to inject (PHP) code in your Wordpress installation. As a last resort, you could add this code in your functions.php

How to catch failed emails

@gboudreau
gboudreau / smb411-nsstest.patch
Last active May 21, 2022 02:38
Patch required to compile Samba 4.11.x on recent Ubuntu systems
--- a/nsswitch/nsstest.c 2019-12-06 06:46:56.000000000 -0300
+++ b/nsswitch/nsstest.c 2020-09-11 18:35:27.199949579 -0300
@@ -137,7 +137,7 @@
return &pwd;
}
-static void nss_setpwent(void)
+static void nss_setpwent2(void)
{
NSS_STATUS (*_nss_setpwent)(void) =
@gboudreau
gboudreau / nest-api-php-workaround-login.php
Last active January 15, 2020 04:38
Manually create cache file required for nest-api to work with Nest accounts (not Google accounts). Ref: https://github.com/gboudreau/nest-api/issues/110
<?php
echo "\nInstructions:\n";
echo " - Login to https://home.nest.com in your browser\n";
echo " - Once logged in, using the same tab, go to https://home.nest.com/session\n";
echo " - Copy-paste the text (JSON) here (then press ENTER):\n\n";
$json = readline();
$o = json_decode($json);
echo "\nThanks!\n\n";
@gboudreau
gboudreau / profile-tabs-for-um-fix-for-latest-um.diff
Created September 5, 2019 11:13
Diff to fix Ultimate Member Profile Tabs (profile-tabs-for-ultimate-member) for Ultimate Member 2.0.53 and later
diff -rbc a/profile-tabs-for-ultimate-member/core.php b/profile-tabs-for-ultimate-member/core.php
*** a/profile-tabs-for-ultimate-member/core.php 2018-09-29 16:05:06.000000000 -0400
--- b/profile-tabs-for-ultimate-member/core.php 2019-08-30 00:00:02.000000000 -0400
***************
*** 7,13 ****
add_action( 'init', array( $this, 'create_cpt' ) );
add_action( 'admin_menu', array( $this, 'add_admin_page' ) );
add_action( 'template_redirect', array( $this, 'show_profile_tab_content' ), 20 );
! add_filter( 'um_profile_tabs', array( $this, 'add_profile_tabs' ), 9000 );
}
@gboudreau
gboudreau / duplicacy-monitoring.php
Last active May 19, 2018 02:43
duplicacy monitoring of incoming backups - email notifications when 3d / 7d without backup
#!/usr/bin/php
<?php
/*
Instructions:
- Download this script from : https://gist.githubusercontent.com/gboudreau/91b8866e3adb19965897ecd80a12525b/raw/duplicacy-monitoring.php
- Make it executable: chmod +x duplicacy-monitoring.php
- Obtain the Duplicacy CLI from https://github.com/gilbertchen/duplicacy/releases
- Configure the script by modifying the variables below.
# HG changeset patch
# Parent 60085c8f01fe4eb19a1c38a2d27fd77698b5a5ec
Issue #24363: Add policy flag to avoid parsing HTTP header as email body
diff -r 60085c8f01fe Lib/email/errors.py
--- a/Lib/email/errors.py Thu Sep 08 22:37:34 2016 -0400
+++ b/Lib/email/errors.py Mon Jan 23 23:39:53 2017 +0000
@@ -55,8 +55,9 @@
class MissingHeaderBodySeparatorDefect(MessageDefect):
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active March 19, 2024 07:19 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@gboudreau
gboudreau / _etc_ssh_sshd_config
Created May 11, 2016 20:10
Fix GitKraken not being able to pull/push from my gogs.io repos
# GitKraken needs diffie-hellman-group14-sha1
#KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
@gboudreau
gboudreau / nissan-connect-encryption.php
Last active June 27, 2020 17:27
Nissan Connect API encryption using PHP
<?php
function encrypt($password, $key = 'uyI5Dj9g8VCOFDnBRUbr3g') {
$size = @call_user_func('mcrypt_get_block_size', MCRYPT_BLOWFISH);
if (empty($size)) {
$size = @call_user_func('mcrypt_get_block_size', MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
}
$password = pkcs5_pad($password, $size);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB), MCRYPT_RAND);
$passcrypt = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $password, MCRYPT_MODE_ECB, $iv);
@gboudreau
gboudreau / NissanConnectEncryption.java
Created March 18, 2016 13:57
Nissan Connect API encryption using Java
package me.netlift.mobile.activities;
import android.util.Base64;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class NissanConnectEncryption {