This file contains hidden or 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/env python3 | |
import sys | |
import time | |
import serial | |
import threading | |
class GPSRMC(object): | |
def __init__(self, dev='/dev/ttyUSB0', timeout=0.5, interval=0.1): |
This file contains hidden or 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
const express = require('express'); | |
const app = express(); | |
const five = require('johnny-five'); | |
const board = new five.Board(); | |
app.get('', (req, res) => { | |
res.sendFile(__dirname + '/timer.html'); | |
}); |
This file contains hidden or 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
# ref from : https://stackoverflow.com/questions/46506850/how-can-i-get-input-from-an-xbox-one-controller-in-python | |
from inputs import get_gamepad | |
import math | |
import threading | |
class XboxController(object): | |
MAX_TRIG_VAL = math.pow(2, 8) | |
MAX_JOY_VAL = math.pow(2, 15) | |
def __init__(self): |
This file contains hidden or 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 threading | |
ser = 0 | |
start_time = time.time() | |
def callback(): | |
global ser, start_time | |
if ser == 1: |
This file contains hidden or 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
template <typename Target, size_t Length> | |
// https://www.codeproject.com/Tips/1079637/Twos-Complement-for-Unusual-Integer-Sizes | |
class TwosComplementUpscaler | |
{ | |
Target bitfield : Length; | |
TwosComplementUpscaler(Target value) : bitfield(value){} | |
TwosComplementUpscaler(); | |
public: |
This file contains hidden or 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
typedef struct CAN_msgTag | |
{ | |
uint8_t Sig_1 : 8; | |
uint8_t Sig_2 : 8; | |
uint8_t Sig_3 : 8; | |
uint8_t Sig_4 : 8; | |
uint8_t Sig_5 : 8; | |
uint8_t Sig_6 : 8; | |
uint8_t Sig_7 : 8; | |
uint8_t Sig_8 : 8; |
This file contains hidden or 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 __future__ import print_function | |
''' | |
Basic Multi GPU computation example using TensorFlow library. | |
Author: Aymeric Damien | |
Project: https://github.com/aymericdamien/TensorFlow-Examples/ | |
''' | |
''' | |
This tutorial requires your machine to have 2 GPUs | |
"/cpu:0": The CPU of your machine. |
This file contains hidden or 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
""" | |
Based from : https://github.com/sjchoi86/tensorflow-101/blob/master/notebooks/cnn_mnist_simple.ipynb | |
""" | |
import tensorflow as tf | |
import os | |
import sys | |
import time | |
from tensorflow.examples.tutorials.mnist import input_data |
This file contains hidden or 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
#build model many to one | |
embedding_vector_length = 32 | |
model = Sequential() | |
model.add(Embedding(input_dim=top_words, | |
output_dim=embedding_vector_length, | |
input_length=max_review_length)) | |
model.add(LSTM(100, return_sequences=True)) | |
model.add(Dropout(0.2)) | |
model.add(LSTM(100, return_sequences=True)) | |
model.add(Dropout(0.2)) |
This file contains hidden or 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 h5py | |
import numpy as np | |
with h5py.File('mydatafile.mat','r') as hf: | |
print('List of arrays in this file:{}'.format(hf.keys())) | |
data = hf.get('dataset_1') | |
np_data = np.array(data) | |
print('Shape of the array dataset_1:{}.format(np_data.shape)) |
NewerOlder