Skip to content

Instantly share code, notes, and snippets.

@gboudreau
gboudreau / smb411-nsstest.patch
Last active May 21, 2022
Patch required to compile Samba 4.11.x on recent Ubuntu systems
View smb411-nsstest.patch
--- 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 Jan 15, 2020
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
View nest-api-php-workaround-login.php
<?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 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
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
#!/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.
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/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):
View AuthyToOtherAuthenticator.md

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
gboudreau / _etc_ssh_sshd_config
Created May 11, 2016
Fix GitKraken not being able to pull/push from my gogs.io repos
View _etc_ssh_sshd_config
# 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 Jun 27, 2020
Nissan Connect API encryption using PHP
View nissan-connect-encryption.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 Mar 18, 2016
Nissan Connect API encryption using Java
View NissanConnectEncryption.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 {
@gboudreau
gboudreau / nissan-connect-encryption.html
Created Mar 18, 2016
Nissan Connect API encryption using Javascript
View nissan-connect-encryption.html
<script src="http://sladex.org/blowfish.js/ext/blowfish.js"></script>
<script>
var password = 'a';
var key = 'uyI5Dj9g8VCOFDnBRUbr3g';
var encrypted_password = blowfish.encrypt(password, key, {cipherMode: 0, outputType: 0});
console.log("Encrypted password: " + encrypted_password);
</script>