Skip to content

Instantly share code, notes, and snippets.

Christopher Hunt huntc

Block or report user

Report or block huntc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
huntc / hyquest.ino
Last active May 12, 2019
LoRaWAN Arduino integration for the Hyquest rain water sensor
View hyquest.ino
* Copyright 2018 Titan Class Pty Ltd
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
huntc / events.scala
Last active Jul 13, 2018
OO inheritance for data modelling - describes types of events that share a common identifier
View events.scala
sealed abstract class Event(val id: Int)
final case class CountersUpdated(override val id: Int,
counter: Option[Int])
extends Event(id)
final case class DeviceIdUpdated(override val id: Int, deviceId: Int) extends Event(id)
View setup.scala
private val tracerConfig = new Configuration(
if (config.getBoolean("lora-server.jaeger.constant-sampling"))
new SamplerConfiguration("const", 1)
else new SamplerConfiguration(),
new ReporterConfiguration(
true, // logSpans
View ErrorHandlingFlow.scala
import akka.NotUsed
case object NotZero
// Emits either an Int when zero, or a domain object indicating
// that the Int is non zero. Use this approach instead of relying
// on exceptions. Exceptions are for exceptional conditions,
// largely unanticipated, and they will terminate a stream.
val flow: Flow[Int, Either[NotZero.type, Int], NotUsed] =
huntc / server.scala
Last active Dec 12, 2017
A complete server using Akka streams that reads some source, batches its data and then publishes. If the data cannot be published then it backs off with a best-effort of sending that data again.
View server.scala
val (recycleQueue, recycleSource) =
.queue[SoilStateReading](100, OverflowStrategy.dropTail)
StreamConverters.fromInputStream(() => this.getClass.getClassLoader.getResourceAsStream("sensors.log"))
View gist:166b3e851c42743459ab2c876ce40668
### Keybase proof
I hereby claim:
* I am huntc on github.
* I am huntc ( on keybase.
* I have a public key ASAK5MC9gaWxTBKWnZcUlTofK-51TIDi2R-UDtMGGUh_7Ao
To claim this, I am signing this object:
huntc / mesos-salve.env
Last active Jul 13, 2016
MESOS environment variables
View mesos-salve.env
huntc / esliteImpl.scala
Created Mar 10, 2016
Sample of using Scala with the Java DSL of Lagom
View esliteImpl.scala
package com.lightbend.conductr.eslite
import javax.inject.Named
import akka.NotUsed
import akka.pattern.ask
import com.fasterxml.jackson.databind.node.ObjectNode
import com.lightbend.conductr.eslite.dto._
huntc / SemVer.scala
Last active Mar 22, 2019
Semantic version case class
View SemVer.scala
import scala.util.Try
type PreRelease = Either[String, Int]
object SemVer {
val pattern = """^(\d+)\.(\d+)\.(\d+)(-(([1-9a-zA-Z][0-9a-zA-Z-]*)(\.([1-9a-zA-Z][0-9a-zA-Z-]*))))?$""".r
def apply(s: String): SemVer =
s match {
case pattern(major, minor, patch, _, _, preRelease1, _, preRelease2) =>
View Application.scala
def render(project: Project.Value, path: String) = EssentialAction { rh =>
val futureAction = project match {
case Project.ConductR =>
.map {
case html: Html => Action(Ok(html))(rh)
case action: Action[AnyContent] => action(rh)
case DocRenderer.NotFound(p) => Action(NotFound(s"Cannot find $p"))(rh)
case DocRenderer.NotReady => Action(ServiceUnavailable("Initializing documentation. Please try again in a minute."))(rh)
You can’t perform that action at this time.