Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
C_RST='\e[0m'
C_BLUE='\e[0;34m'
C_RED='\e[0;31m'
C_BRED='\e[1;31m'
C_BGREEN='\e[1;32m'
C_BBLUE='\e[1;34m'
C_BMAGENTA='\e[1;35m'

Keybase proof

I hereby claim:

  • I am ellzey on github.
  • I am strcpy (https://keybase.io/strcpy) on keybase.
  • I have a public key whose fingerprint is D0D6 688E 39FC E3B9 D575 8531 E8DF 9CA0 8131 CBFF

To claim this, I am signing this object:

@errzey
errzey / gflow.md
Last active December 21, 2015 01:27

Using git-flow to make your development process awesome

The Workflow in Detail

Commandline Utility For the flow Model

=========================================

Fork the project into your own account

Simply go to the repository of choice and click fork, then setup your origin and upstream for tracking.

@errzey
errzey / MOTD001.md
Last active August 29, 2015 14:13
@strcpy's "Macro of the Day" gistified.

Original tweet that started it all

While small and simplistic, it has a huge impact for many reasons

#define lz_safe_free(_var, _freefn) do { \
        _freefn((_var));                 \
        (_var) = NULL;                   \
}  while (0)
@errzey
errzey / CMakeLists.txt
Created September 12, 2014 23:22
build better gcc on CentOSucks
cmake_minimum_required(VERSION 2.4)
add_custom_target(do_always ALL COMMAND yum -y install cmake git gcc gcc-c++ openssl-devel libtool autoconf flex bison zip)
include (ExternalProject)
ExternalProject_add(gmp
URL http://packages.strcpy.net/gmp-5.1.3.tar.bz2
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
@errzey
errzey / gist:191be50d235ee01e0d1f
Created August 21, 2014 14:57
sample tsauditd filter
function Set(list)
local set = {}
for _, l in ipairs(list) do
set[l] = true
end
return set
end
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <inttypes.h>
#include <evhtp.h>
static evhtp_res print_data(evhtp_request_t * req, struct evbuffer * buf, void * arg);
static evhtp_res print_new_chunk_len(evhtp_request_t * req, uint64_t len, void * arg);
@errzey
errzey / abstract
Last active August 29, 2015 14:01
Writing efficient parsers for streaming data in C
C is known as one of the worst languages to write any type of parsers.
Developers usually take one of three roads for parsing data:
1. Lexical Analysis & LALR (lex / yacc) utilizing a BNF syntax input.
2. Gobs of strstr, strtok, strcmp, and loads of conditionals.
3. Regular expressions, which usually involve the same logic in #2
Utilizing Lex & Yacc can be one of the more strict and specific methods of
@errzey
errzey / gist:7414273
Last active January 26, 2016 13:29
Kernel debugging setup notes.

Setting up your KDBG environment for pussies.

Every time I have to setup a new environment, I completely forget the mess you have to go through in order to get your kernel debug world setup properly. So this is here to make sure I won't forget it ever again.

I do not run linux as a desktop, and I suggest that nobody else does. My development consists of OS-X, and VirtualBox with two (almost) identical installations of linux (whatever you want, but I use ubuntu here in my examples). Our secondary VM will be the host which we will be debugging, as in our primary box will attach to it via kgdb.

Step 1

Clone your VM - no need to do a full history copy, just a snapshot clone, call it something that won't confuse you later, like "fucktard69" if your main VM is "shitcocks666". It doesn't matter, shut the fuck up.

nl_enum_brace = remove # "enum {" vs "enum \n {"
nl_union_brace = remove # "union {" vs "union \n {"
nl_struct_brace = remove # "struct {" vs "struct \n {"
nl_do_brace = remove # "do {" vs "do \n {"
nl_if_brace = remove # "if () {" vs "if () \n {"
nl_for_brace = remove # "for () {" vs "for () \n {"
nl_else_brace = remove # "else {" vs "else \n {"
nl_while_brace = remove # "while () {" vs "while () \n {"
nl_switch_brace = remove # "switch () {" vs "switch () \n {"