Skip to content

Instantly share code, notes, and snippets.

View johanek's full-sized avatar

Johan van den Dorpe johanek

View GitHub Profile
set -g prefix C-a
set -g history-limit 200000
# Unbind crap
unbind %
unbind M-1
unbind M-2
unbind M-3
unbind M-4
unbind M-5
set modeline
set modelines=1
set autoindent
set softtabstop=2
set tabstop=2
set shiftwidth=2
set paste
set expandtab
set showmatch
@johanek
johanek / ip_route.txt
Created March 5, 2018 10:24
[ip route unreachable] Simulate dropped data or unreachable destination with ip route
# blackhole all packets destined for 192.168.2.1
ip route add blackhole 192.168.2.1
# to delete the same route, replace add with del
ip route del blackhole 192.168.2.1
#Depending on your use case, an unreachable route may work better, as it returns ICMP-unreachable instead of discarding the packets, although they tend to have the same effect.
ip route add unreachable 192.168.2.1
@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)
@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 / kafka.json
Created February 21, 2019 19:13
Sensu Kafka Extension
{
"kafka": {
"servers": [
"kafka1:9092",
"kafka2:9092"
],
"topic": "sensu"
}
}
@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

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 / 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
@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