Skip to content

Instantly share code, notes, and snippets.

View sincejune's full-sized avatar

Chao Weng sincejune

View GitHub Profile
#! /usr/bin/env python
import json
import datetime
import pytz
from kafka import KafkaConsumer
def is_json(o):
try:
@sincejune
sincejune / cryptography.sh
Created April 24, 2018 10:10
cryptography
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
from kafka import KafkaProducer
import time
import json
producer = KafkaProducer(value_serializer=lambda m: json.dumps(m).encode('utf-8'), bootstrap_servers=['localhost:9092'])
while True:
time.sleep(0.001)
producer.send(topic, {'message': time.time()})
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
:%s/\v[^\x00-\xff]+//g
pip freeze | xargs pip uninstall -y
@sincejune
sincejune / findMax.java
Created October 25, 2016 02:02
Find the maximum value of three numbers
private static int findMax(int a, int b, int c)
{
return ((a > b ? a : b) > c) ? (a > b ? a : b) : c;
}