Skip to content

Instantly share code, notes, and snippets.

@gboudreau
gboudreau / wordpress-retry-failed-wp_mail.md
Last active March 23, 2024 17:50
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 / 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.
@uraimo
uraimo / dnsovertls.md
Last active May 27, 2024 18:17
Configure your Mac to use DNS over TLS
@sivel
sivel / better-ssh-authorized-keys-management.md
Last active October 3, 2024 16:46
Better SSH Authorized Keys Management

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@andrewbranch
andrewbranch / autoshrink.js
Last active July 31, 2019 22:07
Responds to window resize events. Max font size taken from initial font size (specify with CSS).
(function($) {
function getTextWidth($element) {
var tester = $("<div/>").text($element.text())
.css({ "position": "absolute", "float": "left", "white-space": "nowrap", "visibility": "hidden", "font": $element.css("font"), "text-transform": $element.css("text-transform"), "letter-spacing": $element.css("letter-spacing") })
.appendTo($element.parent()),
width = tester.innerWidth();
tester.remove();
return width;
}
@gboudreau
gboudreau / mount_shares_locally
Last active September 14, 2020 03:57
mount_shares_locally for Fedora/CentOS
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mount_shares_locally
# Required-Start: $network $local_fs $remote_fs smb mysqld
# Required-Stop: $network $local_fs $remote_fs smb
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mount Samba shares locally
### END INIT INFO
@gboudreau
gboudreau / mount_shares_locally
Last active September 14, 2020 03:57
mount_shares_locally for Ubuntu/Debian
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mount_shares_locally
# Required-Start: $network $local_fs $remote_fs samba
# Required-Stop: $network $local_fs $remote_fs samba
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mount Samba shares locally
### END INIT INFO