Skip to content

Instantly share code, notes, and snippets.

View maurice2k's full-sized avatar
🚄
Making stuff fast. And even faster.

Moritz Fain maurice2k

🚄
Making stuff fast. And even faster.
  • CHECK24
  • Munich, Germany
  • 03:21 (UTC +02:00)
View GitHub Profile
@maurice2k
maurice2k / pprof.go
Last active December 11, 2019 12:04
pprof.go
go func() {
defer os.Exit(0)
cpuProfile, err := os.Create("tcpserver-cpu.prof")
if err != nil {
log.Fatal(err)
}
defer pprof.StopCPUProfile()
pprof.StartCPUProfile(cpuProfile)
time.Sleep(time.Second * 10)
@maurice2k
maurice2k / moh_channel_cleanup.patch
Last active July 24, 2018 10:59
MoH wrapper cleanup after channels hangs up
commit 40defa63ae4f4775629572d9a70a2c63bcc9e6fa
Author: Moritz Fain <moritz@fain.io>
Date: Tue Jun 26 16:17:37 2018 +0200
Fixed locking issue in stasis_app_bridge_moh_channel
Fixed an issue that resulted in "Allocation failed" when
using ARI to start playing MOH on a bridge.
ASTERISK-26094 #close
@maurice2k
maurice2k / LoggingErrorsInZendExpressive3.md
Created March 21, 2018 14:15
Logging errors in Zend Expressive 3

Logging errors in Zend Expressive 3

Some background info on PHP error handling

In PHP error handling is split into exceptions (or to be more generic: throwables) and the good old PHP errors like E_NOTICE, E_WARNING, E_ERROR etc.

While throwables are easy to handle with try-catch (or using an exception handler) the latter are a bit of a left over from the pre-exception area in PHP. In Expressive as well as in many other frameworks these errors get converted to exceptions using an error handler.

After setting up this special error handler, all errors are then thrown as exceptions and can be easily catched.