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
-- A simple test for index-function generalization across a for loop | |
-- == | |
-- input { [0, 1000, 42, 1001, 50000] } | |
-- output { 52043i32 } | |
-- structure gpu { Copy 0 } | |
let main [n] (a: [n]i32): i32 = | |
let b = loop xs = a[1:] for i < n / 2 - 2 do | |
xs[i:] -- This will result in a copy, but it needn't | |
in reduce (+) 0 b |
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
f :: [a] -> [a] | |
f (x:x':xs) = x':x:xs | |
f xs = 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
import Data.List | |
import Text.Printf | |
type Point = (Int, Int) | |
ccw :: Point -> Point -> Point -> Int | |
ccw p1 p2 p3 = (fst p2 - fst p1) * (snd p3 - snd p1) | |
- (snd p2 - snd p1) * (fst p3 - fst p1) | |
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
#![feature(no_std)] | |
#![no_std] | |
#[prelude_import] | |
use std::prelude::v1::*; | |
#[macro_use] | |
extern crate "std" as std; | |
fn main() { | |
let v = | |
<[_] as | |
::std::slice::SliceExt>::into_vec(::std::boxed::Box::new([1, 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/env python2 | |
import urllib2 | |
def main(): | |
f = open('fil', 'r') | |
out = open('out', 'w') | |
for line in f: | |
h = urllib2.urlopen(line) | |
out.write(h.read()) |
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
### Keybase proof | |
I hereby claim: | |
* I am Munksgaard on github. | |
* I am munksgaard (https://keybase.io/munksgaard) on keybase. | |
* I have a public key whose fingerprint is A8DB 29FF 0D46 722B EC5F 536A 9F88 3D7F D6D9 3E64 | |
To claim this, I am signing this object: |
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/bash | |
# | |
# Wakeup | |
# Author: Philip Munksgaard | |
# Description: Suspends the computer and wakes up at a specified | |
# time and starts playing a song. | |
# Note: does not ensure that sound is on and high enough! | |
wakeuptime=$1 | |
shift |
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
/* rndphrase.c | |
* | |
* Author: Philip Munksgaard <pmunksgaard@gmail.com> | |
* Date: 2014-12-29 | |
* | |
* This whole thing is pretty much a direct port of the implementation from | |
* brinchj's original rndphrase.js: | |
* https://github.com/brinchj/rndphrase | |
*/ |
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
$ cargo run | |
Compiling cube v0.0.0 (file:///home/munksgaard/src/piston-examples/gfx_cube) | |
src/main.rs:51:29: 51:50 error: wrong number of lifetime parameters: expected 1, found 0 [E0107] | |
src/main.rs:51 static VERTEX_SRC: &'static gfx::ShaderSource<u8> = shaders! { | |
^~~~~~~~~~~~~~~~~~~~~ | |
src/main.rs:51:29: 51:50 error: wrong number of type arguments: expected 0, found 1 | |
src/main.rs:51 static VERTEX_SRC: &'static gfx::ShaderSource<u8> = shaders! { |
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
var count = 0; | |
function nextrow(row) { | |
var i,j; | |
for (i = 0; i < 5; i++) { | |
if (i == 4 && row[i] == 8) { | |
return null; | |
} else if (i == 4 || row[i] < row[i+1] - 1) { | |
row[i]++; | |
for (j=0; j<i; j++) row[j] = j; |