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
(def frame (gloss/finite-frame | |
(gloss/prefix :int32 inc dec) | |
[:ubyte (gloss/repeated :byte :prefix :none)])) |
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
(def frame (gloss/finite-frame | |
(gloss/prefix :int32 inc dec) | |
[:ubyte (gloss/repeated :byte :prefix :none)])) |
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 ff [x y] | |
(vec (map #(Integer/parseInt (.toString %)) (Integer/toString (* x y))))) |
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
(use 'gloss.core 'gloss.io 'lamina.core 'aleph.tcp) | |
(require 'cheshire.core) | |
(use 'clojure.pprint) | |
(def init-msg { | |
:conntype "accept-offer" | |
:nodeid "66bd135d-113f-481a-977e-111111111111" | |
:key 123 | |
:port 50210 | |
}) |
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 ono.net | |
(:import (java.net InetAddress DatagramPacket DatagramSocket))) | |
;; Namespace for network related operations | |
;; | |
;; Listens on UDP port 50210 for broadcasts | |
;; Handles socket connections to other tomahawk/ono instances | |
(def port 55555) | |
(def dgram-size 16384) |
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 listen | |
"UDP listener" | |
[_] | |
(let [buf (byte-array dgram-size) | |
packet (DatagramPacket. buf dgram-size)] | |
(dosync | |
(.receive @udp-sock packet) | |
(println "Received packet: " (String. (.getData packet) 0 (.getLength packet))))) | |
(send udp-listener listen)) |
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
git_branch() { | |
BRANCH_REFS=$(git symbolic-ref HEAD 2>/dev/null) || return | |
echo "(${BRANCH_REFS#refs/heads/}) " | |
} | |
svn_branch() { | |
[ -d .svn ] || return | |
SVN_INFO=$(svn info 2>/dev/null) || return | |
SVN_BRANCH=$(echo $SVN_INFO | grep URL: | grep -oe '\(trunk\|branches/[^/]\+\|tags/[^/]\+\)') | |
[ -n "$SVN_BRANCH" ] || return |
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 fib [x] | |
(reverse | |
(loop [n 0 r ()] | |
(cond (= x n) r | |
(or (= n 0) (= n 1)) (recur (inc n) (conj r 1)) | |
:else (recur (inc n) (conj r (+ (first (rest r)) (first r)))))))) |
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
(fn [n] (map (fn rec [y] | |
(if (< y 2) | |
y | |
(+ (rec (- y 2)) (rec (- y 1))))) | |
(range 1 (+ n 1)))) |
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
project( libechonest ) | |
set( LIBECHONEST_SRC | |
Track.cpp ) | |
set( LIBECHONEST_H | |
echonest_export.h | |
Track.h ) | |
add_library( echonest SHARED ${LIBECHONEST_SRC} ) |