I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DEFAULT_GOAL := tiploc_locations.csv | |
naptan.zip: | |
wget -O naptan.zip naptan.app.dft.gov.uk/DataRequest/Naptan.ashx?format=csv | |
Stops.csv: naptan.zip | |
unzip -o naptan.zip | |
tiploc_locations.csv: Stops.csv | |
python run.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This is a script that provides infinite history to get around Alfred's 3-month limit. | |
# It works by regularly backing up and appending the items in the alfred db to a | |
# sqlite database in the user's home folder. It also provides search functionality. | |
# https://www.alfredforum.com/topic/10969-keep-clipboard-history-forever/?tab=comments#comment-68859 | |
# https://www.reddit.com/r/Alfred/comments/cde29x/script_to_manage_searching_backing_up_and/ | |
# Example Usage: | |
# alfred-clipboard.sh backup |
-
Clone ce-kafka checkout 5.3.x and build
gradle && ./gradlew jar
-
Start ZK in ce-kafka repo
./bin/zookeeper-server-start.sh config/zookeeper.properties
-
Start Kafka (change logs to /tmp) in ce-kafka repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt install peco | |
apt install curl | |
curl http://localhost:8081/subjects | jq .[] | tr -d "\"" | peco | xargs -I '{}' curl -v -X DELETE http://localhost:8081/subjects/'{}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Must have sqlite3 installed. Homebrew user? brew install sqlite | |
## Can be ran directly in command line and will place file directory where ran | |
## Remove `-header` if you don't want the output to have the column name `item` | |
## Checkout more options and Workflow - https://github.com/T-Rave/alfred-clipboard-dump | |
# dumps output with list option since single column. Produces cleaner data without double quotes | |
sqlite3 -header -list ~/Library/Application\ Support/Alfred\ 3/Databases/clipboard.alfdb "SELECT item FROM clipboard;" > clipboard-dump.txt | |
# dumps full table to csv format | |
sqlite3 -header -csv ~/Library/Application\ Support/Alfred\ 3/Databases/clipboard.alfdb "SELECT * FROM clipboard;" > clipboard-dump.csv | |
# dumps only items in descending (inverse) order with no column name | |
sqlite3 -list ~/Library/Application\ Support/Alfred\ 3/Databases/clipboard.alfdb "SELECT item FROM clipboard ORDER BY item DESC;" > clipdump.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
# 802.11 probe requests processor | |
# Copyright (C) 2017 Ralon cybersecurity | |
# Loran Kloeze - [email protected] - @lorankloeze | |
# MIT license: do with it what you want but use it for good | |
# | |
# Tested on OS X El Capitan 10.11.6 - MacBook Air | |
# | |
# This script grabs probe requests from the air and outputs them on the screen | |
# and/or saves them to a sqlite3-db. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gzip | |
import csv | |
from elasticsearch import helpers | |
from elasticsearch.client import Elasticsearch | |
import time | |
csv.register_dialect('piper', delimiter='|', quoting=csv.QUOTE_NONE) | |
# See http://postcodepal.com/dbgen/postcode_areas_true-centroids.zip | |
pf=open('/Users/Mark/Documents/work/irdata/MOT/postcode_areas.csv') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"code.google.com/p/go-tour/tree" | |
"fmt" | |
) | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. | |
func Walk(t *tree.Tree, ch chan int) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
## WebLogic Server Log | |
file { | |
type => "weblogic" | |
path => [ "/var/log/weblogic/domain/managedserver.log" ] | |
codec => multiline { | |
pattern => "^####" | |
negate => true | |
what => previous | |
} |
NewerOlder