Skip to content

Instantly share code, notes, and snippets.

View chalasr's full-sized avatar

Robin Chalas chalasr

View GitHub Profile
@chalasr
chalasr / Symfony2 GraphvizDumper demo
Created June 7, 2017 14:50 — forked from fgm/Symfony2 GraphvizDumper demo
Demonstrate how to use the GraphViz Dumper in a Symfony 2.4 project.
<?php
/**
* @file
* gvdump.php
*
* @author: Frédéric G. MARAND <[email protected]>
*
* @copyright (c) 2014 Ouest Systèmes Informatiques (OSInet).
*
* @license MIT
@chalasr
chalasr / coroutine.php
Created October 27, 2018 21:00 — forked from nikic/coroutine.php
A coroutine example: Streaming XML parsing using xml_parser
<?php
error_reporting(E_ALL);
/* Data can be send to coroutines using `$coroutine->send($data)`. The sent data will then
* be the result of the `yield` expression. Thus it can be received using a code like
* `$data = yield;`.
*/
/* What we're building in this script is a coroutine-based streaming XML parser. The PHP
@chalasr
chalasr / script.lua
Created July 7, 2019 19:04 — forked from chanks/script.lua
Lua script to delete/trim all processed messages from a Redis stream
-- The goal of this script is to trim messages that have been processed by
-- all extant groups from the a given Redis stream. It returns the number
-- of messages that were deleted from the stream, if any. I make no
-- guarantees about its performance, particularly if the stream is large
-- and not fully processed (so a simple XTRIM isn't possible).
-- First off, bail out early if the stream doesn't exist.
if redis.call("EXISTS", KEYS[1]) == 0 then
return false
end
@chalasr
chalasr / bootstrap.sh
Created April 29, 2020 13:09 — forked from keo/bootstrap.sh
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup