Skip to content

Instantly share code, notes, and snippets.

View jaeoh2's full-sized avatar
๐Ÿ˜ƒ

Jaeoh Lee jaeoh2

๐Ÿ˜ƒ
View GitHub Profile
@jaeoh2
jaeoh2 / gprmc.py
Last active May 2, 2025 21:42
NMEA GPRMC Python Parser
#!/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):
@jaeoh2
jaeoh2 / main.js
Created November 5, 2021 06:17
Javascript 7 segment LAB Timer using Arduino and Keyes IR Obstacle Avoidance Sensor Module.
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');
});
@jaeoh2
jaeoh2 / joystick.py
Last active July 20, 2022 02:00
python_xbox_controller
# 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):
@jaeoh2
jaeoh2 / python_thread_test.py
Created April 13, 2021 14:13
Python threading Timer callback example
import time
import threading
ser = 0
start_time = time.time()
def callback():
global ser, start_time
if ser == 1:
@jaeoh2
jaeoh2 / 2s_comp.cpp
Created March 6, 2019 02:27
Two's complement Upscaler
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:
@jaeoh2
jaeoh2 / CAN.cpp
Created February 14, 2019 07:49
CAN bitfield parser for ROS callback
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;
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.
@jaeoh2
jaeoh2 / tf_cmp_cpu_gpu.py
Created January 4, 2017 06:58
Tensorflow CNN performance comparison (CPU vs GPU) with mnist dataset
"""
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
@jaeoh2
jaeoh2 / kerasRNN_model.py
Created December 8, 2016 00:26
keras RNN model (TimeDistributed wrapper)
#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))
@jaeoh2
jaeoh2 / read_mat.py
Created December 7, 2016 15:29
read .mat(hdf5) file to python
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))