Skip to content

Instantly share code, notes, and snippets.

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
@Munksgaard
Munksgaard / plade.js
Created March 21, 2014 14:51
Bankopladegenerator
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;
$ 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 / 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)
(defun isInteger (n)
(= (round n) n))
(defun isPentagonalNumber (p)
(let ((solution (/ (+ 1 (sqrt (+ 1 (* 24 p)))) 6)))
(isInteger solution)))
(defun test (p)
(/ (+ 1 (sqrt (+ 1 (* 24 p)))) 6))