Skip to content

Instantly share code, notes, and snippets.

View JeonghunLee's full-sized avatar
๐Ÿค—
I may be slow to respond.

JeongHun (James) Lee JeonghunLee

๐Ÿค—
I may be slow to respond.
View GitHub Profile
int __io_putchar(int ch)
{
HAL_UART_Transmit(&huart4, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
import cv2
import sys
import pytesseract
import numpy as np
from matplotlib import pyplot as plt
#import matplotlib.pyplot as plt
#
# /usr/share/tesseract-ocr/4.00/tessdata
#
import os
import argparse
import cv2
import numpy as np
import random
import matplotlib.pyplot as plt
from matplotlib.backend_bases import NavigationToolbar2, Event
# https://stackoverflow.com/questions/4098131/how-to-update-a-plot-in-matplotlib
@JeonghunLee
JeonghunLee / gist:c79fb515a32d00583e77adf45a9b9677
Created February 27, 2019 15:54
python Histogram Test program
import cv2
import numpy as np
import random
from matplotlib import pyplot as plt
from matplotlib.backend_bases import NavigationToolbar2
# https://opencv-python.readthedocs.io/en/latest/doc/19.imageHistograms/imageHistograms.html#mask
# https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_histograms/py_histogram_equalization/py_histogram_equalization.html
# https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_histograms/py_histogram_begins/py_histogram_begins.html
@JeonghunLee
JeonghunLee / gist:252480befcbf05d1e7dbc09c875bb813
Created February 27, 2019 15:51
python matplotlib์˜ plot ์‚ฌ์šฉ์‹œ naviationtool bar ์‚ฌ์šฉ
## https://stackoverflow.com/questions/14896580/matplotlib-hooking-in-to-home-back-forward-button-events/15109266
## https://www.csie.ntu.edu.tw/~azarc/sna/matplotlib/lib/matplotlib/backend_bases.py
import matplotlib.pyplot as plt
from matplotlib.backend_bases import NavigationToolbar2, Event
home = NavigationToolbar2.home
back = NavigationToolbar2.back
forward = NavigationToolbar2.forward
/*
* Jeonghun Lee
* Recently, I made FIFO functions by using Array in MSP430 for optimization
*/
#define MAX_TX_BUFF 1024
#define MAX_RX_BUFF 128
/*
1. Execute make first. This will result in a netlinkKernel.ko output among many others.
2. Execute $ gcc netlinkUser.c -o netlinkUser
3. Insert kernel module by :$ sudo insmod netlinkKernel.ko
4. Run ./netlinkUser to see message and run dmesg to see debug messages
5. Remove module by : $ sudo rmmod netlinkKernel
6. Finally make clean to remove output files.
1. Execute make first. This will result in a netlinkKernel.ko output among many others.
2. Execute $ gcc netlinkUser.c -o netlinkUser
3. Insert kernel module by :$ sudo insmod netlinkKernel.ko
4. Run ./netlinkUser to see message and run dmesg to see debug messages
5. Remove module by : $ sudo rmmod netlinkKernel
6. Finally make clean to remove output files.
@JeonghunLee
JeonghunLee / gist:7f702a8729751cfa8186c0df677ff552
Created August 18, 2017 15:01 — forked from ihoneymon/how-to-write-by-markdown.md
๋งˆํฌ๋‹ค์šด ์‚ฌ์šฉ๋ฒ•

[๊ณตํ†ต] ๋งˆํฌ๋‹ค์šด markdown ์ž‘์„ฑ๋ฒ•

1. ๋งˆํฌ๋‹ค์šด์— ๊ด€ํ•˜์—ฌ

1.1. ๋งˆํฌ๋‹ค์šด์ด๋ž€?

**Markdown**์€ ํ…์ŠคํŠธ ๊ธฐ๋ฐ˜์˜ ๋งˆํฌ์—…์–ธ์–ด๋กœ 2004๋…„ ์กด๊ทธ๋ฃจ๋ฒ„์— ์˜ํ•ด ๋งŒ๋“ค์–ด์กŒ์œผ๋ฉฐ ์‰ฝ๊ฒŒ ์“ฐ๊ณ  ์ฝ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ HTML๋กœ ๋ณ€ํ™˜์ด ๊ฐ€๋Šฅํ•˜๋‹ค. ํŠน์ˆ˜๊ธฐํ˜ธ์™€ ๋ฌธ์ž๋ฅผ ์ด์šฉํ•œ ๋งค์šฐ ๊ฐ„๋‹จํ•œ ๊ตฌ์กฐ์˜ ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ์›น์—์„œ๋„ ๋ณด๋‹ค ๋น ๋ฅด๊ฒŒ ์ปจํ…์ธ ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๋ณด๋‹ค ์ง๊ด€์ ์œผ๋กœ ์ธ์‹ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋งˆํฌ๋‹ค์šด์ด ์ตœ๊ทผ ๊ฐ๊ด‘๋ฐ›๊ธฐ ์‹œ์ž‘ํ•œ ์ด์œ ๋Š” ๊นƒํ—™(https://github.com) ๋•๋ถ„์ด๋‹ค. ๊นƒํ—™์˜ ์ €์žฅ์†ŒRepository์— ๊ด€ํ•œ ์ •๋ณด๋ฅผ ๊ธฐ๋กํ•˜๋Š” README.md๋Š” ๊นƒํ—™์„ ์‚ฌ์šฉํ•˜๋Š” ์‚ฌ๋žŒ์ด๋ผ๋ฉด ๋ˆ„๊ตฌ๋‚˜ ๊ฐ€์žฅ ๋จผ์ € ์ ‘ํ•˜๊ฒŒ ๋˜๋Š” ๋งˆํฌ๋‹ค์šด ๋ฌธ์„œ์˜€๋‹ค. ๋งˆํฌ๋‹ค์šด์„ ํ†ตํ•ด์„œ ์„ค์น˜๋ฐฉ๋ฒ•, ์†Œ์Šค์ฝ”๋“œ ์„ค๋ช…, ์ด์Šˆ ๋“ฑ์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ธฐ๋กํ•˜๊ณ  ๊ฐ€๋…์„ฑ์„ ๋†’์ผ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฐ•์ ์ด ๋ถ€๊ฐ๋˜๋ฉด์„œ ์ ์  ์—ฌ๋Ÿฌ ๊ณณ์œผ๋กœ ํผ์ ธ๊ฐ€๊ฒŒ ๋œ๋‹ค.

1.2. ๋งˆํฌ๋‹ค์šด์˜ ์žฅ-๋‹จ์ 

1.2.1. ์žฅ์ 

/*
ย  Refer to https://github.com/meyerd/flex-bison-example
ย  Definitions
C์ฝ”๋“œ ์‚ฝ์ž…์‹œ %{, }% ๊ธฐํ˜ธ
*/
%option noyywrap // flex
%{
#include <stdio.h>