Skip to content

Instantly share code, notes, and snippets.

View lenaschoenburg's full-sized avatar

Lena Schönburg lenaschoenburg

View GitHub Profile
(defn sc [p]
"Returns a function that matches data with pattern"
(fn [data]
(loop [d data
c p]
(if (seq c)
(if (seq d)
(if (= (first c)
(first d))
(recur (rest d) (rest c))
(defn middle [s]
(int (/ (count s) 2)))
(defn left [s]
(take (middle s) s))
(defn right [s]
(if (even? (count s))
(drop (middle s) s)
(drop (+ 1 (middle s)) s)))
(defn divisible? [number divisor]
(zero? (rem number divisor)))
(defn fit? [number]
(every? #(divisible? number %) (range 1 21)))
(first (drop-while (complement fir?) (iterate inc 1)))
(defn sq [x]
(* x x))
(- (sq (reduce + (range 1 101))) (reduce + (map sq (range 1 101))))
package main
import "fmt"
var data [100]byte
func main() {
input := "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>."
i := 0
p := 0

I am going to write about the process of setting up Ubuntu as a dual boot option on your MacBook. Reading several guides, I decided that the actual process is much easier than you would thougt.

Ubuntu version

First of all you have to choose an Ubuntu version. [Ubuntu 12.10][Stable] is the latest stable release and the best option for beginners. If you feel as experimental as me you can go with [Ubuntu 13.04][Beta] as well. It's probably buggy and you will encounter issues when fighting with software version, but you will get a bleeding edge version with the newest changes and better drivers. Whatever you choose, start downloding the 64bit Mac version now. It will take some time.

EFI Bootloader

Your MacBook does not boot other OS out of the box. To do this you will need an Bootloader as [rEFIt][EFI]. Download and install it. Just use the installer, no need for customization here.

Partitioning

Next you will need to make an partition for Ubuntu. Use DiskUtility to create a new Partition on your Disk. Don't

(defn buffer-to-string
([^ByteBuffer buff]
(let [decoder (-> (Charset/forName "UTF-8")
(.newDecoder))])
(->> buff
(. decoder decode)
(.toString))))
@lenaschoenburg
lenaschoenburg / list.js
Created March 30, 2013 21:58
List out of Lambda, code from @stevelosh
// List
var empty_list = function(selector) {
return selector(undefined, undefined, true);
}
var is_empty = function(list){
return list(function (h, t, e) {
return e;
});
}
var prepend = function(el, list) {
@lenaschoenburg
lenaschoenburg / bwt.clj
Created July 7, 2013 15:00
Burrows–Wheeler transformation.
(defn enhance [s]
(conj (into [\^] (vec s) )\|))
(defn rotate [c]
(vec (conj (drop-last c) (last c) )))
(defn pipe-and-save
"Given an item, it will recursivly apply fun n times. Gives back item plus each step in a coll"
([item n fun]
(pipe-and-save item n fun []))
@lenaschoenburg
lenaschoenburg / README.md
Last active December 21, 2015 04:29 — forked from zpao/README.md

Install

  1. install homebrew
  2. place autoconf213.rb into Formula folder: /usr/local/Library/Formula/
  3. run brew install autoconf213