Skip to content

Instantly share code, notes, and snippets.

@wreulicke
wreulicke / DelegatingMDCInheritableExecutorService.java
Last active April 24, 2024 17:25
ExecutorService/ScheduledExecutorServiceでMDC引き回すやつ
package com.github.wreulicke.mdc;
import org.slf4j.MDC;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
public class DelegatingMDCInheritableExecutorService extends AbstractExecutorService {
@wreulicke
wreulicke / Main.java
Created March 31, 2023 17:49
slf4j経由でLog4j2を使う時のbuild.gradleとmain
import org.slf4j.bridge.SLF4JBridgeHandler;
public class Main {
public static void main(String[] args) {
// java.util.loggingのロガーをslf4jに入れ替えている
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
}
}
@wreulicke
wreulicke / main.go
Created February 13, 2023 00:12
Collect unused datasources in terraform
package main
import (
"fmt"
"log"
"os"
"strings"
"github.com/awalterschulze/gographviz"
)
@wreulicke
wreulicke / child-pom.xml
Created January 20, 2023 05:16
maven super pom dependency inheritance test
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github</groupId>
<artifactId>maven-test-child</artifactId>
<version>1.0-SNAPSHOT</version>
@wreulicke
wreulicke / container-limits
Last active December 13, 2022 11:03
quarkus getting started
#!/bin/sh
# Detected container limits
# If found these are exposed as the following environment variables:
#
# - CONTAINER_MAX_MEMORY
# - CONTAINER_CORE_LIMIT
#
# This script is meant to be sourced.
@wreulicke
wreulicke / test.js
Created February 6, 2021 01:37
async_hooksで遊んでみた
const async_hooks = require('async_hooks')
const map = new Map()
let beforeCount = 0
let afterCount = 0
const hook = async_hooks.createHook({
init(asyncId, type, triggerAsyncId, resource) {
const context = map.get(triggerAsyncId)
@wreulicke
wreulicke / README.md
Created September 28, 2020 16:10
pprofのprotoファイルのあるディレクトリのREADMEの和訳
@wreulicke
wreulicke / README.md
Last active May 14, 2022 16:55
Windowless percentile tracking の和訳

https://mjambon.com/2016-07-23-moving-percentile/ の和訳です。

ウィンドウなしパーセンタイルのトラッキング

これは exponential moving average (指数平滑移動平均)と同じ制約によって駆動する手法ですが 中央値やパーセンタイル値のための手法です。 時間によって分布の変化するような観察結果の無限ストリームにおける中央値などのパーセンタイルのトラッキングのためにアルゴリズムを示します。 自ら課した制約はメモリに直近のNの観察結果を明示的に持つことを与えません。 私達のアルゴリズムでは、予測されたパーセンタイルのアップデートのコストはO(1)でそのメモリ使用量もまたO(1)です。

@wreulicke
wreulicke / LICENSE
Last active March 22, 2023 06:47
Minimal packet parser for socket.io
MIT License
Copyright (c) 2020 wreulicke
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 main
import (
"log"
"gopkg.in/gographics/imagick.v2/imagick"
)
func mainInternal() error {
pdfName := "test.pdf"