Skip to content

Instantly share code, notes, and snippets.

View sincejune's full-sized avatar

Chao Weng sincejune

View GitHub Profile
@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;
}
pip freeze | xargs pip uninstall -y
:%s/\v[^\x00-\xff]+//g
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()})
@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
#! /usr/bin/env python
import json
import datetime
import pytz
from kafka import KafkaConsumer
def is_json(o):
try:
sudo tcpdump -i lo -w ./target.cap tcp port 9200
@sincejune
sincejune / wireshark.sh
Created May 30, 2018 14:26
wireshark work with tcpdump
wireshark -k -i <(ssh [email protected] "sudo tcpdump -w - -i lo tcp port 9200")
{"default-ulimits": {"nofile": {"100:200"}}}