This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test2 | |
foobar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal, os | |
def handler(signum, frame): | |
print "Signal!" | |
raise Exception() | |
signal.signal(signal.SIGABRT, handler) | |
os.abort() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
OlderNewer