Skip to content

Instantly share code, notes, and snippets.

@abedra
abedra / compile_errors
Created January 2, 2013 21:30
ModSecurity nginx compile errors (lua related)
objs/addon/modsecurity/ngx_http_modsecurity.o \
objs/ngx_modules.o \
-L/usr/local/lib -lpthread -lcrypt /home/abedra/src/opensource/ModSecurity/nginx/modsecurity/../../standalone/.libs/standalone.a -lapr-1 -laprutil-1 -lxml2 -lm -lpcre -lcrypto -lcrypto -lz -lGeoIP
/home/abedra/src/opensource/ModSecurity/nginx/modsecurity/../../standalone/.libs/standalone.a(standalone_la-msc_lua.o): In function `l_setvar':
/home/abedra/src/opensource/ModSecurity/standalone/../apache2/msc_lua.c:355: undefined reference to `lua_gettop'
/home/abedra/src/opensource/ModSecurity/standalone/../apache2/msc_lua.c:358: undefined reference to `lua_getglobal'
/home/abedra/src/opensource/ModSecurity/standalone/../apache2/msc_lua.c:359: undefined reference to `lua_topointer'
/home/abedra/src/opensource/ModSecurity/standalone/../apache2/msc_lua.c:361: undefined reference to `lua_getglobal'
/home/abedra/src/opensource/ModSecurity/standalone/../apache2/msc_lua.c:362: undefined reference to `lua_topointer'
/home/abedra/src/opensource/ModSecuri
@abedra
abedra / cookie_monster.md
Created December 31, 2012 13:47
Cookie Monster Porter
@abedra
abedra / lua
Created December 24, 2012 03:21
lua -v
Lua 5.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio
pacman -Q | grep lua
lua 5.2.1-3
@abedra
abedra / Build details
Created December 24, 2012 03:06
Source build failures for mod security on Arch Linux
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release
Thread model: posix
gcc version 4.7.2 (GCC)
autom
@abedra
abedra / coin_changer.clj
Created November 27, 2012 02:22
Coin Changer
(defn change [cents]
(loop [amount cents
change []]
(if (or (zero? amount) (> 0 amount))
change
(let [coins [25 10 5 1]
coin (apply max (filter (partial >= amount) coins))]
(recur (- amount coin) (conj change coin))))))
@abedra
abedra / about.md
Created November 14, 2012 19:16 — forked from fogus/about.md
Programming Achievements: How to Level Up as a Developer
@abedra
abedra / cider.md
Created October 11, 2012 04:09
2012 Fall Cider Recipe

Hard Cider (10.13.2012)

Style: Cider

Description:

This is a common fall hard cider. Best when apples are in season and you can find fresh pressed, unpasteurized apple cider. If you can't get your hands on fresh pressed cider, any store bought cider that is 100% juice and has no preservatives will also work, but you will lose

#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
typedef struct {
ngx_str_t abusers_filename;
} ngx_http_repsheet_loc_conf_t;
static char *ngx_http_repsheet(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static void *ngx_http_repsheet_create_loc_conf(ngx_conf_t *cf);
import Data.List
import Data.Maybe
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
base = length alphabet
encode :: Int -> String
encode 0 = "a"
encode id = map (\x -> alphabet !! x) (reverse (tail (map (\x -> snd x) options)))
where options = takeWhile (/= (0,0)) (iterate (\x -> ((fst x `div` 62), (fst x `mod` 62))) (id,0))
class Inspector
# :nodoc:
def self._collect_events_for_method_call(&block)
events = []
set_trace_func lambda { |event, file, line, id, binding, classname|
events << { :event => event, :file => file, :line => line, :id => id, :binding => binding, :classname => classname }
}