Skip to content

Instantly share code, notes, and snippets.

@staktrace
staktrace / gist:744522
Created December 17, 2010 05:19
Mac OS X cookie dumper (for google.com)
#import <stdio.h>
#import <Foundation/NSHTTPCookieStorage.h>
#import <Foundation/NSHTTPCookie.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSString.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h>
int main( int argc, const char* argv[] ) {
NSURL *url = [[NSURL alloc] initWithString: @"http://google.com"];
@staktrace
staktrace / gist:4745773
Last active December 12, 2015 08:39
superprime calculator
import java.io.*;
import java.util.*;
class superprime {
public static void main( String[] args ) throws Exception {
int n = Integer.parseInt( new BufferedReader( new InputStreamReader( System.in ) ).readLine() );
ArrayList<Integer> solutions = new ArrayList<Integer>();
solutions.add( 0 );
for (int i = 1; i <= n; i++) {
ArrayList<Integer> next = new ArrayList<Integer>();
1: Test command: /bin/bash "/home/kats/zspace/rr/rr/src/test/64bit_child.run" "-b" "/home/kats/zspace/rr/rr-obj"
1: Test timeout computed to be: 9.99988e+06
1:
1: rr: Warning: Your CPU frequency governor is 'ondemand'. rr strongly
1: recommends that you use the 'performance' governor. Not using the
1: 'performance' governor can cause rr to be at least 2x slower
1: on laptops.
1:
1: On Fedora-based systems, you can enable the 'performance' governor
1: by running the following commands:
kats@kgupta-pc rr-obj$ make test
Running tests...
Test project /home/kats/zspace/rr/rr-obj
Start 1: 64bit_child
1/300 Test #1: 64bit_child ..........................................***Failed Error regular expression found in output. Regex=[FAILED] 0.15 sec
Start 2: 64bit_child-no-syscallbuf
2/300 Test #2: 64bit_child-no-syscallbuf ............................***Failed Error regular expression found in output. Regex=[FAILED] 0.14 sec
Start 3: abort_nonmain
3/300 Test #3: abort_nonmain ........................................***Failed Error regular expression found in output. Regex=[FAILED] 0.14 sec
Start 4: abort_nonmain-no-syscallbuf
kats@kgupta-pc rr$ grep "^1:" check.log
1: Test command: /bin/bash "/home/kats/zspace/rr/rr/src/test/64bit_child.run" "-b" "/home/kats/zspace/rr/rr-obj"
1: Test timeout computed to be: 9.99988e+06
1: Test '64bit_child' FAILED: error during replay:
1: --------------------------------------------------
1: [FATAL /home/kats/zspace/rr/rr/src/util.cc:383:iterate_memory_map() errno: 0 'Success']
1: -> Sorry, tracee 7010 has x86-64 image /bin/dash and that's not supported.
1: --------------------------------------------------
1: Test 64bit_child failed, leaving behind /tmp/rr-test-64bit_child-w0LUPAPEL.
1: To replay the failed test, run
Name: goto_event-M52x
State: R (running)
Tgid: 31034
Pid: 31034
PPid: 1
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
FDSize: 64
Groups: 4 24 27 30 46 109 124 1000
5645: waiting on 5646 ...
5646: running 1000 syscalls ...

--------------------------------------------------
---> Reached target process 0 at event 1000.
--------------------------------------------------
[gdb] limiting debugger traffic to tgid 5646
[gdb] launching gdb with command 'target extended-remote 127.0.0.1:5653'
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
kats@kgupta-pc test$ bash msg.run -n
Test 'msg' FAILED: output from recording different than replay
Output from recording:
--------------------------------------------------
P: got id 1310720 for key 0
P: Q stats in 0xffffd4f0:
{ perm:0600 qnum:0 lspid:0 lrpid:0 }
P: IPC_INFO returned 0 (Success/0):
{ max:8192 mnb:16384 mni:31853 }
P: MSG_INFO returned 0 (Success/0):
@staktrace
staktrace / output with 100 samples
Created August 15, 2014 15:36
Frame uniformity numbers
---- Ideal -----
Interval Position APZVelocity
16.00 16.00 1.00
16.00 32.00 1.00
16.00 48.00 1.00
16.00 64.00 1.00
16.00 80.00 1.00
16.00 96.00 1.00
16.00 112.00 1.00
Compile:
Linux: g++ -pthread mutex1.cpp -lrt
OS X: g++ mutex1.cpp
Run:
In one terminal, start the "creator" instance:
./a.out foo # any arg, just to make argc > 1
In the other terminal, start the other instance:
./a.out