Skip to content

Instantly share code, notes, and snippets.

View solebox's full-sized avatar
🐼
I may be slow to respond.

jacob kili solebox

🐼
I may be slow to respond.
View GitHub Profile
@solebox
solebox / module.md
Created October 23, 2016 08:37 — forked from dvirsky/module.md

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
/*
* CVE-2016-5195 dirtypoc
*
* This PoC is memory only and doesn't write anything on the filesystem.
* /!\ Beware, it triggers a kernel crash a few minutes.
*
* gcc -Wall -o dirtycow-mem dirtycow-mem.c -ldl -lpthread
*/
#define _GNU_SOURCE
@solebox
solebox / reactor.py
Last active August 29, 2015 14:16 — forked from jpanganiban/reactor.py
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all() # Patch everything
import gevent
import time
class Hub(object):
"""A simple reactor hub... In async!"""