Skip to content

Instantly share code, notes, and snippets.

View pnkfelix's full-sized avatar
🍩
re-pat; ex-🥐

Felix S Klock II pnkfelix

🍩
re-pat; ex-🥐
View GitHub Profile
@pnkfelix
pnkfelix / gist:6296520
Created August 21, 2013 16:09
fact-tail
(define fact-tail
(lambda (n)
(let loop ((n n) (accum 1))
(cond ((zero? n) accum)
(else (loop (- n 1) (* accum n)))))))
@pnkfelix
pnkfelix / gist:6367843
Created August 28, 2013 16:09
build failure, injected by 9bfdd42703603f04681 i.e. alexcrichton/rust/fix-libuv-build
-*- mode: compilation; default-directory: "~/Dev/Mozilla/rust.git/objdir-dbgopt/" -*-
Comint started at Wed Aug 28 17:12:53
time remake -j1
cfg: build triple x86_64-apple-darwin
cfg: host triples x86_64-apple-darwin
cfg: target triples x86_64-apple-darwin
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for x86_64-apple-darwin is x86_64
cfg: os for x86_64-apple-darwin is apple-darwin
@pnkfelix
pnkfelix / gist:6368121
Created August 28, 2013 16:36
new demonstration of rust build failure when linking libuv (ccache disabled)
-*- mode: compilation; default-directory: "~/Dev/Mozilla/rust.git/objdir-dbgopt/" -*-
Compilation started at Wed Aug 28 18:14:17
time remake -j1
cfg: build triple x86_64-apple-darwin
cfg: host triples x86_64-apple-darwin
cfg: target triples x86_64-apple-darwin
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for x86_64-apple-darwin is x86_64
cfg: os for x86_64-apple-darwin is apple-darwin
@pnkfelix
pnkfelix / gist:6368346
Created August 28, 2013 16:52
VERBOSE make after moving libuv build dir out of the way.
% remake -j1 VERBOSE=1
cfg: build triple x86_64-apple-darwin
cfg: host triples x86_64-apple-darwin
cfg: target triples x86_64-apple-darwin
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for x86_64-apple-darwin is x86_64
cfg: os for x86_64-apple-darwin is apple-darwin
cfg: using clang
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
(cd /Users/fklock/Dev/Mozilla/rust.git/src/libuv/ && /usr/bin/python2.7 ./gyp_uv -f make -Dtarget_arch=x86_64 -D ninja -Goutput_dir=/Users/fklock/Dev/Mozilla/rust.git/objdir-dbgopt/rt/x86_64-apple-darwin/stage0/libuv --generator-output /Users/fklock/Dev/Mozilla/rust.git/objdir-dbgopt/rt/x86_64-apple-darwin/stage0/libuv)
enum Foo { a, b, c }
static all_Foo : &'static [Foo] = &'static [a, b, c];
fn iterFoo() -> std::vec::VecIterator<Foo> { all_Foo.iter() }
macro_rules! enum_with_iter (
($M:ident $E:ident $F:ident { $($V:ident),* }) =>
( mod $M {
use std;
pub enum $E { $($V),* }
static all_E : &'static [$E] = &'static [$($V),*];
@pnkfelix
pnkfelix / gist:6418092
Created September 2, 2013 23:14
variant of merge that separates Analysis from Action.
fn merge<T: Ord + Clone>(l1: &[T], l2: &[T]) -> ~[T] {
let mut merged = ~[];
let mut l1 = l1.to_owned().move_iter().peekable();
let mut l2 = l2.to_owned().move_iter().peekable();
enum Step { Left, Right, Done }
loop {
let step = {
let a = l1.peek();
@pnkfelix
pnkfelix / gist:6423266
Created September 3, 2013 12:27
perf attempt
% perf diff dbg-array/perf.data dbg-matrix/perf.data
[kernel.kallsyms] with build id f02c9451d73e38008191585d067213c4f885f810 not found, continuing without symbols
Failed to open /tmp/perf-22482.map, continuing without symbols
[kernel.kallsyms] with build id f02c9451d73e38008191585d067213c4f885f810 not found, continuing without symbols
Failed to open /tmp/perf-22396.map, continuing without symbols
# Event 'cycles'
#
# Baseline Delta Shared Object
// A substring range
pub struct StrRange<'self> {
start: uint,
length: uint,
source: &'self str,
}
impl<'self> StrRange<'self> {
fn new<'a>(st: uint, ln: uint, ss: &'a str) -> StrRange<'a> {
StrRange { start: st, length: ln, source: ss }
@pnkfelix
pnkfelix / msys-rustdev.bat
Created September 10, 2013 15:25
Wrapper script for a rust dev terminal
rem FSK adding specialized settings for rust here
PATH=C:\Python27;%PATH%
msys.bat %*
@pnkfelix
pnkfelix / Isolated LLVM code, broken
Last active December 23, 2015 04:19
Issue 9129: LLVM and Machine code comparisons
; Function Attrs: inlinehint uwtable
define internal i64 @_ZN13on_break_expr4anon7expr_fn2aTE({ i64, %tydesc*, i8*, i8*, i8 }*, i64) #6 {
"function top level":
%__arg = alloca i64
%i2 = alloca %"struct.syntax::ast::Ident[#2]"
%__trait_callee = alloca { %tydesc*, { i64, %tydesc*, i8*, i8*, i8 }* }
%2 = alloca %"struct.syntax::ast::Ident[#2]"
%3 = alloca { i8*, i32 } ;*** delta L2: only right
store i64 %1, i64* %__arg