View header.clj
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
;; Copyright (c) 2019 Vertiv, Inc. | |
(ns clj-bacnet.application.prefix.header | |
(:require [clj-binary.codec.complex-bytes :as cb] | |
[clj-binary.core :as bin] | |
[clojure.spec.alpha :as s] | |
[orchestra.core :refer [defn-spec]] | |
[org.clojars.smee.binary.core :as sb] | |
[spec-coerce.core :as coerce] | |
[vertiv-common.spec :as vs])) |
View header.clj
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-bacnet.application.prefix.header | |
(:require [clj-binary.codec.complex-bytes :as cb] | |
[clj-binary.core :as bin] | |
[clojure.spec.alpha :as s] | |
[orchestra.core :refer [defn-spec]] | |
[org.clojars.smee.binary.core :as sb] | |
[spec-coerce.core :as coerce] | |
[vertiv-common.spec :as vs])) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
View settings.xml
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
<settings> | |
<mirrors> | |
<mirror> | |
<!--This sends everything else to /public --> | |
<id>my-mirror</id> | |
<mirrorOf>*</mirrorOf> | |
<url>http://my-mirror/repository/maven-public/</url> | |
</mirror> | |
</mirrors> | |
<profiles> |
View build-hosts.clj
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
;; My IP address data is shaped like this: | |
(def data {"host-a" {:ip "1.1.1.1"} | |
"host-b" {:ip "2.2.2.2"} | |
"container" {"host-c" {:ip "3.3.3.3"} | |
"host-d" {:ip "4.4.4.4"}}}) | |
;; This logic turns that data into a map ("set" in nix) that would work for `networking.hosts`: | |
(defn build-hosts [ip-data & [name-prefix]] | |
(reduce-kv (fn [result hostname {:keys [ip] :as info}] | |
(let [full-hostname (if name-prefix |
View binary_util.clj
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-bacnet.binary-util | |
(:require [org.clojars.smee.binary.core :as binary] | |
[com.rpl.specter :refer :all]) | |
(:import org.clojars.smee.binary.core.BinaryIO)) | |
(defn hexify "Convert byte sequence to hex string" | |
[coll-or-num] | |
(let [coll (cond (coll? coll-or-num) coll-or-num | |
(number? coll-or-num) [coll-or-num] | |
(nil? coll-or-num) []) |
View hara.data.clj
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 reduce-kvs [rf init kvs] | |
(reduce (fn [acc [k v]] (rf acc k v)) init (partition-all 2 kvs))) | |
(defn assoc-if | |
"Assoc each kv if (pred value) is true | |
(assoc-if odd? {:a 1} :b 2 :c 3) | |
=> {:a 1 :c 3}" | |
([pred m k v ] (if (pred v) (assoc m k v) (or m {}))) | |
([pred m k v & kvs] |
View custom-alarm.nix
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
{ stdenv, fetchFromGitHub }: | |
with stdenv.lib; | |
stdenv.mkDerivation rec { | |
name = "hass-custom-alarm-${version}"; | |
version = "1.3.1"; | |
src = fetchFromGitHub { | |
owner = "gazoscalvertos"; | |
repo = "Hass-Custom-Alarm"; |
View custom-alarm.nix
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
{ stdenv, fetchFromGitHub }: | |
with stdenv.lib; | |
stdenv.mkDerivation rec { | |
name = "hass-custom-alarm-${version}"; | |
version = "1.3.1"; | |
src = fetchFromGitHub { | |
owner = "gazoscalvertos"; | |
repo = "Hass-Custom-Alarm"; |
View complex-rule-codec-example.clj
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 npdu | |
(util-b/complex-rule-codec | |
:version :ubyte | |
:control-octet (util-b/complex-bytes | |
:ubyte [{:bits 1 | |
:name :layer | |
:enum-map {:network 1 | |
:apdu 0}} | |
nil ;;reserved | |
:dest-present? |
View custom-alarm.nix
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
{ stdenv, fetchFromGitHub }: | |
with stdenv.lib; | |
stdenv.mkDerivation rec { | |
name = "hass-custom-alarm-${version}"; | |
version = "1.3.1"; | |
src = fetchFromGitHub { | |
owner = "gazoscalvertos"; | |
repo = "Hass-Custom-Alarm"; |
NewerOlder