Skip to content

Instantly share code, notes, and snippets.


Grégoire Pineau lyrixx

View GitHub Profile
ziadoz /
Last active Sep 30, 2022
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
qhwa / go_port_forwarding.go
Last active Sep 13, 2022
network port forwarding in go lang
View go_port_forwarding.go
package main
import (
func main() {
ln, err := net.Listen("tcp", ":8080")
naholyr /
Created Dec 13, 2012
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.


Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
hSATAC / gist:5343225
Created Apr 9, 2013
Http Redirect in Golang
View gist:5343225
package main
import (
func redirect(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "", 301)
lyrixx / HardCoreDebugLogger.php
Last active Aug 25, 2022
Hardcore Debug Logger
View HardCoreDebugLogger.php
final class HardCoreDebugLogger
public static function register(string $output = 'php://stdout')
register_tick_function(function () use ($output) {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
lyrixx / segfault-finder.php
Last active Aug 25, 2022
How to find a segfault in PHP
View segfault-finder.php
register_tick_function(function() {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$last = reset($bt);
$info = sprintf("%s +%d\n", $last['file'], $last['line']);
file_put_contents('/tmp/segfault.txt', $info, FILE_APPEND);
// or
// file_put_contents('php://output', $info, FILE_APPEND);
nikic /
Last active Jun 3, 2022
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

mxlje /
Last active Jan 10, 2022
SSL Certificate Commands

These commands are needed every time you want to generate a new certificate signing request to give to an authority in order for them to generate and sign a certificate for you. solves a lot of the pain involved with SSL certs, but sometimes you still need to go the "old school" route. I constantly forget how this stuff works, so I collected the most important commands (and what they do) here for easy copy & paste.

Generate new private key

remi / .gitconfig
Created Jul 27, 2011
Alias pour utiliser git en français!
View .gitconfig
etat = status
pousser = push
tirer = pull
commettre = commit
ranger = stash
ajouter = add
enlever = rm
cloner = clone
fusionner = merge
lyrixx / run.php
Last active Oct 7, 2021
Updated your templates with the new twig include
View run.php
- "symfony/finder: ~3.0"
- "symfony/console: ~3.0"
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;