Skip to content

Instantly share code, notes, and snippets.

@yagizdemirsoy
yagizdemirsoy / pom.xml
Last active August 19, 2017 11:43
pom.xml file for Medium kafka streams example
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>kafkastream</groupId>
<artifactId>kafkastream</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
@yagizdemirsoy
yagizdemirsoy / kafka-commands.md
Last active August 19, 2017 13:01
Kafka Topic Specific Commands

Create Kafka Topic

kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic product-raw-data

Update Kafka Topic Configuration

kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name product-raw-data --alter --add-config max.message.bytes=1000000
@yagizdemirsoy
yagizdemirsoy / local_port_redirection.md
Last active April 5, 2017 19:29
Define alias to local ip and redirect localhost:{port} to defined ip.

Define alias to local ip and redirect localhost:{port} to defined ip.

sudo ifconfig lo0 10.0.0.1 alias

echo "rdr pass on lo0 inet proto tcp from any to 10.0.0.1 port 80 -> 127.0.0.1 port 9000" | sudo pfctl -ef -

@yagizdemirsoy
yagizdemirsoy / process_using_port.md
Last active April 5, 2017 19:23
Find process using port on Mac OS X

Find process using port on Mac OS X

lsof -i tcp:3000 
@yagizdemirsoy
yagizdemirsoy / MongoIncrementalValues.md
Last active March 21, 2017 11:20
Mongo Update Queries

Add new field to mongo document and set incremental values

var cursor = db.getCollection("FacetTest").find();

var i = 1;
cursor.forEach(function(x){
    db.getCollection("FacetTest").update({_id: x._id}, {$set:{Order: NumberInt(i)}}, {
 upsert: false,
@yagizdemirsoy
yagizdemirsoy / capitalize_json.py
Last active March 19, 2017 10:54
Python 3 - Traverse json recursively and capitalize first letters of each key.
import simplejson as json
import json
def main():
with open('input.json', encoding='utf-8') as json_data:
data = json.load(json_data)
d = capitalize(data)
print(json.dumps(d, indent=4, sort_keys=True))
def capitalize(x):