Skip to content

Instantly share code, notes, and snippets.

/*
* $ gcc -m32 -fPIC -shared -o regdump.so regdump.c
* $ LD_PRELOAD=$(pwd)/regdump.so ./test
*
* Dump register state with 'ud2a' (0F 0B)
*/
#define _GNU_SOURCE
#include <signal.h>
#include <stdlib.h>
def callblock (&block)
block.call
puts "block.call returned normally"
end
def yieldblock (&block)
yield
puts "yield returned normally"
end
(require 'ido)
(setq ido-max-directory-size (* 256 1024)
ido-enable-flex-matching t)
(defun chomp (str)
"Chomp leading and tailing whitespace from STR."
(while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'"
str)
(setq str (replace-match "" t t str)))
str)
for o in $(find .git/objects -ctime -2 -type f);
do o=$(basename "$(dirname "$o")")"$(basename "$o")";
if [ "$(git cat-file -t "$o")" = "blob" ]; then
if git cat-file blob $o | grep SOME-WORD; then
echo ">> $o";
fi;
fi;
done
Normally, this header is included in most HTTP requests (and
preserved across HTTP-level redirects), except in the following
scenarios:
⋅ After organically entering a new URL into the address bar or
opening a bookmarked page.
⋅ When the navigation originates from a pseudo-URL document, such
as data: or javascript:.
⋅ When the request is a result of redirection controlled by the
Refresh header (but not a Location-based one).
⋅ Whenever the referring site is encrypted but the requested page
case 'G':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR)) break;
tok->type = TK_ANCHOR;
tok->u.subtype = ANCHOR_BEGIN_POSITION;
break;
// elsewhere
case '^':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_LINE_ANCHOR)) break;
tok->type = TK_ANCHOR;
@nelhage
nelhage / make_yaml_safe.rb
Last active December 10, 2015 23:08
Neuter YAML to help mitigate CVE-2013-0156-style attacks.
# The fact that YAML.load will instantiate arbitrary ruby objects
# means that calling `YAML.load` on untrusted data is virtually always
# equivalent to executing arbitrary code in a complex app.
# This code fragment globally neuters YAML to disable this behavior,
# which should (hopefully) cut off all such attacks from the start.
# I don't promise this closes all possible attacks, but this closes
# off the trivial case. You should audit and upgrade all your
# dependencies, as well.
import sys
sys.path.append("/tmp/Numberjack.0.1.10-11-24/local_lib")
from Numberjack import *
import Mistral
class Puzzle(object):
def __init__(self, w, h):
self.model = Model()
self.width = w
self.height = h
# The canonical version of this file lives at <https://gist.github.com/4507129>. Sorry for the redundant posts.
[nelhage@aeronautique:~/stripe/simmer]$ cat test.in
top5:sum:merchant nelhage:1
top5:sum:merchant nelhage:2
top5:sum:merchant evan:1
sum:x 1
sum:x 2
sum:x 3
(GIT: master *=)
[nelhage@aeronautique:~/stripe/simmer]$ # bin/simmer -r localhost:6379 -f 0 < test.in
(GIT: master *=)