Skip to content

Instantly share code, notes, and snippets.

View brunocassol's full-sized avatar

Bruno Cassol brunocassol

View GitHub Profile
@prologic
prologic / LearnGoIn5mins.md
Last active April 22, 2024 13:28
Learn Go in ~5mins
@nginx-gists
nginx-gists / ubuntu_install.sh
Last active February 8, 2024 13:21
Automating Installation of WordPress with NGINX Unit on Ubuntu
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ];then
>&2 echo "This script requires root level access to run"
exit 1
fi
if [ -z "${WORDPRESS_DB_PASSWORD}" ]; then
>&2 echo "WORDPRESS_DB_PASSWORD must be set"
>&2 echo "Here is a random one that you can paste:"
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
@peterhellberg
peterhellberg / tunnel-plasma.go
Last active April 2, 2019 21:08
Tunnel effects in Go
package main
import (
"image"
"math"
"time"
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
"github.com/peterhellberg/plasma"
<?php
class _╯°□°╯︵┻━┻ extends \Exception {}
function _╯°□°╯︵┻━┻($message) {
throw new _╯°□°╯︵┻━┻($message);
}
_╯°□°╯︵┻━┻("Flip Table");
@peterhellberg
peterhellberg / graceful.go
Last active August 20, 2023 08:49
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
import json
import datetime
import pytz
from random import randint
import logging
import time
import redis
main_prefix = "bqueues:"
@chadrien
chadrien / README.md
Last active September 1, 2023 12:43
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
@grahamking
grahamking / slicemap_test.go
Created June 30, 2015 04:11
Benchmark comparing map access vs slice search
package main
import (
"math/rand"
"testing"
"time"
)
const (
numItems = 100 // change this to see how number of items affects speed
@dhrrgn
dhrrgn / RedisSession.php
Last active February 15, 2022 19:54
PHP 5.4 Redis Session Handler
<?php
use Predis\Client;
class RedisSession implements SessionHandlerInterface {
private $redis;
private $keyPrefix;
private $maxLifetime;
/**