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 / 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 / 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
set modeline
set modelines=1
set autoindent
set softtabstop=2
set tabstop=2
set shiftwidth=2
set paste
set expandtab
set showmatch
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
@johanek
johanek / Result.json
Last active October 2, 2017 13:49 — forked from anonymous/esquery1.json
ES query
{
"took": 380,
"timed_out": false,
"_shards": {
"total": 12,
"successful": 12,
"failed": 0
},
"hits": {
"total": 16435165,
@johanek
johanek / gist:57120f1197fe50490e54647e7b65da35
Created March 31, 2017 13:26
kafka partition assignments
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG OWNER
logstash logstash 0 345741342 345741345 3 logstash_XN-XENVM-S-36-LDP12-GB-1490964963638-9c1bed6f-0
logstash logstash 1 345149976 345150037 61 logstash_XN-XENVM-S-37-LDP12-GB-1490965745465-d5f8b8ec-0
logstash logstash 2 345843572 345843615 43 logstash_XN-XENVM-S-38-LDP12-GB-1490964429516-1dda8bb8-0
logstash logstash 3 345739695 345739776 81 logstash_XN-XENVM-S-62-LDP12-GB-1490964068966-6032fa53-0
logstash logstash 4 345152482 345152526 44 logstash_XN-XENVM-S-63-LDP12-GB-1490966152551-74ad8874-0
logstas
@johanek
johanek / building.md
Last active May 30, 2017 13:39
Building Works TODO List

Random

  • Look for temp kitchen options

Design Decisions Loft

  • Choose fire doors
  • Choose pocket door kit
  • Choose new door furniture
  • Choose heated towel rail
@johanek
johanek / gist:1d7951d9548cba96078a5e57fc23c227
Last active August 28, 2017 10:58
Install docker + docker-compose on ubuntu
#!/bin/bash
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-engine python-pip
pip install docker-compose

Keybase proof

I hereby claim:

  • I am johanek on github.
  • I am johanek (https://keybase.io/johanek) on keybase.
  • I have a public key ASCCaBL1jqsVBrvKhfAY5HEbt3xUBCBzJvzIwKtFNLnVawo

To claim this, I am signing this object:

sudo rm /etc/ld.so.conf.d/dneg-*
sudo ldconfig
env PYTHONPATH="" LD_LIBRARY_PATH="" /usr/bin/python.orig
import salt
import salt.loader
__opts__ = salt.config.minion_config('/etc/salt/minion')
__grains__ = salt.loader.grains(__opts__)
__opts__['grains'] = __grains__
__salt__ = salt.loader.minion_mods(__opts__)