Skip to content

Instantly share code, notes, and snippets.

@robocoder
robocoder / decode.php
Last active December 2, 2023 04:25
PHP Decoding MySQL's .mylogin.cnf
<?php // tested with PHP 8.0.11
$start = microtime(true);
const LOGIN_KEY_LEN = 20;
const MY_LOGIN_HEADER_LEN = 24;
const MAX_CIPHER_STORE_LEN = 4;
$raw = file_get_contents(__DIR__ . '/mylogin.cnf');
$fp = 4; // skip null bytes
# Why no PHP8.2 + QT6.6?
# Prior Work
[PHP8 + QT5](https://github.com/nazmulpcc/phpqt)
* proof of concept; last commit Jun 17, 2023
[PHP7 + QT5](https://phpqt.ru/)
* part of PQEngine and PlastiQ; last commit Jan 28, 2019
[PHP7 + QT5](https://github.com/abiusx/phpqt-ng)
@robocoder
robocoder / gist:33afa327be2838e83b13d6ddbc996c29
Created May 9, 2018 18:16
PHP build_url (opposite of parse_url)
/**
* Generate URL from its components (i.e., opposite of built-in php function, parse_url())
*
* @param array $components
*
* @return string
*/
function build_url($components)
{
$url = $components['scheme'] . '://';
@robocoder
robocoder / gist:fc9a28fd1500d510d197a4209996d0f3
Last active June 11, 2020 14:04
Purple Player, Platform Purple, DRM, Leaping Brain, Brain Trust
Audience: video content creators
It is alleged that:
* the initial DRM implementation simply XOR'd the first 13 bytes of the first 15 x 1K blocks of the video file;
* the 13 byte key was literally, "RANDOM STRING"
* reference: https://plus.google.com/+AsherLangton/posts/Yk71MgkvAXx
It was later observed that:
* the DRM implementation was changed to XOR the first 32 bytes of the first 16 x 1K blocks of the video file;
* the 32 byte key appears random;
```
Disable auto-renewal
There went something wrong to disable your auto-renewal for Unlimited: The subscription could not be updated, something went wrong: Recurly_Error: A canceled subscription can&#39;t transition to canceled in &#x2F;var&#x2F;www&#x2F;vendor&#x2F;recurly&#x2F;recurly-client&#x2F;lib&#x2F;recurly&#x2F;util&#x2F;http_validations.php:19 Stack trace: #0 &#x2F;var&#x2F;www&#x2F;vendor&#x2F;recurly&#x2F;recurly-client&#x2F;lib&#x2F;recurly&#x2F;response.php(63): Recurly_ClientResponse-&gt;validateStatusCode(400, Object(Recurly_FieldError)) #1 &#x2F;var&#x2F;www&#x2F;vendor&#x2F;recurly&#x2F;recurly-client&#x2F;lib&#x2F;recurly&#x2F;resource.php(94): Recurly_ClientResponse-&gt;assertValidResponse() #2 &#x2F;var&#x2F;www&#x2F;vendor&#x2F;recurly&#x2F;recurly-client&#x2F;lib&#x2F;recurly&#x2F;subscription.php(111): Recurly_Resource-&gt;_save(&#39;PUT&#39;, &#39;https:&#x2F;&#x2F;moovly....&#39;) #3 &#x2F;var&#x2F;www&#x2F;src&#x2F;Moovly&#x2F;LicenseBundle&#x2F;Service&#x2F;RecurlyService.php(606)
@robocoder
robocoder / gist:f4e735e5c20881ed53e21a32daadf2cb
Created February 20, 2018 20:04
building apt on xenial
# apt 1.4.y
git clone https://github.com/Debian/apt.git
cd apt
git checkout 1.4.y
apt-get install libcurl4-openssl-dev
apt-get install cmake
apt-get install liblz4-dev
apt-get install liblzma-dev
apt-get install libbzip2-dev
apt-get install libbz2-dev
@robocoder
robocoder / mb_overrides.rst
Created February 6, 2012 00:42
mbstring.func_overload

When mbstring.func_overload is enabled, various (but not all) built-in string functions are overridden by mbstring's multi-byte string functions.

  • "mail", "mb_send_mail", "mb_orig_mail"
  • "strlen", "mb_strlen", "mb_orig_strlen"
  • "strpos", "mb_strpos", "mb_orig_strpos"
  • "strrpos", "mb_strrpos", "mb_orig_strrpos"
  • "stripos", "mb_stripos", "mb_orig_stripos"
  • "strripos", "mb_strripos", "mb_orig_strripos"
  • "strstr", "mb_strstr", "mb_orig_strstr"
  • "strrchr", "mb_strrchr", "mb_orig_strrchr"