Skip to content

Instantly share code, notes, and snippets.

View jesstess's full-sized avatar

Jessica McKellar jesstess

View GitHub Profile
@jesstess
jesstess / tracer.c
Created January 24, 2011 02:11
A minimal tracer. Attach to a running process or run a process under it. Step through instructions or syscalls. Generate instruction and syscall summaries.
/*
* A minimal tracer. You can:
* - attach to a running process or run a process under it.
* - step through instructions.
* - step through syscalls.
* - generate a syscall summary.
* - count and time the number of instructions executed.
*
* If you are generating a summary with 'ci' or 'cs', send SIGTSTP (Ctl-Z) to
* pause the traced process and dump a summary (useful if you've attached to a
@jesstess
jesstess / cpu_cache_info.txt
Created January 27, 2011 01:18
CPU cache level, type, size, cache line size, associativity.
for path in /sys/devices/system/cpu/cpu*/cache/index*/
do
echo $path;
echo -n "Level: "; cat $path/level;
echo -n "Type: "; cat $path/type;
echo -n "Size: "; cat $path/size;
echo -n "Cache line size: "; cat $path/coherency_line_size;
echo -n "Associativity: "; cat $path/ways_of_associativity;
done
@jesstess
jesstess / NASA_images_png2yuv
Created August 12, 2011 19:13
Turning NASA images into movies: png2yuv | mpeg2enc
Keith gave me the hook-up on turning NASA images into a high-quality movie. I had tried twiddling knobs starting from a basic ffmpeg incant:
ffmpeg -r 10 -i frame%03d.jpg frames.mov
but the movies looked terrible.
Keith said:
"""
Generally if you're making a movie out of separate frames, I prefer to use png2yuv and mpeg2enc from the mjpegtools package instead of ffmpeg -- it's pretty clean code designed for this task instead of an assemblage of random libraries.
@jesstess
jesstess / alexa-top-10000.txt
Created November 25, 2011 04:37
How the Alexa top 10000 respond to unusual HTTP methods
google.com
facebook.com
yahoo.com
youtube.com
live.com
wikipedia.org
blogger.com
baidu.com
msn.com
yahoo.co.jp
@jesstess
jesstess / find_prune_dir
Created February 1, 2012 22:31
Change all instances of foo to bar in this directory, excluding files in .git or its subdirectories
find . -not \( -name .git -prune \) -type f -print0 | xargs -0 sed -i 's/foo/bar/g'
@jesstess
jesstess / ELF_strings
Created February 18, 2012 21:36
Where in an ELF executable do various types of strings live?
Where in an ELF executable do various types of strings live?
Inspired by "How to waste a lot of space without knowing": http://glandium.org/blog/?p=2361
Test file:
$ cat /tmp/test.c
char *ptr_global = "ptr_global_string";
char array_global[] = "array_global_string";
import sys
scores = {"A": 1, "C": 3, "B": 3, "E": 1, "D": 2, "G": 2,
"F": 4, "I": 1, "H": 4, "K": 5, "J": 8, "M": 3,
"L": 1, "O": 1, "N": 1, "Q": 10, "P": 3, "S": 1,
"R": 1, "U": 1, "T": 1, "W": 4, "V": 4, "Y": 4,
"X": 8, "Z": 10}
# Get the Scrabble rack from the command line.
if len(sys.argv) < 2: