This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns blog.models.posts | |
(:require blog.db [clj-time.core :as ctime] [clj-time.format :as format] | |
[clj-time.coerce :as coerce]) | |
(:use korma.core)) | |
(defentity posts | |
(pk :pid) | |
(database blog.db/db)) | |
(defn sql-current-time "Current timestamp in SQL Timestamp format" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns blog.backend) | |
(def posts (atom {:1 {:title "Hello" :body "World"} })) | |
(defn get-post-title "Get title of post of given id" | |
[id] (((deref posts) (keyword id)) :title)) | |
(defn get-post-body "Get body of post of given id" | |
[id] (((deref posts) (keyword id)) :body)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A very simplified version of OSX's say, using festival | |
# Usage: say [words] | |
usage="Usage: `basename $0` [-n | -f FILE | [WORDS]]" | |
if [ $# = 0 ] | |
then | |
echo $usage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
####################################################### | |
# Call qemu without having to remember stupid options.# | |
####################################################### | |
require 'yaml' | |
$qemu = "qemu-system-i386" | |
config = File.open("/home/michael/.qemu.yaml") {|yf| YAML::load(yf) } | |
def parse_machine(config,machine) | |
x = config["machines"][machine].each_pair.map.reduce "" do |acc,key| | |
case key[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ROT13 ( rot13 ) where | |
import Data.Char | |
import Data.List | |
rot13 :: String -> String | |
rot13 = map (rotate 13) | |
rotate :: Int -> Char -> Char | |
rotate n c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
############################################################ | |
# Simple wallpaper-rotation script. You can run it in cron.# | |
############################################################ | |
# | |
# Defaulting parameters which can be specified at the CLI | |
# | |
command = ARGV[0] | |
command ||= "/usr/bin/feh --bg-scale" | |
dir = ARGV[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-| | |
The Grid module creates a grid datatype that represents the pixmap that we will output to. It is a glorified matrix. This code really sucks. | |
-} | |
module Grid (Grid | |
,createGrid | |
) where | |
import Data.Complex | |
-- |As was already stated, glorified matrix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suppose that: | |
f(n)*f(n-2) - f(n-1)^2 = (-1)^(n-1) (1) | |
This is the same as the assumption, but for n-1. The inductive step requires us to show that it is true for n: | |
f(n+1)*f(n-1) - f(n)^2 = (-1)^n (2) | |
We notice that: | |
(-1)^n = -1*(-1)^(n-1) (3) |