Skip to content

Instantly share code, notes, and snippets.

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <dlfcn.h>
#include <errno.h>
@nodesocket
nodesocket / logstash
Created July 7, 2013 01:18
LogStash init.d service script.
#! /bin/sh
#
# /etc/rc.d/init.d/logstash
#
# Starts Logstash as a daemon
#
# chkconfig: 2345 20 80
# description: Starts Logstash as a daemon
### BEGIN INIT INFO
#The MIT License (MIT)
# Copyright (c) 2012 Jordan Wright <jordan-wright.github.io>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@minism
minism / binary.lua
Created September 5, 2012 22:31
lua binary data packing
-- Fast functions for working with binary data
return {
decode_uint8 = function(str, ofs)
ofs = ofs or 0
return string.byte(str, ofs + 1)
end,
decode_uint16 = function(str, ofs)
ofs = ofs or 0
local a, b = string.byte(str, ofs + 1, ofs + 2)
@eculver
eculver / htpasswd.py
Created December 1, 2011 22:04
htpasswd script in python (no need to install apache utils)
#!/usr/local/bin/python
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
@jippi
jippi / rc.d
Created July 5, 2011 19:58 — forked from vvuksan/gist:988765
Logstash Init script
update-rc.d logstash-shipper defaults
update-rc.d logstash-reader defaults