Skip to content

Instantly share code, notes, and snippets.

View ymkim92's full-sized avatar

Youngmin Kim ymkim92

  • Topcon Positioning Systems
  • Brisbane, Australia
View GitHub Profile
@ymkim92
ymkim92 / epolltest.c
Last active May 15, 2023 01:38 — forked from jadonk/epolltest.c
Quick test using epoll to wait on GPIO events
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/epoll.h>
#include <sys/types.h>
int main(int argc, char** argv) {
@ymkim92
ymkim92 / screenoff.md
Last active April 30, 2023 01:32
# screen on and off by command in ubunu

How to detect if it uses x11 or wayland by command

If it uses the wayland, WAYLAND_DISPLAY has a wayland name.

$ echo $WAYLAND_DISPLAY
wayland-0

Otherwise, it will be null.

@ymkim92
ymkim92 / pyramid.py
Created November 5, 2022 01:07
Find x in this pyramid by Pythagorean theorem (3D drawing by matplotlib)
"""Find x in this pyramid
by Pythagorean theorem
3D drawing by matplotlib"""
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
@ymkim92
ymkim92 / firefox_history.py
Created July 12, 2021 05:38
Read some columns from a table of firefox history data
import sqlite3
import click
from datetime import datetime
DB = 'places.sqlite'
@click.command()
@click.option('-s', '--start-time', type=click.DateTime(formats=["%Y-%m-%dT%H:%M"]))
@click.option('-e', '--end-time', type=click.DateTime(formats=["%Y-%m-%dT%H:%M"]))
def firefox_history(start_time, end_time):
@ymkim92
ymkim92 / remove_log_in_var.md
Last active July 1, 2021 22:23
Clean up the big size logs in /var folder

Clean up the big size logs in /var folder

When I compiled tdesktop through docker, I met an error of "out of space". After I spent some time I found it was because the docker wrote a lot of logs in /var folder.

To clean up the logs, you can follow these steps:

  • Find the big size files in /var/lib/docker.

find /var/lib/docker -size +10M

@ymkim92
ymkim92 / vscode-on-ubuntu.md
Last active June 25, 2021 01:52 — forked from philoskim/vscode-on-ubuntu.adoc
Ubuntu에서 Visual Studio Code 한글 입력 안되는 현상 해결법

Ubuntu에서 Visual Studio Code 한글 입력 안되는 현상 해결법

Ubuntu 19.10에서 Visual Studio Code 사용 중 한영 전환키를 누르고 한글을 입력하려 했더니, 한글 입력이 안되고 영어만 계속 입력되는 현상을 발견했다. 그래서 인터넷을 검색해 봤더니 snap 형식의 Visual Studio Code를 설치한 경우에, Ubuntu의 입력기인 IBus와 충돌해서 일어나는 현상이라고 한다. 그런데 .deb 형식의 Visual Studio Code를 설치한 경우에는 그런 문제가 없다는 사실을 알게 되어, 설치해 봤더니 한글 입력이 정상적으로 이루어지는 것을 확인했다. 그래서 같은 문제를 겪는 사람들을 위해 이 해결법을 공유하고자 한다.

  • 먼저 이미 설치되어 있는 snap 형식의 Visual Studio Code를 제거한다.
@ymkim92
ymkim92 / anal_candump_canopen.py
Created December 21, 2020 00:20
Analysis the candump of canopen with vscode and matplotlib
# candump can0 -ta
# data analysis
'''
(1541915735.968732) can0 000 [2] 81 74
(1541915735.978482) can0 774 [1] 00
(1541915735.978591) can0 774 [1] 7F
(1541915735.983890) can0 674 [8] 2B 17 10 00 90 01 00 00
(1541915735.984228) can0 5F4 [8] 60 17 10 00 00 00 00 00
time dev canid size data
'''
@ymkim92
ymkim92 / ledgui.c
Last active September 23, 2020 02:17
GTK application with threads
// gcc ledgui.c `pkg-config --cflags gtk+-3.0 pkg-config --libs gtk+-3.0`
// It will have very high CPU load when you run this code.
// You can find the fixed version of this code at here:
// https://stackoverflow.com/questions/64019411/very-high-cpu-load-when-i-run-my-own-simple-gtk-application
#include <gtk/gtk.h>
#include <string.h>
#include <stdlib.h>
#define LED_COLOR_RED 0
@ymkim92
ymkim92 / stats.py
Created December 13, 2019 05:39
matplotlib ploting with button to print stats and tooltip on hover
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import mplcursors
df = pd.DataFrame()
fig, ax = plt.subplots()
@ymkim92
ymkim92 / Sample collected data
Created December 10, 2019 23:07
Collect sold house data from domain.com.au
,lat,lng,street,suburb,auction,property_type,land_size,land_unit,baths,beds,parking,price,sold,date
0,-27.2223167,153.027618,,MANGO HILL,,House,809.0,m²,1,3,4,350000,Sold by private treaty,
1,-27.183754,153.021286,6 Logan Terrace,DECEPTION BAY,,House,622.0,m²,1,3,1,320000,Sold by private treaty,
2,-27.7408962,153.091751,"45-59 Rossmore Road,",CHAMBERS FLAT,,House,0.0,m²,3,6,4,1260000,Sold by private treaty 06 Dec 2019,2019-12-06
3,-27.04538,153.144241,103 Sunderland Drive,BANKSIA BEACH,,House,546.0,m²,1,3,3,370000,Sold by private treaty 05 Dec 2019,2019-12-05
4,-27.42381,153.059616,8 Bennison Street,ASCOT,,House,962.0,m²,2,5,2,2250000,Sold by private treaty 05 Dec 2019,2019-12-05
5,-27.1455879,152.975281,7 Ogilvy Road,BURPENGARY,,House,1133.0,m²,2,3,2,545000,Sold by private treaty 06 Dec 2019,2019-12-06
6,-27.02739,153.150085,16 Honeymyrtle Street,BANKSIA BEACH,,House,0.0,m²,2,3,2,507500,Sold by private treaty 05 Dec 2019,2019-12-05
7,-27.033287,153.125656,78 White Patch Esplanade,WHITE PATCH,,House,2023.0,m²