Skip to content

Instantly share code, notes, and snippets.

View eruvanos's full-sized avatar

Maic Siemering eruvanos

View GitHub Profile
@eruvanos
eruvanos / StopWatchHolder.java
Created June 14, 2016 13:32
StopWatchHolder: Holds Spring Stopwatch as static field and extends a next() method
package de.siemering.gist;
import org.springframework.util.StopWatch;
public class SwHolder{
private static StopWatch sw = new StopWatch();
public static void start(String taskName) throws IllegalStateException {
sw.start(taskName);
@eruvanos
eruvanos / GlobalErrorController.java
Created July 15, 2016 20:01
Global errorhandler for Spring
package de.siemering.spring.controllers;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("${error.path:/error}")
public class GlobalErrorController implements ErrorController {

Keybase proof

I hereby claim:

  • I am eruvanos on github.
  • I am eruvanos (https://keybase.io/eruvanos) on keybase.
  • I have a public key ASCBFe9JGaDvOfkHdQAxO0EmGrcCzQ_WvjNyUWaqAPEKrQo

To claim this, I am signing this object:

@eruvanos
eruvanos / log_util.py
Last active August 30, 2024 10:58
Better log config for Python
"""
Configures a logger to log <=INFO to stdout and >INFO to stderr
"""
import logging
import os
import sys
DEFAULT_FORMAT = '%(asctime)s - %(levelname)s - %(name)s - %(message)s'
NO_TIME_FORMAT = '%(levelname)s - %(name)s - %(message)s'
@eruvanos
eruvanos / vp
Created July 18, 2017 06:50
Virtual Pipe - Tool to show what was piped through
#!/usr/bin/env python
import time
from sys import stdin, stdout, argv
try:
from tkinter import *
except ImportError:
from Tkinter import *
@eruvanos
eruvanos / README.md
Last active October 11, 2024 22:14
Simple mock server for testing using Flask

Mock server for testing using flask

License

MIT

Prepare

Install flask and requests to run this example.

@eruvanos
eruvanos / RFSniffer.cpp
Created August 22, 2017 20:48
Sonos Remote Volume Control 433 MHz
std::cout << std::flush
@eruvanos
eruvanos / aws_utils.sh
Last active December 10, 2018 05:11
Useful aws utils for cli
#!/usr/bin/env bash
function load_service_credentials {
service_name=$1
# Read credentials for queue
SERVICE_KEY_JSON=$(cf service-key $service_name key | grep -v "Getting")
export AWS_ACCESS_KEY_ID=$(echo ${SERVICE_KEY_JSON} | jq '.access_key' -r)
export AWS_SECRET_ACCESS_KEY=$(echo ${SERVICE_KEY_JSON} | jq '.secret_access_key' -r)
export AWS_DEFAULT_REGION=$(echo ${SERVICE_KEY_JSON} | jq '.region' -r)
export AWS_URI=$(echo ${SERVICE_KEY_JSON} | jq '.uri' -r)
@eruvanos
eruvanos / template.html
Created April 23, 2018 02:12
Postcard template
<html>
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<title>Lob.com Sample 4x6 Postcard Back</title>
<style>
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
import math
from typing import List
import arcade
class Block:
def __init__(self, x: float, y: float, r: float):
self.x = x
self.y = y