Skip to content

Instantly share code, notes, and snippets.

View dkorunic's full-sized avatar
🏋️
↑↑↓↓←→←→BA

Dinko Korunic dkorunic

🏋️
↑↑↓↓←→←→BA
View GitHub Profile
@dkorunic
dkorunic / haproxy_access.rb
Created October 14, 2022 09:49
HAProxy access logs rulebase for rsyslog
version=2
type=@request_time:[%day:char-to:/%/%mon:char-to:/%/%year:number%:%time:time-24hr% %zone:char-to:]%]
rule=:%-:alternative{"parser":[{"type":"ipv4","name":"client_ip"},{"type":"ipv6","name":"client_ip"}]}% - - %request_time:@request_time% "%request_method:word% %request_uri:word% %request_version:char-to:"%" %response_code:float{"format":"string"}% %-:alternative{"parser":[{"type":"literal","text":"+","name":"logasap"},{"type":"literal","text":""}]}%%response_bytes:float{"format":"string"}% "" "" %-:alternative{"parser":[{"type":"float","format":"string","name":"client_port"},{"type":"word"}]}% %accept_ms:number{"format":"string"}% "%frontend_name:char-to:"%" "%backend_name:char-to:"%" "%server_name:char-to:"%" %timer_TR:float{"format":"string"}% %timer_Tw:float{"format":"string"}% %timer_Tc:float{"format":"string"}% %timer_Tr:float{"format":"string"}% %timer_Ta:float{"format":"string"}% %termination_state:word% %active_conn:float{"format":"string"}% %frontend_conn:float{"format":"string"}% %backend_
@dkorunic
dkorunic / convert-lang-mkv.sh
Last active December 16, 2022 17:25
Simple tool to strip all languages except the desired one from a mkv file
#!/bin/sh
# Copyright (C) 2022 Dinko Korunic
# Simple tool to strip all languages except the desired one from a bunch of mkv files in a current folder
# Depends: mkvtoolnix
LANG_CODE="hr"
LANG_TRACK_COUNT=$(mkvinfo -s "$1" | head -50 | grep -c '^Track .*: audio')
@dkorunic
dkorunic / binarytree_arena.go
Last active July 29, 2023 16:15
Go adaptation of binary-trees program with arena allocator
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// Go adaptation of binary-trees program with arena allocator
//
// Forked from https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/binarytrees-go-9.html and
// added arena allocator to have parity with Rust typed_arena version -Dinko Korunic
//
// Final results compared to Rust #2 (https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/binarytrees-rust-2.html)
//
@dkorunic
dkorunic / dirstat.go
Last active January 24, 2019 17:23
File statistics tool in Golang
// @license
// Copyright (C) 2019 Dinko Korunic
//
// 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:
//