I hereby claim:
- I am hiimivantang on github.
- I am hiimivantang (https://keybase.io/hiimivantang) on keybase.
- I have a public key ASBGFt6G5OMl1nucZmt972ZAg7IZz1No_IAxVmI8dAUUrQo
To claim this, I am signing this object:
import tweepy | |
from tweepy import auth | |
CONSUMER_KEY="" #FIXME | |
CONSUMER_SECRET="" #FIXME | |
TOKEN_KEY="" #FIXME | |
TOKEN_SECRET="" #FIXME | |
#override tweepy.StreamListener to add logic to on_status |
import gdax | |
class OrderBookProducer(gdax.WebsocketClient): | |
def on_open(self): | |
self.products = ["ETH-BTC"] | |
self.channels = ["level2"] | |
def on_message(self, msg): | |
if msg['type'] == 'snapshot': | |
print(msg) | |
def on_close(self): | |
print("-- Goodbye! --") |
passwd: | |
users: | |
- name: core | |
ssh_authorized_keys: | |
- ssh-rsa xxxxx ivantang@ngpdev | |
networkd: | |
units: | |
- name: internet.network | |
contents: | |
I hereby claim:
To claim this, I am signing this object:
from aiokafka import AIOKafkaConsumer | |
import asyncio | |
import random | |
import json | |
import sys | |
async def no_sleep(previous_attempt_number, delay_since_first_attempt_ms): | |
"""Don't sleep at all before retrying.""" | |
return 0 |
--- | |
all: | |
vars: | |
#secrets_protection_enabled: true | |
#secrets_protection_masterkey: "" | |
#secrets_protection_security_file: "/usr/secrets/security.properties" | |
ansible_connection: ssh | |
ansible_user: <<UPDATE: user with ssh access>> | |
ansible_become: true | |
ansible_ssh_private_key_file: <<UPDATE: private key location>> |
--- | |
- name: Simulating latency | |
hosts: all | |
vars: | |
latency_ms: 50 | |
packet_loss_percent: 1 | |
network_interface: eth0 | |
remove_qdisc: false | |
tasks: | |
- name: Install tc |
from prometheus_client import start_http_server, Metric, REGISTRY | |
import json | |
import requests | |
import sys | |
import time | |
class JsonCollector(object): | |
def collect(self): |
#!/bin/bash | |
brokers="localhost:9092" | |
topic=<YOUR TOPIC> | |
sum_1=$(/<YOUR_KAFKA_BIN_DIRECTORY>/kafka-run-class kafka.tools.GetOffsetShell --broker-list $brokers --topic $topic --time -1 | grep -e ':[[:digit:]]*:' | awk -F ":" '{sum += $3} END {print sum}') | |
sum_2=$(/<YOUR_KAFKA_BIN_DIRECTORY>/kafka-run-class kafka.tools.GetOffsetShell --broker-list $brokers --topic $topic --time -2 | grep -e ':[[:digit:]]*:' | awk -F ":" '{sum += $3} END {print sum}') | |
echo "Number of records in topic ${topic}: "$((sum_1 - sum_2)) |
############################ | |
# kafka-topics | |
############################ | |
#Prints topics with offline partitions | |
kafka-topics --zookeeper <HOSTNAME>:<PORT> --describe --unavailable-partitions |\ | |
sed -r 's/^\s+Topic:\s+(.*)\s+Partition:.*$/\1/' | |
#Prints offline partitions | |
kafka-topics --zookeeper <HOSTNAME>:<PORT> --describe --unavailable-partitions |\ |