Skip to content

Instantly share code, notes, and snippets.

@cs278
cs278 / output.sh
Last active June 10, 2016 10:47
Composer signature bad encoding
$ wget -qO- https://getcomposer.org/download/1.1.2/composer.phar.sig | jq -r '.sha384' | base64 --decode | sha256sum
base64: invalid input
867a94f359e4a8431d8bed267edd85414e1c99acb76fa3686f7167dd143c6c76 -
$ wget -qO- https://getcomposer.org/download/1.1.2/composer.phar.sig | jq -r '.sha384' | php -r 'echo base64_decode(stream_get_contents(STDIN));' | sha256sum
867a94f359e4a8431d8bed267edd85414e1c99acb76fa3686f7167dd143c6c76 -
$ php -a
php > var_dump(hash('sha256', base64_decode('gvW3HhdC4KvSiWOZ/P4pS6C0e39mXRFdLvMIjUxBoxe7YyEe5ueMgEHJ3SLvAbjD4JE4dEw4hqeBY+hFPeSPvBMFcNVPAcYWEnYDCcbc/y3dKMmBWHkl2O4Ahf9YFv6ZNxHQbHkKSlsUAl4x7RL7rgPjJ9NgV7uRwsyyruYg+/RjmastYIJqgK2xWxaVlko5KIFs5QT1/5pJUDo3+9MYXvTvOFQQpoPdhAQ11MWnHVlAx9wX+LqA6biTBB5hSP/P/wcTSelFdKH+XUK20ECQ+1+gwtdFvQfwVfdJP6bcX6/NV3P1aiIOjql7jwD+tJRKCBZjjYS4klHzCA8YM+MK5DNl8yYuW3tGsMshljMEKIhtZJbfUO8gWMHzGn1XADJ6/w6yBhU3OJG7cX7AYZWBVuZxM72PKgxYTnZWwfOo3s9fYIsgAoTI9IBIKu4wgi+twyNfZa0l41ZBpGWvTXbUol/M4mdmAUQrfb+DNviNwekJ8kYj4aX0Uaz/pC61ZEA8YRvIje8FlJqtTFJdlzBtTDW
@cs278
cs278 / gist:7e60c231159bc2249cd8
Created June 26, 2015 10:25
Composer SSH multiplexing timeout (#4180)
chris.smith@wp-040-du:/tmp/test $ ssh -V; ssh github.com; ssh -O exit github.com; ssh -O exit github.com
OpenSSH_6.6.1p1 Ubuntu-2ubuntu2, OpenSSL 1.0.1f 6 Jan 2014
Hi cs278! You've successfully authenticated, but GitHub does not provide shell access.
Exit request sent.
Control socket connect(/home/chris.smith/.ssh/sockets/[email protected]:22): No such file or directory
chris.smith@wp-040-du:/tmp/test $ composer require -vvv --profile --prefer-source psr/log '*'
[4.3MB/0.01s] Reading ./composer.json
[4.5MB/0.01s] Loading config file /home/chris.smith/.config/composer/config.json
[4.5MB/0.01s] Loading config file /home/chris.smith/.config/composer/auth.json
[4.5MB/0.01s] Loading config file ./composer.json
@cs278
cs278 / gist:a3a96af7bed205e18007
Last active August 29, 2015 14:15
Xubuntu setup

Cleanup

apt-get purge thunderbird*
apt-get purge firefox* xul-*
apt-get purge gnumeric*
apt-get purge abiword*
apt-get purge pidgin* libpurple*
apt-get purge gmusicbrowser
apt-get purge transmission*
<?php
use Composer\Autoloader\ClassLoader;
class loader
{
private $loader;
private $overlays = array();
public function __construct(ClassLoader $loader, array $overlays)
@cs278
cs278 / gist:885545a2c923a56d6800
Created August 20, 2014 23:10
EmailValidator test results
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /home/chris/src/symfony/vendor/egulias/email-validator/phpunit.xml.dist
.............................F...........FF.FF.F......F.....F.. 63 / 328 ( 19%)
....F..FF..F.F.F.F.......................................FF.... 126 / 328 ( 38%)
........FF.....FFFFF....FFFFF....F............................. 189 / 328 ( 57%)
............................................................... 252 / 328 ( 76%)
................................F.............F......FFFFF....F 315 / 328 ( 96%)
FFFF.........
@cs278
cs278 / github-list-hotkeys.js
Last active August 29, 2015 14:04
List GitHub hotkeys.
$('[data-hotkey]').map(function() {
var $this = $(this);
return '\''
+ ($this.text().trim() || $this.attr('href') || $this.attr('placeholder'))
+ '\': '
+ $this.data('hotkey').replace(/, */, ' or ');
}).toArray().join("\n")
@cs278
cs278 / github-ws-toggle.js
Last active August 29, 2015 14:04
Toggles ignore whitespace on GitHub diffs.
(function(location, domain) {
var search, regexp;
domain = domain || 'github.com';
search = location.search;
regexp = /[\?&]w=1/;
if (domain !== location.hostname) return;
if (regexp.test(search)) {
@cs278
cs278 / github-sudo.js
Last active August 29, 2015 14:00
Allow GitHub Sudo input to be filled by Chrome.
(function($, id) {
var $label = $('label[for=' + id + ']');
var $input = $('#' + id);
if ($('#sudo_username').length > 0) {
return;
}
$label.clone().attr('for', 'sudo_username').text('Username').insertBefore($label);
$input.clone().attr({
@cs278
cs278 / github-pr-tag.js
Last active May 25, 2017 16:20
GitHub PR tag toggle boorkmarklet
(function(tag, domain) {
domain = domain || 'github.com';
// No tag supplied.
if (!tag) return;
// Bail out if not the correct domain.
if (domain !== window.location.hostname) return;
// String.trimLeft() method is required.
@cs278
cs278 / getEnvironment.php
Created November 7, 2013 14:13
Fetch environment even if the $_ENV superglobal is unset due to the `variables_order` INI setting.
<?php
function getEnvironment() {
if ($_ENV) {
return $_ENV;
}
$keys = array_keys($_SERVER);
return $_ENV = array_filter(