Skip to content

Instantly share code, notes, and snippets.

Philip Munksgaard Munksgaard

Block or report user

Report or block Munksgaard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View grahamscan.hs
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)
View gist:b11bcd026f8df9ec3be0
#![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]));
View gist:98cf2ecdc3ca065392c0
#!/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())
View gist:0206e4147d2da5d84a16
### 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:
@Munksgaard
Munksgaard / wakeup
Created Jan 4, 2015
A script to wake you up by playing some music.
View wakeup
#!/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
@Munksgaard
Munksgaard / rndphrase.c
Last active Aug 29, 2015
A very simple implementation of rndphrase in C
View rndphrase.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
*/
View gist:8fe4e202f8d3ed42076d
$ 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! {
@Munksgaard
Munksgaard / plade.js
Created Mar 21, 2014
Bankopladegenerator
View plade.js
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;
View gist:9172142
javascript:(function(){"use strict";var BLOCKED_WORDS=["left","right","up","down","start","select","a","b","democracy","anarchy","oligarchy","bureaucracy","monarchy","alt f4","helix"];var BLOCKED_URLS=["nakedjenna","bit.ly","bitly","tinyurl","teespring","youtube.com/user","naked-riley","twitch.tv","ow.ly","steam-games-free","free-steam-games","cheap games"];var MINIMUM_MESSAGE_LENGTH=3;var MAXIMUM_NON_ASCII_CHARACTERS=2;var MINIMUM_DISTANCE_ERROR=2;var myWindow;try{myWindow=unsafeWindow}catch(e){myWindow=window}var $=myWindow.jQuery;var commands_regex=new RegExp("^(("+BLOCKED_WORDS.join("|")+")\\d?)+$","i");function min_edit(a,b){if(a.length===0)return b.length;if(b.length===0)return a.length;var matrix=[];for(var i=0;i<=b.length;i++){matrix[i]=[i]}for(var j=0;j<=a.length;j++){matrix[0][j]=j}for(var i=1;i<=b.length;i++){for(var j=1;j<=a.length;j++){if(b.charAt(i-1)==a.charAt(j-1)){matrix[i][j]=matrix[i-1][j-1]}else{matrix[i][j]=Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1))}}}return
View gist:7573433
load "Random";
signature SHUFFLE =
sig
val shuffle : 'a list -> 'a list;
end;
structure Shuffle :> SHUFFLE =
struct
You can’t perform that action at this time.