Skip to content

Instantly share code, notes, and snippets.

View outtoin's full-sized avatar
🎯
Focusing

Seungwoo Lee outtoin

🎯
Focusing
  • Hyperconnect
  • Seoul, Republic of Korea
View GitHub Profile
# with sigmoid function -> accuracy : 0.9108
W1 = tf.Variable(tf.random_normal([784, neurons]), name='weight1')
b1 = tf.Variable(tf.random_normal([neurons]), name='bias1')
logits1 = tf.matmul(X, W1) + b1
layer1 = tf.sigmoid(logits1)
W2 = tf.Variable(tf.random_normal([neurons, neurons]), name='weight2')
b2 = tf.Variable(tf.random_normal([neurons]), name='bias3')
logits2 = tf.matmul(layer1, W2) + b2
layer2 = tf.sigmoid(logits2)
import time
import serial
import traceback
import signal
import sys
import codecs
# configure the serial connections (the parameters differs on the device you are connecting to)
ser = serial.Serial(
port='COM6',
from kafka import KafkaProducer
from confluent_kafka import Producer
import multiprocessing
Class KProducer(object):
def __init__(self, bootstrap_servers, cbootstrap_servers, topic):
self.producer = KafkaProducer(bootstrap_servers=bootstrap_servers)
self.cproducer = Producer({'bootstrap.servers': cbootstrap_servers})
self.topic = topic
@outtoin
outtoin / checksum.py
Created May 1, 2019 13:13
checksum.py
def checksum(msg):
ck_a = 0
ck_b = 0
for i in msg:
ck_a = ck_a + i
ck_b = ck_b + ck_a
ck_a = ck_a % 256
ck_b = ck_b % 256
return (ck_a, ck_b)
#! /usr/bin/python
import socket
import time
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client_host = ('0.0.0.0', 0)
while True:
try:
client.sendto(b'1',client_host)
time.sleep(1)