Skip to content

Instantly share code, notes, and snippets.

View JensRantil's full-sized avatar

Jens Rantil JensRantil

View GitHub Profile
JensRantil /
Last active April 5, 2024 11:47
This is proof of concept how length of the labels in Graphviz impacts the layout.

This is proof of concept how length of the labels in Graphviz impacts the layout.

JensRantil /
Created January 7, 2023 11:34
Script that generates monthly plain text accounting ( interest records for fixed-rate savings accounts. Amounts are faked.
from collections import namedtuple
from datetime import date, timedelta
import itertools
import logging
JensRantil /
Created March 8, 2022 14:03
Stats on most common author in VueJS project
$ git log -1
commit 6aa11872c88481dfa2da151536317176c48f226c (HEAD -> dev, origin/dev, origin/HEAD)
Author: dependabot[bot] <49699333+dependabot[bot]>
Date: Tue Feb 22 19:38:12 2022 +0100
build(deps): bump ajv from 6.6.2 to 6.12.6 (#12468)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]>
$ find . -type f -exec cat {} + | wc -l
$ sstabledump ./mykeyspace/mytable/mc-12109-big-Data.db | awk '/key/ {print counter, key;counter=0;key=$0;} /^ / {counter++;}' | sort -n | tail -n 40
JensRantil /
Last active January 13, 2023 02:50
Hacky one-liner for estimating progress when adding a new Cassandra node. Run on the join that’s joining and be sure to set NODES to number of nodes in the cluster that are streaming to the new node.
while [ 1 ];do date -Iseconds | tr -d '\n';sudo nodetool netstats | grep Receiving | grep -Eo '[0-9]* bytes' | sed 's/ bytes//' | awk 'BEGIN {NODES=6;} NR%2==1 {TOTAL+=$0;} NR%2==0 {PROGRESS+=$0;} END {NODESRUNNING=NR/2;NODESDONE=NODES-NODESRUNNING;print " progress:", 100*(NODESDONE/NODES+(NODESRUNNING/NODES)*(PROGRESS/TOTAL)) "%", "running:", NODESRUNNING, "done:", NODESDONE;}';sleep 30;done
JensRantil /
Created June 23, 2021 22:31
Small script to simulate rack-aware Cassandra reads/writes.
import random
original = [
["az-A-0", "az-A-1"],
["az-B-0", "az-B-1"],
["az-C-0", "az-C-1"],
remove_rac1 = [
["az-A-0", "az-A-1"],
go 1.15
require ( v1.11.3 // indirect v1.5.1 // indirect v0.0.2 // indirect v1.11.7 // indirect v0.2.0 // indirect
import random
# Number of VMs that will be restarted.
# Bucket the nodes randomly by hashing their hostnames and putting them in hourly buckets.
BUCKETS = 7*24
# Number of simulations we will make.
collisions = 0
JensRantil / example-output.txt
Last active October 23, 2020 14:01
Kafka script to generate Bash commands that will recreate Kafka topics. Possibly useful for backups of topics.
./bin/ --if-not-exists --zookeeper $(grep -E zookeeper.connect= ./config/ | cut -d= -f2) --create --partitions 12 --replication-factor 3 --topic my-topic-1 --config --config min.insync.replicas=2
./bin/ --if-not-exists --zookeeper $(grep -E zookeeper.connect= ./config/ | cut -d= -f2) --create --partitions 1 --replication-factor 3 --topic my-topic-2 --config min.insync.replicas=2
go 1.13
require v0.16.2