Skip to content

Instantly share code, notes, and snippets.

View benhubert's full-sized avatar

Benjamin Hubert benhubert

View GitHub Profile
import java.io.*;
import java.net.*;
/**
* Simple UDP server that listens for packets on port 8125 and
* prints them. Intended for testing a StatsD client.
*/
public class StatsdLogger
{
public static void main(String args[]) throws Exception {
@benhubert
benhubert / pom.xml
Created September 20, 2017 11:39
Maven dependency for timgroup
<dependency>
<groupid>com.timgroup</groupid>
<artifactid>java-statsd-client</artifactid>
<version>3.0.1</version>
</dependency>
@benhubert
benhubert / MetricsConfig.java
Created September 20, 2017 11:54
Spring Boot configuration for collecting metrics with StatsD
@Configuration
public class MetricsConfig {
@Bean
public StatsDClient statsDClient(
@Value("${metrics.statsd.host:localhost}") String host,
@Value("${metrics.statsd.port:8125}") int port,
@Value("${metrics.prefix:example.app}") String prefix
) {
return new NonBlockingStatsDClient(prefix, host, port);
}
@benhubert
benhubert / StatsD Example
Created September 20, 2017 11:57
Example for tech.willhaben.at blogpost
statsd.incrementCounter("service.random");
@benhubert
benhubert / example StatsD UDP packet
Created September 20, 2017 11:58
Example StatsD packet for tech.willhaben.at blogpost
example.app.service.random:1|c
@benhubert
benhubert / MethodProfiler.java
Created September 20, 2017 12:05
Example method profiler using AspectJ for StatsD blogpost at tech.willhaben.at
@Aspect
public class MethodProfiler {
private final StatsDClient statsd;
public MethodProfiler(StatsDClient statsd) {
this.statsd = statsd;
}
@Pointcut("execution(* at.willhaben.examples.statsd.rest.RandomController.*(..))")
@benhubert
benhubert / StatsD datadog example
Created September 20, 2017 12:22
example for blogpost at tech.willhaben.at
statsd.recordExecutionTime(“example.stat”, 25, “cluster:foo”, “http.status:200”);
@benhubert
benhubert / remove-jira-detail-view.user.js
Last active March 31, 2020 12:17
Removes detail view from Jira's Rapid Board.
// ==UserScript==
// @name Disable detail view in Jira Rapid Board
// @namespace https://tampermonkey.benjaminhubert.at/
// @version 1.7
// @description Removes the detail view from Jira's Rapid Board which is an annoying feature in my eyes.
// @author Benjamin Hubert, Lukas Schneider, Florian Mautendorfer
// @match https://*/secure/RapidBoard.jspa*
// @grant none
// @require http://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==
@benhubert
benhubert / merge-git-repos.sh
Created March 28, 2019 20:56
Merge git repositories and keep their history
# Initialize the new repository in an empty directory
git init
# Before we can do a merge, we need some initial commit. Create a file that's
# not part of any of the repos you want to merge, for example
touch delete-me-afterwards.txt
git add .
git commit -m "initial commit"
@benhubert
benhubert / cryptsetup.md
Last active January 19, 2021 20:35
cryptsetup cheat sheet

cryptsetup cheat sheet

Wipe disk

cryptsetup open --type plain -d /dev/urandom /dev/sdX to-be-wiped
dd if=/dev/zero of=/dev/mapper/to-be-wiped status=progress bs=4M
cryptsetup close to-be-wiped