Skip to content

Instantly share code, notes, and snippets.

View killerswan's full-sized avatar

Kevin Cantú killerswan

View GitHub Profile
@killerswan
killerswan / gist:7958294
Created December 14, 2013 11:50
Rust string conversions needed...
src/testloop-rs.rs:48:27: 48:39 error: mismatched types: expected `&'static str` but found `&~str` (expected &'static str but found &-ptr)
src/testloop-rs.rs:48 "--test", args.head(),
^~~~~~~~~~~~
src/testloop-rs.rs:47:16: 50:36 error: mismatched types: expected `&[~str]` but found `[&'static str, .. 8]` (str storage differs: expected ~ but found &'static )
src/testloop-rs.rs:47 run("rustc", ["-o", "loop_test",
src/testloop-rs.rs:48 "--test", args.head(),
src/testloop-rs.rs:49 "--allow", "dead_code",
src/testloop-rs.rs:50 "--opt-level", "0"]);
error: aborting due to 2 previous errors
@killerswan
killerswan / gist:6399616
Created August 31, 2013 17:35
Amit's bug
running 1280 tests
test [run-pass] run-pass/anon-extern-mod.rs ... ok
test [run-pass] run-pass/alloca-from-derived-tydesc.rs ... ok
test [run-pass] run-pass/alias-uninit-value.rs ... ok
/bin/sh: line 1: 20869 Abort trap: 6 x86_64-apple-darwin/stage2/bin/compiletest --compile-lib-path x86_64-apple-darwin/stage2/lib --run-lib-path x86_64-apple-darwin/stage2/lib/rustc/x86_64-apple-darwin/lib --rustc-path x86_64-apple-darwin/stage2/bin/rustc --clang-path /usr/bin/clang++ --llvm-bin-path /Users/kevin/code/rust/llvm/x86_64-apple-darwin/Release+Asserts/bin --aux-base /Users/kevin/code/rust/src/test/auxiliary/ --stage-id stage2-x86_64-apple-darwin --target x86_64-apple-darwin --adb-path= --adb-test-dir= --rustcflags " -O --target=x86_64-apple-darwin" --src-base /Users/kevin/code/rust/src/test/run-pass/ --build-base x86_64-apple-darwin/test/run-pass/ --ratchet-metrics tmp/check-stage2-T-x86_64-apple-darwin-H-x86_64-apple-darwin-rpass-metrics.json --mode run-pass --logfile tmp/check-stage2-T-x86_64-apple-da
@killerswan
killerswan / main=name.fsx
Last active December 21, 2015 13:08
Trouble toggling or not toggling a default function. (How do I do something like Python's `__name__ == "__main__"`?)
#if INTERACTIVE
let args = fsi.CommandLineArgs
if args.[0].Contains("Seq2.fsx") then
// works when run with fsharpi as one bash command
//
// Usage A:
// $ fsharpi Seq2.fsx
main (args.[1..])
else
@killerswan
killerswan / Seq2.fsx
Last active December 21, 2015 07:29
Exploring the laziness of F# sequences: In the first revision, I complained about non-local exceptions if I didn't force evaluation of a `Seq.take`. The latest versions are better about that, and other things...
module Seq2 =
// split into head and tail subsequences
let split nn (xs: seq<'UU>) : seq<'UU> * seq<'UU> =
let head =
Seq.truncate nn xs |> Seq.cache
let tail =
if (Seq.length head < nn) then

Setting up a Heroku demo project with Django, from Windows

Today I've started an experiment in using Heroku, and found that the instructions Heroku provided were pretty simple! I'm impressed. Although there were several Windows-related kinks you might be interested in me posting about, below.

First, we're following these instructions: https://devcenter.heroku.com/articles/django

Install Heroku's tools and PostgreSQL . (I skipped the install of ssh and git:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Helpers for automating the process of setting up ported Linux/UNIX
applications which were designed with expectations like being in $PATH.
@note: Basic functionality requires only the Python standard library.
Some functions and methods also require the PyWin32 package.
@note: A much more verbose "sudo for Windows" implementation (BSD-licensed)
@killerswan
killerswan / gist:4056331
Created November 11, 2012 21:30
Attempting to build and install Hackage's curl 1.3.7 and libcurl 7.28.0
$ ./configure --with-winssl --prefix=/c/code/curl_install
...
$ make
...
$ make install
...
$ find /c/code/curl_install/ -type f | grep -v man
@killerswan
killerswan / gist:3890155
Created October 14, 2012 23:32
codeplex fscheck issue
$ git clone https://hg.codeplex.com/fscheck
Cloning into 'fscheck'...
fatal: https://hg.codeplex.com/fscheck/info/refs not found: did you run git update-server-info on the server?
@killerswan
killerswan / with literal fn&
Created October 4, 2012 04:51
These work for me on revision a35dc85...
fn main() {
let mut v = [mut 1, 2,33,51,15,82,123,6,99, 52, 11, 5];
let mut max = 0;
(v).map(|i|{
if *i > max {
max = *i
}
@killerswan
killerswan / gist:3831112
Created October 4, 2012 02:19
crashing test...
running 1 test
test net_tcp::test::tcp_ipv4_server_and_client_test::impl64::test_gl_tcp_server_address_in_use ... *** glibc detected *** x86_64-unknown-linux-gnu/test/stdtest.stage2-x86_64-unknown-linux-gnu: free(): invalid pointer: 0x00002b5460102778 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7ec96)[0x2b5451815c96]
/code/rust/x86_64-unknown-linux-gnu/test/../stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so(+0x332bd)[0x2b54513322bd]
/code/rust/x86_64-unknown-linux-gnu/test/../stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so(upcall_call_shim_on_c_stack+0x87)[0x2b545131c357]
x86_64-unknown-linux-gnu/test/stdtest.stage2-x86_64-unknown-linux-gnu[0x435f80]
/code/rust/x86_64-unknown-linux-gnu/test/../stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so(+0x332bd)[0x2b54513322bd]
/code/rust/x86_64-unknown-linux-gnu/test/../stage2/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so(upcall_call_shim_on_rust_stack+0xcf)[0x2b545131c67f]
x86_64-unknown-linux-gnu/test/stdt