Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Wallner m6w6

View GitHub Profile
@m6w6
m6w6 / shell.rc
Created Apr 10, 2019
command not found handler
View shell.rc
ask_php () {
typeset res ret
php -derror_reporting=-1 -dlog_errors=0 -ddisplay_errors=1 -r'
set_error_handler(function($code, $message) {
fprintf(STDERR, "%s\n", $message);
exit(1);
});
array_shift($argv);
$fn = array_shift($argv);
View ext-http3.stub.php
<?php
/**
* Extended HTTP support. Again.
* * Introduces the http namespace.
* * PHP stream based message bodies.
* * Encapsulated env request/response.
* * Modular client support.
*/
namespace http;
use http;
@m6w6
m6w6 / bug71135-valgrind-after-patch
Last active Sep 12, 2017
Valgrind output re bug71135
View bug71135-valgrind-after-patch
$ memcheck ~/src/php-719-opcache/usr/bin/php -d auto_prepend_file=status.php phan -l src
==21115== Memcheck, a memory error detector
==21115== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==21115== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==21115== Command: /home/mike/src/php-719-opcache/usr/bin/php -d auto_prepend_file=status.php phan -l src
==21115==
==21115== Syscall param writev(vector[...]) points to uninitialised byte(s)
==21115== at 0x8E6E950: __writev_nocancel (in /usr/lib/libc-2.25.so)
==21115== by 0xA02048B: zend_file_cache_script_store (zend_file_cache.c:810)
==21115== by 0xA01542F: cache_script_in_shared_memory (ZendAccelerator.c:1388)
View issue_events.php
<?php
require_once __DIR__."/../vendor/autoload.php";
use seekat\API;
$log = new Monolog\Logger("seekat");
$log->pushHandler((new Monolog\Handler\StreamHandler(STDERR))
->setLevel(Monolog\Logger::INFO));
@m6w6
m6w6 / blog.md
Last active Apr 15, 2016
Debian: disabling SSLv3 in courier server
View blog.md

Debian wheezy (currently oldstable) ships courier-0.68 which was probably released on 2012. "Probably", because, head over to the Courier website and try to find the NEWS/ChangeLog.

The Problem

Anyway. Courier-0.68 has built-in openssl support on Debian and it initializes a SSL context the following way:

        ctx=SSL_CTX_new(protocol && strcmp(protocol, "SSL3") == 0
                        ? SSLv3_method():
@m6w6
m6w6 / blog.md
Last active Oct 26, 2020
git: move some recent commits from master to a new branch
View blog.md

Sometimes, I find myself in a series of commits which should have been done in a separate branch:

A - B - C - D - E - F (master)
            ^- first commit that should not be in master

Here's what it should look like:

@m6w6
m6w6 / sigaction.psi
Created Feb 16, 2016
pesky system interfaces
View sigaction.psi
function psi\sigaction(int $sig, object $act, object &$oact = null) : int {
let sig = intval($sig);
let act = arrval($act,
callback void(
sa_handler(
to_int(signo)
)
),
objval(sa_mask),
intval(sa_flags),
View keybase.md

Keybase proof

I hereby claim:

  • I am m6w6 on github.
  • I am m6w6 (https://keybase.io/m6w6) on keybase.
  • I have a public key whose fingerprint is 1EC3 C71D DD63 5831 A337 D684 480E 3E14 B0A4 C7C7

To claim this, I am signing this object:

@m6w6
m6w6 / gdb.txt
Last active Feb 3, 2016
psi glob
View gdb.txt
(gdb) r
Starting program: /home/mike/build/php-master-dbg/sapi/cli/php -d psi.directory=psi.d:/home/mike/src/psi/tests/glob /home/mike/src/psi/tests/glob/glob002.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Hardware watchpoint 4: *(char **)0xd70298
Old value = <unreadable>
New value = 0xd702f0 ""
0x00007ffff641bfa5 in __fopen_internal () from /usr/lib/libc.so.6
(gdb) c
@m6w6
m6w6 / abort.txt
Created Jan 19, 2016
master-constant-internal-interfaces-crash
View abort.txt
*** Error in `/home/mike/build/php-master-dbg-zts/sapi/cli/php': corrupted double-linked list: 0x0000000002e69f10 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x72055)[0x7fb14b8c3055]
/usr/lib/libc.so.6(+0x779a6)[0x7fb14b8c89a6]
/usr/lib/libc.so.6(+0x77c39)[0x7fb14b8c8c39]
/usr/lib/libc.so.6(+0x78810)[0x7fb14b8c9810]
/home/mike/build/php-master-dbg-zts/sapi/cli/php(zend_hash_destroy+0x282)[0x936084]
/home/mike/build/php-master-dbg-zts/sapi/cli/php[0x91c71a]
/home/mike/build/php-master-dbg-zts/sapi/cli/php(tsrm_shutdown+0xf4)[0x85a40c]
/home/mike/build/php-master-dbg-zts/sapi/cli/php[0x9f0443]
You can’t perform that action at this time.