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
# 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) |
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 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', |
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 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 | |
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 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) |
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
#! /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) |