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
$ ./command-line-arguments.test --test.bench="Bench" | |
testing: warning: no tests to run | |
PASS | |
BenchmarkConcat 200000 10877 ns/op | |
BenchmarkJoin 100000 16848 ns/op | |
BenchmarkBuffer 100000 20729 ns/op |
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
.source A.j | |
.class public A | |
.super java/lang/Object | |
.method public static produce()Lint; | |
.limit stack 2 | |
.limit locals 0 | |
new int | |
dup | |
invokespecial int/<init>()V |
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 compute_error(partition): | |
"""Find the majority category of the partition. Count how big | |
a part of the partition that the majority category is. | |
Return the ratio of things that are *not* of the majority category.""" | |
categories = map(get_category, partition) | |
majority = max(set(categories), key=categories.count) | |
return 1 - (categories.count(majority) / float(len(partition))) | |
# This is what a typical partition looks like. The inner tuple may | |
# be very large (in the thousands) and the list of the length may |
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
$ python2 fib.py 32 # Nothing happens for a few secs and then the fibonacci numbers are printed | |
$ python3 fib.py 32 # The fibonacci numbers are printed one by one with a greater and greater interval |
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
module Verified.Applicative | |
%default total | |
class Applicative f => VerifiedApplicative (f : Type -> Type) where | |
applicativeMap : (x : f a) -> (g : a -> b) -> | |
map g x = pure g <$> x | |
applicativeIdentity : (x : f a) -> pure id <$> x = x | |
applicativeComposition : (x : f a) -> (g1 : f (a -> b)) -> (g2 : f (b -> c)) -> | |
((pure (.) <$> g2) <$> g1) <$> x = g2 <$> (g1 <$> x) |
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
x : Int | |
x = 1 | |
y : String | |
y = "2" |
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
#!/bin/sh | |
cat << END | |
Linux atlantis 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 | |
The programs included with the Debian GNU/Linux system are free software; | |
the exact distribution terms for each program are described in the | |
individual files in /usr/share/doc/*/copyright. | |
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent |
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 ptyprocess import PtyProcess | |
p = PtyProcess.spawn(["/bin/true"]) | |
p.wait() |
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
let cbs = [] | |
for (let i = 0; i < 5; i++) { | |
cbs.push(function () { console.log(i) }) | |
} | |
cbs.forEach(function (f) { f() }) // prints "5" five times |
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
// What is the output of this program? | |
// a) x = 2 | |
// b) x = 3 | |
// c) compile-error | |
// d) runtime exception | |
// e) something else _____ | |
abstract class Eggs { | |
abstract void m(); | |
Eggs() { |
OlderNewer