Skip to content

Instantly share code, notes, and snippets.

@Munksgaard
Munksgaard / rndphrase.c
Last active August 29, 2015 14:12
A very simple implementation of rndphrase in C
/* 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
*/
@Munksgaard
Munksgaard / wakeup
Created January 4, 2015 21:16
A script to wake you up by playing some music.
#!/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
### 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:
#!/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())
#![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]));
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)
f :: [a] -> [a]
f (x:x':xs) = x':x:xs
f xs = xs
-- 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
let {bool intra_suff_and_fits_17137} =
logand(fits_14842, suff_intra_par_17136)
-- res_17138 : [j_m_i_13929][j_m_i_13929][16i32][16i32]f32@@res_mem_19455->{base: [j_m_i_13929, j_m_i_13929, 16i32, 16i32]; contiguous: True; LMADs: [{offset: 0i32; strides: [mul32 (256i32) (j_m_i_13929), 256i32, 16i32, 1i32]; rotates: [0i32, 0i32, 0i32,
0i32]; shape: [j_m_i_13929, j_m_i_13929, 16i32, 16i32]; permutation: [0, 1, 2, 3]; monotonicity: [Inc, Inc, Inc, Inc]}]}
let {mem res_mem_19455;
[j_m_i_13929][j_m_i_13929][16i32][16i32]f32 res_17138} =
-- Branch returns: {[j_m_i_13929][j_m_i_13929][16i32][16i32]f32@?0->{base: [j_m_i_13929,
-- j_m_i_13929,
--
-- mat_13766 : [m_13764][m_13765]f32@@mat_mem_19100->{base: [m_13764, m_13765]; contiguous: True; LMADs: [{offset: 0i32; strides: [m_13765, 1i32]; rotates: [0i32, 0i32]; shape: [m_13764, m_13765]; permutation: [0, 1]; monotonicity: [Inc, Inc]}]}
entry {[?0][?1]f32@?2->{base: [?0, ?1]; contiguous: True; LMADs: [{offset: 0i32;
strides: [?1, 1i32];
rotates: [0i32, 0i32];
shape: [?0, ?1];
permutation: [0, 1];
monotonicity: [Inc, Inc]}]}}
main (mem mat_mem_19100, i32 m_13764, i32 m_13765,