Skip to content

Instantly share code, notes, and snippets.

gboudreau / nest-api-php-workaround-login.php
Last active Jan 15, 2020
Manually create cache file required for nest-api to work with Nest accounts (not Google accounts). Ref:
View nest-api-php-workaround-login.php
echo "\nInstructions:\n";
echo " - Login to in your browser\n";
echo " - Once logged in, using the same tab, go to\n";
echo " - Copy-paste the text (JSON) here (then press ENTER):\n\n";
$json = readline();
$o = json_decode($json);
echo "\nThanks!\n\n";
gboudreau / profile-tabs-for-um-fix-for-latest-um.diff
Created Sep 5, 2019
Diff to fix Ultimate Member Profile Tabs (profile-tabs-for-ultimate-member) for Ultimate Member 2.0.53 and later
View profile-tabs-for-um-fix-for-latest-um.diff
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 / duplicacy-monitoring.php
Last active May 19, 2018
duplicacy monitoring of incoming backups - email notifications when 3d / 7d without backup
View duplicacy-monitoring.php
- Download this script from :
- Make it executable: chmod +x duplicacy-monitoring.php
- Obtain the Duplicacy CLI from
- Configure the script by modifying the variables below.
View easymalt-headers-fix.patch
# HG changeset patch
# Parent 60085c8f01fe4eb19a1c38a2d27fd77698b5a5ec
Issue #24363: Add policy flag to avoid parsing HTTP header as email body
diff -r 60085c8f01fe Lib/email/
--- a/Lib/email/ Thu Sep 08 22:37:34 2016 -0400
+++ b/Lib/email/ Mon Jan 23 23:39:53 2017 +0000
@@ -55,8 +55,9 @@
class MissingHeaderBodySeparatorDefect(MessageDefect):

Generating Authy passwords on other authenticators

There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

gboudreau / _etc_ssh_sshd_config
Created May 11, 2016
Fix GitKraken not being able to pull/push from my repos
View _etc_ssh_sshd_config
# GitKraken needs diffie-hellman-group14-sha1
gboudreau / nissan-connect-encryption.php
Last active Jun 27, 2020
Nissan Connect API encryption using PHP
View nissan-connect-encryption.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 /
Created Mar 18, 2016
Nissan Connect API encryption using Java
import android.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class NissanConnectEncryption {
gboudreau / nissan-connect-encryption.html
Created Mar 18, 2016
Nissan Connect API encryption using Javascript
View nissan-connect-encryption.html
<script src=""></script>
var password = 'a';
var key = 'uyI5Dj9g8VCOFDnBRUbr3g';
var encrypted_password = blowfish.encrypt(password, key, {cipherMode: 0, outputType: 0});
console.log("Encrypted password: " + encrypted_password);
gboudreau / fix_files.php
Last active Feb 29, 2016
Script to fix files copied from a dying hard drive that would sometimes read bytes as 0x10 less than what they are. Ref:
View fix_files.php
* Use this script to check and fix a list of files that were copied, using rsync, from a bad (BAD!) hard drive to another hard drive (let's call that one the savior drive).
* Since the bad drive is so bad, the data that was copied off that drive might have been corrupted.
* So we'll find which of the listed files are wrong (different MD5 checksum on both drives), and fix them.
* Lucky for us, the dying drive is SO BAD that it never generates the same read errors, and when it does generate errors, the byte it reads is always exactly 0x10 (decimal 16) less than it should be.
* This very particular way of dying allows us to detect which of the two drive has the correct byte, and thus write a correct file on the savior drive.
* Hooray!