Skip to content

Instantly share code, notes, and snippets.

@warmuuh
warmuuh / Receiver.c
Created February 26, 2024 07:06
heltec automation lora 32 + dht11 + mqtt sender/receiver
// connects to a given mqtt server via wifi
// receives lora messages in format "<deviceId><jsonMessage>" and forwards them to mqtt channel /lora/device/<deviceId>
// message: {"message": <content of whatever sender sent>, "rssi":..., "snr":...}
#include "LoRaWan_APP.h"
#include "Arduino.h"
#include <WiFi.h>
#include <PubSubClient.h>
factory.addServerCustomizers(httpServer -> httpServer.tcpConfiguration(
tcpServer -> tcpServer.bootstrap(serverBootstrap -> {
serverBootstrap.config().childGroup().forEach(eventExecutor -> {
if (SingleThreadEventExecutor.class.isAssignableFrom(eventExecutor.getClass())) {
SingleThreadEventExecutor singleThreadEventExecutor = (SingleThreadEventExecutor) eventExecutor;
Gauge.builder(SERVER_PENDING_TASK_METRIC, singleThreadEventExecutor::pendingTasks)
.description("Pending Tasks")
.tag(SERVER_THREAD_NAME, singleThreadEventExecutor.threadProperties().name())
.tag(SERVER_THREAD_STATE, singleThreadEventExecutor.threadProperties().state().name())
package core.utils.easyrules;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
@warmuuh
warmuuh / SureFireStyleReporter.scala
Created April 24, 2018 12:00
SureFireStyleReporter for scalatest
package wrm.scalatest
import org.scalatest.Reporter
import org.scalatest.events._
class SureFireStyleReporter extends Reporter{
var failedTests: List[Event] = Nil
@warmuuh
warmuuh / LICENSE.md
Created June 15, 2016 12:45 — forked from joepadmiraal/LICENSE.md
Jenkins build status widget for Dashing

The MIT License (MIT)

Copyright (c) 2014 David Underwood

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

package scala.dsl
sealed class Level(val emptyCount: Int)
case object Full extends Level(-1);
case object Easy extends Level(30);
case object Medium extends Level(50);
case object Hard extends Level(70);
object Sudoku {
import scala.io.StdIn
import scala.util.Random
import scala.util.Try
/**
* @author pmucha
*/
object rps extends App {
@warmuuh
warmuuh / gist:019ed40c97fbc91ca9d1
Created August 14, 2015 15:03
microservice stack
microservice stack:
features:
* rest-service (embedded jetty) (using http://sparkjava.com/)
* environment-based configuration (using https://github.com/typesafehub/config)
* dependency injection (using https://github.com/warmuuh/hardwire)
* logging (using simple-slf4j)
* metrics (using dropwizards metrics-core)
* healthchecks (using dropwizards metrics-healthchecks)
@warmuuh
warmuuh / documenting-and-testing-versioned-apis-1.java
Last active August 29, 2015 14:23
documenting-and-testing-versioned-apis
@Test
public void user() throws Exception {
this.mockMvc
.perform(get("/user"))
.andExpect(status().isOk())
.andDo(response()
.common(fieldWithPath("id").description("user-id"),
fieldWithPath("name").description("name of user"))
.v1( fieldWithPath("g").description("gender of the user"))
.v2( fieldWithPath("gender").description("gender of the user"))
@warmuuh
warmuuh / serverside-rendering-in-spring-with-react-1.java
Created February 9, 2015 11:28
Serverside Rendering in Spring with React
public class JsxViewResolver implements ViewResolver {
@Setter String prefix = "static/";
@Setter String suffix = ".js";
@Setter String indexFile = "/templates/index.html";
private JReact renderer;
private MessageFormat format;
@PostConstruct