Skip to content

Instantly share code, notes, and snippets.

View Medeah's full-sized avatar

Frederik Andersen Medeah

  • The Restaurant at the End of the Universe
  • 17:00 (UTC +01:00)
View GitHub Profile
@Medeah
Medeah / rss.xml
Last active October 24, 2016 18:56
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>The Hitchhiker's Guide to the Galaxy</title>
<description>"The Hitchhiker's Guide to the Galaxy" was originally a 1979 BBC radio series, written by Douglas Adams, which first premiered in the US on PBS in 1980. The subsequent TV show (available on DVD) recreates the insight and beauty of the radio broadcast with visuals that were precognizant and beyond "state of the art." The book of the same name was actually a transcript of the original audio. The book pales by comparison to the original radio episodes because of the genius of the audio effects. (The 2005 movie version was an abomination.)
The original radio version of "The Hitchhiker's Guide to the Galaxy" is likely the most humorous and insightful source of philosophical wisdom created in the last 50 years, and comparable to (but much funnier than) the works of Jules Vern in terms of predictive fiction.</description>
<link>http://www.induceddyslexia.com/hitchhi
@Medeah
Medeah / elevator.ts
Created September 17, 2015 19:29
simple elevator logic. with typeScript type definitions
var elevatorSaga = {
init: function(elevators: Elevator[], floors: Floor[]) {
console.log(floors[1]);
function amin(numArray) {
return Math.min.apply(null, numArray);
}
function amax(numArray) {
return Math.max.apply(null, numArray);
}
/**
@Medeah
Medeah / index.html
Created September 15, 2015 15:28
Recover private key from vertpunk wallet
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--This is free and unencumbered software released into the public domain.-->
<title>Recover private key</title>
<script src="https://cdn.rawgit.com/bitwiseshiftleft/sjcl/1.0.3/sjcl.js"></script>
<script>
function submit() {
var id = document.getElementsByTagName('input')[0].value;
@Medeah
Medeah / updatehosts.sh
Last active September 21, 2015 18:04
Simple script to get the newest hostfile from http://someonewhocares.org/hosts/
# This is free and unencumbered software released into the public domain.
# Assume nothing works, and you may be pleasantly surprised; and when it breaks, you get to keep both pieces.
wget http://someonewhocares.org/hosts/zero/hosts && \
echo "127.0.0.1 $(cat /etc/hostname)" >> hosts && \
sudo cp /etc/hosts /etc/hosts.bak && \
sudo mv hosts /etc/hosts && \
grep --color=auto "Last updated" /etc/hosts
@Medeah
Medeah / Main.java
Created March 28, 2015 09:29
Accenture challenge using algorithm implementation from here: http://algs4.cs.princeton.edu/code/
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
public class Main {
private static int getNode(int i, int j) {
return i * 1000 + j;
}
@Medeah
Medeah / gist:2bc6e92b86ae7e8abc14
Last active December 15, 2016 22:21
Pending tests in clojure.test
;; This is free and unencumbered software released into the public domain.
;; Assume nothing works, and you may be pleasantly surprised; and when it breaks, you get to keep both pieces.
;; A Simple macro that enables you to change your testing groups to pending
(defmacro pending [name & body]
(let [message (str "\n" name " is pending !!")]
`(testing ~name (println ~message))))
var fs = require('fs')
fs.readFile('words-da', function(err, data) {
if(err) throw err
var array = data.toString().split("\n")
var avl = {}
for(i in array) {
avl[array[i]] = 1
@Medeah
Medeah / gist:5128961
Created March 10, 2013 15:16
A Tour of Go 47: Advanced Exercise: Complex cube roots
package main
import (
"fmt"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
z := complex(1.0, 0)
for cmplx.Abs(z*z*z-x) > 1e-9 {
@Medeah
Medeah / gist:5127681
Created March 10, 2013 08:48
A Tour of Go 43: Exercise: Fibonacci closure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
// we use seed values of F_−2 and F_−1
// that way the first fibonacci number returned will be F_0
a, b := -1, 1
@Medeah
Medeah / gist:5127618
Created March 10, 2013 08:22
A Tour of Go 40: Exercise: Maps
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
wordCount := make(map[string]int)
for _, word := range strings.Fields(s) {