Skip to content

Instantly share code, notes, and snippets.

View johanek's full-sized avatar

Johan van den Dorpe johanek

View GitHub Profile
@johanek
johanek / nftables.conf
Created December 29, 2023 09:50
nftables nat tftp
table ip nat {
chain prerouting {
type nat hook prerouting priority dstnat; policy accept;
}
chain postrouting {
type nat hook postrouting priority srcnat; policy accept;
oifname "eth0" masquerade
}
}
@johanek
johanek / chocolatey.txt
Created July 12, 2022 09:26
chocolatey
# Powershell Functions
Import-Module C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1
@johanek
johanek / cases_admissions.csv
Created March 6, 2021 10:31
Covid cases and admissions
date newAdmissions newCasesBySpecimenDate
2021-03-03 4971
2021-03-02 6448
2021-03-01 811 6887
2021-02-28 769 4727
2021-02-27 742 4818
2021-02-26 866 6597
2021-02-25 972 7760
2021-02-24 1023 8552
2021-02-23 1120 9443
@johanek
johanek / snippets.md
Last active February 11, 2021 11:16
Openshift Elasticsearch

Test Openshift Elasticsearch from Fluentd

oc project openshift-logging
oc rsh fluentd-xxxxx
curl -tls1.2 -s -k -vvv --cert /var/run/ocp-collector/secrets/fluentd/tls.crt --key /var/run/ocp-collector/secrets/fluentd/tls.key https://elasticsearch.openshift-logging.svc.cluster.local:9200

Test Openshift Elasticsearch from Elasticsearch

oc exec -n openshift-logging elasticsearch-cdm-xv88c21d-1-787549f9d4-vfbkp -- curl -tls1.2 -s -k --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key http://localhost:9200

@johanek
johanek / words.md
Created July 6, 2020 10:03 — forked from fogleman/words.md
Mnemonic Encoding Word List

Mnemonic Encoding Word List

http://web.archive.org/web/20090918202746/http://tothink.com/mnemonic/wordlist.html

  • The wordlist contains 1626 words.
  • All words are between 4 and 7 letters long.
  • No word in the list is a prefix of another word (e.g. visit, visitor).
  • Five letter prefixes of words are sufficient to be unique.
  • The words should be usable by people all over the world. The list is far from perfect in that respect. It is heavily biased towards western culture and English in particular. The international vocabulary is simply not big enough. One can argue that even words like "hotel" or "radio" are not truly international. You will find many English words in the list but I have tried to limit them to words that are part of a beginner's vocabulary or words that have close relatives in other european languages. In some cases a word has a different meaning in another language or is pronounced very differently but for the purpose of the encoding it is still ok - I assume that when the encoding is

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
@johanek
johanek / lvcache.txt
Last active March 10, 2020 16:00
lvcache
lvcreate -l 100%FREE -n lv_elasticsearch vg_elasticsearch /dev/md1
lvcreate -L 1T -n lv_cache vg_elasticsearch /dev/nvme0n1
lvcreate -L 1G -n lv_cache_meta vg_elasticsearch /dev/nvme0n1
lvconvert --type cache-pool --chunksize 256K --cachemode writeback --poolmetadata vg_elasticsearch/lv_cache_meta vg_elasticsearch/lv_cache
lvconvert --type cache --cachepool vg_elasticsearch/lv_cache vg_elasticsearch/lv_elasticsearch
@johanek
johanek / kafka.json
Created February 21, 2019 19:13
Sensu Kafka Extension
{
"kafka": {
"servers": [
"kafka1:9092",
"kafka2:9092"
],
"topic": "sensu"
}
}
@johanek
johanek / puppetfile.rb
Created January 10, 2019 16:28
dependencies from puppetfile
#!/usr/bin/env ruby
require 'pry'
require 'puppet_forge'
PuppetForge.user_agent = 'puppetfile/0.9.0'
Module_Regex = Regexp.new("mod ['\"]([a-z0-9_]+\/[a-z0-9_]+)['\"](, ['\"](\\d\.\\d\.\\d)['\"])?", Regexp::IGNORECASE)
def cleanname(name)
@johanek
johanek / python_basics.md
Last active August 31, 2021 08:59
[python basics] #python

List files in a directory

os.listdir(path)

List files recursively

os.walk(path)

Read YAML file

with open("data.yaml", 'r') as stream:
	data_loaded = yaml.load(stream)