kafka-console-consumer.sh --zookeeper {zookeeper-ip}:2181 --topic {topic-name} --from-beginning
🚴♂️
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 ( | |
"strings" | |
"bytes" | |
"fmt" | |
"time" | |
) |
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
def my_decortator(func): | |
def wrapper(*args): | |
print("Run before func") | |
func(*args) | |
print("Run after func") | |
return wrapper | |
def decorator_with_tags(tags): |
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
from faker import Faker | |
import json | |
fake = Faker('en_GB') | |
for i in range(50): | |
medicine = { | |
'name': fake.name(), | |
'manufacturer': fake.company(), | |
'country': fake.country(), |
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
# Graphine Example | |
import graphene | |
import json | |
import string | |
import random | |
class User(graphene.ObjectType): | |
id = graphene.ID() | |
name = graphene.String() |
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
# This script will search for a value in all columns in a MS-SQL db | |
# How to use: | |
# python find_value.py VALUE | |
# It will search for VALUE in every single column in DB and print the table, column and value when found | |
import sys | |
import pymssql | |
try: | |
# Populate your DB credentials | |
conn = pymssql.connect( |
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
#!/bin/bash | |
# Run this file inside your go project | |
# This will format your go files and write to them | |
gofmt -w *.go | |
# It will suggest style mistakes and missing docs, you'll need to manually fix them | |
# to install: go get -u github.com/golang/lint/golint | |
golint *.go |
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
{ | |
"title": "Person", | |
"type": "object", | |
"properties": { | |
"firstName": { | |
"type": "string" | |
}, | |
"lastName": { | |
"type": "string" | |
}, |
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 nltk | |
sentence = """At eight o'clock on Thursday morning | |
... Arthur didn't feel very good.""" | |
tokens = nltk.word_tokenize(sentence) | |
tokens | |
# >>> ['At', 'eight', "o'clock", 'on', 'Thursday', 'morning', | |
# >>> 'Arthur', 'did', "n't", 'feel', 'very', 'good', '.'] | |
tagged = nltk.pos_tag(tokens) | |
tagged[0:6] | |
# >>> [('At', 'IN'), ('eight', 'CD'), ("o'clock", 'JJ'), ('on', 'IN'), |
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
# This will send 500 POST request to yourdomain.com | |
# this snippet can be used to send some data to your local dev API | |
for n in {1..500}; do curl -X POST \ | |
http://yourdomain.com \ | |
-H 'Cache-Control: no-cache' \ | |
-H 'Content-Type: application/json' \ | |
-d '{ | |
"key" :"value" | |
}'; done |
NewerOlder