This file contains hidden or 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
class MetaSpam(type): | |
def __new__(cls, name, bases, ns, *, metaarg=92): | |
print("new", metaarg) | |
return super().__new__(cls, name, bases, ns) | |
def __init__(self, name, bases, ns, *, metaarg=92): | |
print("init", metaarg) | |
super().__init__(name, bases, ns) | |
class A(metaclass=MetaSpam, metaarg="WUT?"): |
This file contains hidden or 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
matklad@nixos [09:31:33] [~/quest] | |
-> % cat g.c | |
int a; | |
int b; | |
int inc_a() { return a++; } | |
int inc_b() { return b++; } | |
int main() { | |
inc_a(); |
This file contains hidden or 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
use std::thread; | |
use std::io::prelude::*; | |
/// This is an attempt to write a REPL application in | |
/// Erlangish "let it crash" style. | |
/// | |
/// References: | |
/// - http://ferd.ca/the-zen-of-erlang.html | |
/// - http://joeduffyblog.com/2016/02/07/the-error-model/ | |
/// |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<problems> | |
<problem> | |
<file>file://$PROJECT_DIR$/components/gfx/font.rs</file> | |
<line>56</line> | |
<module>servo</module> | |
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/components/gfx/font.rs" /> | |
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Anonymous parameters</problem_class> | |
<description>Anonymous trait method parameter</description> | |
</problem> |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<problems> | |
<problem> | |
<file>file://$PROJECT_DIR$/atpp-1.6.7/src/atpp.rs</file> | |
<line>133</line> | |
<module>sources</module> | |
<entry_point TYPE="file" FQNAME="file://$PROJECT_DIR$/atpp-1.6.7/src/atpp.rs" /> | |
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Anonymous parameters</problem_class> | |
<description>Anonymous trait method parameter</description> | |
</problem> |
This file contains hidden or 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
-> % RUST_LOG=debug $CA metadata --verbose ~/projects/tokio | |
DEBUG:cargo::core::workspace: find_root - trying /home/matklad/projects/Cargo.toml | |
DEBUG:cargo::core::workspace: find_root - trying /home/matklad/Cargo.toml | |
DEBUG:cargo::core::workspace: find_root - trying /home/Cargo.toml | |
DEBUG:cargo::core::workspace: find_root - trying /Cargo.toml | |
DEBUG:cargo::core::workspace: find_members - only me as a member | |
DEBUG:cargo::core::registry: load/missing file:///home/matklad/projects/tokio | |
DEBUG:cargo::sources::config: loading: file:///home/matklad/projects/tokio | |
DEBUG:cargo::core::resolver: initial activation: tokio v0.1.0 (file:///home/matklad/projects/tokio) | |
DEBUG:cargo::core::registry: load/missing https://github.com/carllerche/mio?branch=dev#c7b85ac7 |
This file contains hidden or 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 parseMany(parse: (String) => Option[(SExpression, String)], input: String): (Seq[SExpression], String) = { | |
parse(input) | |
.map { case (x, r1) => | |
val (xs, r2) = parseMany(parse, r1) | |
(x +: xs, r2) | |
} | |
.getOrElse((Seq(), input)) | |
} |
This file contains hidden or 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
extern crate time; | |
extern crate rand; | |
use time::precise_time_ns; | |
use rand::Rng; | |
use std::ffi::CString; | |
fn main() { | |
println!("Baseline 1: empty String"); |
This file contains hidden or 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
λ ~/bench/ alias t="/run/current-system/sw/bin/time -f \"%es %MkB\" " | |
λ ~/bench/ javac -version | |
javac 1.8.0_101 | |
λ ~/bench/ java -version | |
java version "1.8.0_101" | |
Java(TM) SE Runtime Environment (build 1.8.0_101-b13) | |
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) |
This file contains hidden or 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 random | |
numbers = (random.randrange(2**32) for _ in range(3 * 10**6)) | |
with open("in.txt", "w") as f: | |
f.write(" ".join(map(str, numbers))) |