This file contains 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
1) Get a browser open to http://23.23.246.103:8080 (you will need this later) | |
2) Download the private key for swarming http://23.23.246.103:8080/keys/cincyfp | |
3) ssh -i cincyfp swarm@23.23.246.103 | |
Follow the instructions when you get in! | |
This file contains 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
;; given 3 integers in a sequence | |
;; generate the number of lights that are on in a berlin clock, | |
;; returning 5 rows | |
(defn make-counts [[hours minutes seconds]] | |
[ | |
(- 1 (mod seconds 2)) | |
(int (/ hours 5)) | |
(mod hours 5) | |
(int (/ minutes 5)) | |
(mod minutes 5) |
This file contains 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 reducers.core | |
(:require [clojure.core.reducers :as r])) | |
(map + [1 2 3]) ;=> (1 2 3) | |
(class(map + [1 2 3])) ;=> (1 2 3) | |
(def odyssey-text (slurp "odyssey.txt")) | |
(class odyssey-text) ;=> java.lang.String | |
(first odyssey-text) ;=> \P |
This file contains 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
defn change-for [change coins returning] | |
(let [ coin (first coins) | |
others (rest coins) | |
] | |
(cond | |
(= change 0) returning | |
(>= change coin) (change-for (mod change coin) others (conj returning {coin (int (/ change coin))})) | |
:else (change-for change others returning)))) | |
(defn make-change [price tendered] |
This file contains 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 clj-drone.core | |
(:import (java.net DatagramPacket DatagramSocket InetAddress))) | |
(def drone-host (InetAddress/getByName "192.168.1.1")) | |
(def at-port 5556) | |
(def socket (DatagramSocket. )) | |
(defn send-command [data] | |
(.send socket |
This file contains 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
INFO - Starting navdata stream | |
INFO - Creating navdata stream | |
INFO - navdata: {:altitude 0.0, :control-state :default, :seq-num 22291} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am too low | |
INFO - navdata: {:altitude 0.0, :control-state :landed, :seq-num 22292} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am landed | |
INFO - navdata: {:altitude 0.0, :control-state :trans-takeoff, :seq-num 22293} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am landed | |
INFO - navdata: {:altitude 0.0, :control-state :trans-takeoff, :seq-num 22294} | |
INFO - goal list: I want to fly., I want to get to a cruising altitude of 1 m, I want to land current-goal: I want to fly. current-belief: I am landed |
This file contains 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 overtone-tutorial.mary) | |
(use 'overtone.core) | |
(boot-external-server) | |
(definst saw-wave [freq 440 attack 0.01 sustain 0.4 release 0.1 vol 0.4] | |
(* (env-gen (lin-env attack sustain release) 1 1 0 1 FREE) | |
(saw freq) | |
vol)) |
This file contains 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
-- Example.hs -- Examples from HUnit user's guide | |
-- | |
-- For more examples, check out the tests directory. It contains unit tests | |
-- for HUnit. | |
module Main where | |
import Test.HUnit | |
import Test.QuickCheck |
This file contains 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 Main where | |
import Test.HUnit | |
-- nasa :: Int -> [Int] -- | [] | |
nasa n = reverse [0..n] | |
-- | n <= 0 = [0] | |
-- | otherwise = n : (nasa $ n - 1) | |
-- test1 :: Test |
This file contains 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 brackets.core-test | |
(:use clojure.test | |
brackets.core | |
instaparse.core)) | |
(def my-parser | |
(parser | |
"S = func-apply | vector | integer | |
integer = #'[0-9]+' | |
<space> = <' '> |