Skip to content

Instantly share code, notes, and snippets.

@rouzier
rouzier / script.lua
Created April 11, 2019 14:54 — 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
@rouzier
rouzier / centos_nspawn.md
Created March 29, 2018 03:14 — forked from bhouse/centos_nspawn.md
Centos 7.2.1511 via systemd-nspawn

Make a directory to install CentOS 7.2.1511 in

[root@localhost ~]# mkdir /centos_chroot

Make a directory for the rpm database

[root@localhost ~]# mkdir -p /centos_chroot/var/lib/rpm

Create the RPM database

#include <lang/libc-ext.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
char * normalize_path(char* pwd, const char * src, char* res) {
size_t res_len;
size_t src_len = strlen(src);
--
-- PacketFence SQL schema upgrade from X.X.X to X.Y.Z
--
--
-- Setting the major/minor/sub-minor version of the DB
--
SET @MAJOR_VERSION = 7;