Skip to content

Instantly share code, notes, and snippets.

View kisielk's full-sized avatar
🔈

Kamil Kisiel kisielk

🔈
View GitHub Profile
include ../Makefile.inc
# Paths to gtest libraries
GTEST_HOME=../third_party/gtest-1.7.0
FUSED_GTEST_DIR = $(GTEST_HOME)/fused-src
FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h
FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc
GTEST_MAIN_CC = $(GTEST_HOME)/src/gtest_main.cc
CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0
$ go-fuzz -workdir=fuzz -bin=securecookie-fuzz.zip
2015/08/18 11:44:35 slaves: 4, corpus: 100 (3s ago), crashers: 0, restarts: 1/0, execs: 0 (0/sec), cover: 0, uptime: 3s
2015/08/18 11:44:38 slaves: 4, corpus: 100 (6s ago), crashers: 0, restarts: 1/0, execs: 0 (0/sec), cover: 0, uptime: 6s
2015/08/18 11:44:41 slaves: 4, corpus: 100 (9s ago), crashers: 0, restarts: 1/6771, execs: 54173 (5953/sec), cover: 0, uptime: 9s
2015/08/18 11:44:44 slaves: 4, corpus: 100 (12s ago), crashers: 0, restarts: 1/8801, execs: 105620 (8756/sec), cover: 0, uptime: 12s
panic: runtime error: index out of range
goroutine 31 [running]:
github.com/dvyukov/go-fuzz/go-fuzz/versifier.structureKeyValue(0xc8203f6a80, 0x4, 0x4, 0x0, 0x0, 0x0)
/Users/kamil/src/github.com/dvyukov/go-fuzz/go-fuzz/versifier/versifier.go:695 +0x4a7
test2
foobar
@kisielk
kisielk / coulomb.hs
Created March 12, 2011 20:33
The beginnings...
type Charge = Double
type Distance = Double
type Force = Double
type Coord = Double
type Mass = Double
data Element = H | O | C deriving (Eq, Show, Read)
data Position = Position { xPos :: Coord
, yPos :: Coord
@kisielk
kisielk / hamming.hs
Created March 15, 2011 07:10
Our candidate programming problem, implemented in Haskell
import Data.List
normalizedScore :: String -> String -> Float
normalizedScore a b = fromIntegral (numSimilar a b) / fromIntegral (length a)
numSimilar :: String -> String -> Int
numSimilar a b = sum $ map fromEnum $ zipWith (==) a b
slice :: Int -> Int -> [a] -> [a]
slice from to xs = take (to - from + 1) (drop from xs)
from string import Formatter
class PartialFormatter(Formatter):
def format(self, format_string, *args, **kwargs):
self.fields = kwargs.keys()
def parse(self, format_string):
for parsed in super(PartialFormatter, self).parse(format_string):
if parsed[1] and parsed[1] not in self.fields:
literal_text = parsed[0] + "{" + parsed[1]
@kisielk
kisielk / node_hvmem.py
Created June 8, 2011 20:34
Sets the h_vmem complex value on hosts in gridengine based on mem_free
#!/usr/bin/env python
"""Script to set node h_vmem resource to be equal to the node's actual physical
memory.
Usage:
qhost -xml | ./node_hvmem.py
"""
import sys
import shlex
@kisielk
kisielk / sigabrt.py
Created June 27, 2011 17:24
Trying to catch SIGABRT
import signal, os
def handler(signum, frame):
print "Signal!"
raise Exception()
signal.signal(signal.SIGABRT, handler)
os.abort()
@kisielk
kisielk / omg.py
Created May 8, 2012 18:30
Python scoping rules can sometimes result in code working purely by accident.
def omg():
def inner(foo):
# Works fine, purely by accident...
return f
# ...because the list comprehension leaks its variable in to the outer scope
return [inner(f) for f in range(5)]
def broken():
@kisielk
kisielk / gist:2778374
Created May 23, 2012 23:00
Function for returning a URL to access an error sent to sentry via raven
def error_url(dsn, error_id):
import urlparse
search_base = urlparse.urlsplit(dsn)
search_url = search_base._replace(netloc=search_base.netloc.split('@')[1],
query='q={0}'.format(error_id),
path=search_base.path + '/search')
return search_url.geturl()