Skip to content

Instantly share code, notes, and snippets.

@tonsky
tonsky / .profile.boot
Created March 2, 2015 20:14
boot-clj plugin to report build status to AnyBar
(defn- send-udp [s port]
(with-open [socket (java.net.DatagramSocket.)]
(let [group (java.net.InetAddress/getByName "localhost")
bytes (.getBytes s)
packet (java.net.DatagramPacket. bytes (count bytes) group port)]
(.send socket packet)
(.close socket))))
(deftask anybar [p port VAL int "AnyBar port"]
(let [port (or port 1738)]
(defn opening? [sym]
(when (symbol? sym)
(.endsWith (name sym) ">")))
(defn closing? [sym]
(when (symbol? sym)
(.startsWith (name sym) "<")))
(defn split-closing [t exprs]
(split-with
(ns task02.network
(:use [task02 helpers query])
(:require [clojure.java.io :as io]
[clojure.string :as str])
(:import [java.net Socket ServerSocket InetAddress InetSocketAddress SocketException]))
(def inactive-timeout 20000)
;; Объявить переменную для синхронизации между потоками. Воспользуйтесь promise
(def ^{:private true :dynamic true} *should-be-finished* nil)