Skip to content

Instantly share code, notes, and snippets.

@gboudreau
gboudreau / nissan-connect-encryption.html
Created March 18, 2016 13:55
Nissan Connect API encryption using Javascript
<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>
@gboudreau
gboudreau / fix_files.php
Last active February 29, 2016 15:24
Script to fix files copied from a dying hard drive that would sometimes read bytes as 0x10 less than what they are. Ref: https://www.pommepause.com/2016/02/the-case-of-the-dying-hard-drive-that-flipped-bits/
<?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!
@gboudreau
gboudreau / test_checksum.php
Last active February 29, 2016 15:24
Calculate the MD5 checksum of a file over and over, clearing the disk cache between each read, to try to identify read errors that are happening on a hard drive. Ref: https://www.pommepause.com/2016/02/the-case-of-the-dying-hard-drive-that-flipped-bits/
<?php
$file = '/mnt/hdd5/persistent-app-data/downloading/vvgoor1586DSFGKL.part10.rar';
while (TRUE) {
exec("sync ; sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'");
$data1 = file_get_contents($file);
exec("sync ; sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'");
$data2 = file_get_contents($file);
@gboudreau
gboudreau / fix-google-drive-dark-mode-icons.sh
Created November 6, 2014 01:42
Fix Google Drive menuBar icon for dark mode
#!/bin/bash
function switch_files {
mv $1.png $1.tmp.png
mv $1-inverse.png $1.png
mv $1.tmp.png $1-inverse.png
mv $1@2x.png $1@2x.tmp.png
mv $1-inverse@2x.png $1@2x.png
mv $1@2x.tmp.png $1-inverse@2x.png
}
@gboudreau
gboudreau / install-ffmpeg-amazon-linux.sh
Last active November 21, 2023 19:48
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@gboudreau
gboudreau / install-greyhole-package.sh
Last active April 5, 2020 13:20
Install Greyhole package
#!/bin/bash
# Detect package type from /etc/issue
_found_arch() {
local _ostype="$1"
shift
grep -qis "$*" /etc/issue && _OSTYPE="$_ostype"
}
# Detect package type
@gboudreau
gboudreau / test-symlink-creation.php
Last active August 29, 2015 14:04
Test PHP symlink() function
@gboudreau
gboudreau / Sample of Übersicht.txt
Created June 17, 2014 18:41
Sample of Übersicht - Application Not Responding
Sampling process 64900 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Übersicht (pid 64900) every 1 millisecond
Process: Übersicht [64900]
Path: /Applications/Übersicht.app/Contents/MacOS/Übersicht
Load Address: 0x1075a4000
Identifier: tracesOf.Uebersicht
Version: 0.1 (5)
Code Type: X86-64
Parent Process: launchd [616]

Keybase proof

I hereby claim:

  • I am gboudreau on github.
  • I am gboudreau (https://keybase.io/gboudreau) on keybase.
  • I have a public key whose fingerprint is EEEC EA5D AB9D BA25 21C6 5248 4536 901B F6B0 FCFA

To claim this, I am signing this object:

@gboudreau
gboudreau / greyhole-system-info.sh
Last active December 1, 2019 16:09
Greyhole System Infos
#!/bin/sh
{
echo "## System information"
uname -a 2>&1
echo
echo "## Samba version"
/usr/sbin/smbd --version