Skip to content

Instantly share code, notes, and snippets.

Working from home

Gabriel Caruso carusogabriel

Working from home
  • Backend Software Engineer
  • Amsterdam - NL
View GitHub Profile
sgolemon / git-gist
Created Jun 17, 2020
Command-line gist writer
View git-gist
// Get a key from Github > Settings > Developer Settings > Personal Access Tokens
// Create a token with only the 'gist' permission.
const GISTKEY = '';
const GISTUSER = ''; // Put your github username here. Duh.
const GISTPOST = '';
$headers = [
View void
In method __set():
return $this->setProperty($property, $value);
In method __set():
return $this->_[HDOM_INFO_OUTER] = $value;
In method __set():
return $this->_[HDOM_INFO_TEXT] = $value;
matheusfaustino /
Last active Apr 29, 2020
Zsh function to change php version per project (directory) using phpbrew
# Add at the end of your .zshrc file
# After every command `cd`, it will check a ".phpbrew" file in the current directory and if it exists it will change the version of php automatically
# Create a .phpbrew file like this: `echo "7.4.4" > .phpbrew` in the folder you want to use the specific version of php
function phpbrew_change_by_dir() {
emulate -L zsh
if [ -f ".phpbrew" ]; then
PHPBREW_LOCAL_VERSION=$(cat .phpbrew);
COMMAND="phpbrew use ";

Native mocks versus PHPUnit mocks

Mock type Tests duration
Native mocks 160.10 seconds
Mockery 177.01 seconds (+10%)
PHPUnit mocks 232.29 seconds (+45%)
Prophecy 3868.80 seconds (+2416%)
anjesh /
Created Aug 14, 2017
Notes taken during php source exploration to identify weird error message
Last active Mar 25, 2021
Install Powerline-Shell on Ubuntu


  • Kubuntu 16.04.2 TLS
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial
  • Shell environment: Bash
  • Terminal application : Konsole
guilhermeblanco /
Created Jun 8, 2016
Debugging PHP-FPM segfaults

Assuming PHP is compiled with debug enabled.

$ gdb /usr/sbin/php-fpm


r --nodaemonize --fpm-config /etc/php7/fpm/php-fpm.conf
alcaeus /
Last active Apr 19, 2021
Enable GPG for git commits

Enable GPG for git commits

Generate a key

  1. Install gpg and gpg-agent: brew install gpg gpg-agent
  2. Generate a new key: run gpg --gen-key and follow the instructions
  3. Write down the ID of the key. To do this, run gpg --list-keys. The output will look like this:
pub   4096R/E9468C9A 2016-04-20 [expires: 2016-07-19]
uid                  Andreas B. <>
bastman /
Created Mar 31, 2016
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm