Skip to content

Instantly share code, notes, and snippets.

View EionRobb's full-sized avatar
👍

Eion Robb EionRobb

👍
View GitHub Profile
@EionRobb
EionRobb / index.cjs
Created April 11, 2024 09:32
AWS Lambda@Edge script for CloudFront to replace square brackets in inertiajs when using laravel-vapor
'use strict';
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
headers['x-forwarded-host'] = [{
'key': 'X-Forwarded-Host',
'value': headers['host'][0].value,
}];
syntax = "proto2";
// Hand coded protobuf based on reverse engineering the web interface of google messages. Internally called Bugle or DITTO or something.
// Generally uses https://instantmessaging-pa.googleapis.com/$rpc/google.internal.communications.instantmessaging.v1.Pairing/ or https://instantmessaging-pa.googleapis.com/$rpc/google.internal.communications.instantmessaging.v1.Messaging/ for all the comms
// When sending/receiving JSON, the bytes values are sent base64 encoded
// Looks pretty similar to https://github.com/avaidyam/GoogleAPIProtobufs/blob/master/google.internal.communications.instantmessaging.v1.proto
// dont seem to quite line up though
@EionRobb
EionRobb / couchbase-php-session-handler.php
Created August 7, 2021 01:39
PHP session handler for couchbase 7
<?php
// auto_prepend_file = /path/to/couchbase-php-session-handler.php
class CouchbaseSessionHandler implements SessionHandlerInterface {
/**
* The prefix to be used in Couchbase keynames.
*/
protected $_keyPrefix = 'session:';
@EionRobb
EionRobb / googlechat-dynamite.proto
Last active June 26, 2021 11:25
hand crafted reverse engineering of Google Chat's protobuf
syntax = "proto2";
enum UserType {
HUMAN = 0;
BOT = 1;
}
@EionRobb
EionRobb / speakercraft.php
Created May 31, 2020 11:26
PHP script for Speakercraft MZC control via 3.5mm control port
<?php
//Script to control a SpeakerCraft MZC via the 3.5mm control port
// Requires a Serial/USB to quad 3.5mm adapter, eg
//https://www.aliexpress.com/item/2017184095.html
// Requires php and php-dio module
// Tested working on Windows and Linux
@EionRobb
EionRobb / output.txt
Created May 20, 2020 20:56
pvs-studio output tdlib-purple 2020-05-21
Unable to create an event source, error logging to system events will be disabled. To enable event logging, please run this application under elevated privileges at least once. 0
V659 Declarations of functions with 'map' name differ in the 'const' keyword only, but the bodies of these functions have different composition. This is suspicious and can possibly be an error. Check lines: 1022, 1030. core.h 1030
V659 Declarations of functions with 'map' name differ in the 'const' keyword only, but the bodies of these functions have different composition. This is suspicious and can possibly be an error. Check lines: 1026, 1034. core.h 1034
V530 The return value of function 'release' is required to be utilized. core.h 1502
V1051 Consider checking for misprints. It's possible that the 'num_zeros' should be checked here. format.h 1115
V783 Dereferencing of the invalid iterator 'it ++' might take place. format.h 1668
V821 Decreased performance. The 'specs' variable can be constructed in a lower level scope. format.h 18
@EionRobb
EionRobb / google_home_broadcast.php
Created December 15, 2018 06:08
Quick hack to send a broadcast message to Google Home devices connected to an account
<?php
if (!isset($_GET['text'])) {
header('HTTP/1.1 404 Not Found');
exit;
}
$refresh_token = '';
$access_token = '';

Keybase proof

I hereby claim:

  • I am EionRobb on github.
  • I am eion (https://keybase.io/eion) on keybase.
  • I have a public key whose fingerprint is 06BB 837A 1F2B 9CF9 7384 91BC 5956 5B52 BC6F 79B6

To claim this, I am signing this object:

<?php
if (!is_callable('sodium_crypto_sign_detached')) {
function sodium_crypto_sign_detached($message, $key) {
return substr(sodium_crypto_sign($message, $key), 0, 64);
}
}
function encode_base64($data) {
return rtrim(base64_encode($data), '=');
<?php
function imagecreatefromstring_autorotate($data)
{
$img = imagecreatefromstring($data);
if (substr($data, 0, 3) == "\xFF\xD8\xFF" && ($data{3} == "\xDB" || $data{3} == "\xE0" || $data{3} == "\xE1")) {
$orientation = -1;
if (function_exists('exif_read_data')) {