Skip to content

Instantly share code, notes, and snippets.

View m6w6's full-sized avatar

Michael Wallner m6w6

View GitHub Profile
@m6w6
m6w6 / Fibers.md
Last active October 5, 2022 21:56
Fibers are...

Fibers are...

  +------------------------------------------------------------+
  | Process                                                    |
  |   +--------------------------------------------------------+
  |   | Threads (OS/User)                                      |
  |   |   +----------------------------------------------------+
  |   |   | Coroutines                                         |
  |   |   |   + -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - +
 | | | | ┌ Fiber (with stack, yield anywhere) |
diff --git a/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c b/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
index 6e5bf78e45..7c773f40fc 100644
--- a/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
+++ b/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
@@ -175,7 +175,7 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
#endif
#ifdef MAP_ANON
- flags |= MAP_ANON | SLJIT_MAP_JIT;
+ flags |= MAP_ANON | SLJIT_MAP_JIT | MAP_JIT;
@m6w6
m6w6 / acx_debug_cflags.m4
Created November 7, 2013 06:57
--enable-debug for autoconf
# gcc default/debug CFLAGS handling respecting user's CFLAGS
# avoid AC_PROG_CC setting -O2 CFLAGS which will override DEBUG_CFLAGS' -O0
# must be used right after AC_INIT
AC_DEFUN([ACX_DEBUG_CFLAGS], [
# ensure CFLAGS are set
AS_IF([test "${CFLAGS+set}"], [
USE_DEFAULT_CFLAGS=false
], [
@m6w6
m6w6 / configure.ac
Created November 22, 2013 08:39
ACX_DEBUG_CFLAGS usage
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
# our own version constants
m4_define([VERSION_MAJOR], [1])
m4_define([VERSION_MINOR], [0])
m4_define([VERSION_PATCH], [0])
m4_define([VERSION_STATE], [dev])
@m6w6
m6w6 / blog.md
Last active October 26, 2020 21:23
git: move some recent commits from master to a new branch

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 / shell.rc
Created April 10, 2019 15:02
command not found handler
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);
@m6w6
m6w6 / ext-http3.stub.php
Created February 28, 2019 10:36
ext-http stub
<?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 September 12, 2017 13:10
Valgrind output re bug71135
$ 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)
@m6w6
m6w6 / issue_events.php
Created May 13, 2016 10:07
seekat example
<?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 April 15, 2016 16:17
Debian: disabling SSLv3 in courier server

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():