Skip to content

Instantly share code, notes, and snippets.

View simryang's full-sized avatar

Joseph simryang

  • WIZnet
  • 성남시
  • 16:57 (UTC +09:00)
View GitHub Profile
@simryang
simryang / test_php-cgi_version.sh
Created December 22, 2020 13:08
php-cgi version
# php-cgi --version
PHP 7.2.21 (cgi-fcgi)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
@simryang
simryang / enable-service-sudo.sh
Last active January 22, 2021 02:59
Add /etc/sudoers.d/97-ssh-service.conf file to start ssh service with sudo privilege on windows 10 startup
echo "%sudo ALL=NOPASSWD: /usr/sbin/service" | sudo tee /etc/sudoers.d/97-ssh-service
sudo chmod 0440 /etc/sudoers.d/97-ssh-service
@simryang
simryang / libc-bin_fix.sh
Last active March 10, 2021 17:07
libc-bin and ldconfig problem fix
$ apt download libc-bin
받기:1 http://mirror.kakao.com/ubuntu bionic-updates/main amd64 libc-bin amd64 2.27-3ubuntu1.4 [643 kB]
내려받기 643 k바이트, 소요시간 0초 (4,890 k바이트/초)
$ ls
libc-bin_2.27-3ubuntu1.4_amd64.deb
$ dpkg -x libc-bin_2.27-3ubuntu1.4_amd64.deb libc-bin_2.27
$ sudo cp libc-bin_2.27/sbin/ldconfig /sbin
$ sudo apt install --reinstall libc-bin
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다
@simryang
simryang / getSystemDns.py
Created March 14, 2021 23:55
Get DNS1, DNS2 addresses in openwrt
def getSystemDns() -> tuple:
"""returns dns1, dns2 from /tmp/resolv.conf.auto
openwrt: OpenWrt
"""
dns1 = ""
dns2 = ""
try:
with open("/tmp/resolv.conf.auto") as f:
dnscount = 0
for line in f.readlines():
@simryang
simryang / setCameraFocusToZero.sh
Created December 6, 2021 02:32
Raspberry pi4 에서 수동으로 포커스를 0으로 지정하는 명령
# 현재 설정 확인
fswebcam --list-controls
# 오토포커스 끄기
v4l2-ctl -d 0 -c focus_auto = 0
# 포커스 수동 지정. 여기에서는 0으로 지정(원하는 값으로 변경)
v4l2-ctl --set-ctrl=focus_absolute=0
# 현재 설정 확인
@simryang
simryang / split_ext.py
Last active December 10, 2022 16:13
split ext filename from full path
import os
from pathlib import Path
p = "/home/pi/src/projA/kk.c"
pp = os.path.splitext(p)
# pp = ('/home/pi/src/projA/kk', 'c')
print(f"filename with path={pp[0]}, extension={pp[1]}")
p1 = Path(p)
p1ext = p1.suffix
p1name = p1.name
#!/usr/bin/env python
# linux environment is recommended. not tested on other environment. tested on Ubuntu 20.04
# python3 leveldb_dump_joseph.py '/mnt/d/Users/USERID/Chrome/User Data/Default/Local Extension Settings/chphlpgkkbolifaimnlloiipkdnihall' > result.csv
# result is tab seperated values(TSV). save result to *.csv and import on new excel documents with 'tab' seperator
# original code from https://gist.github.com/dexX7/cbd16b05f1f3870b7afc
# I made this code from original for recovering OneTab bookmarks
import binascii
import sys
import json
import yaml
@simryang
simryang / vscode-on-ubuntu.adoc
Created August 18, 2022 09:51 — 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를 제거한다.

@simryang
simryang / add_image_banner.py
Created September 16, 2022 13:57
Add banner to 640x480 image
from PIL import Image, ImageFont, ImageDraw
import time
import datetime
filename = "kk.jpg"
img = Image.open(filename)
img_size = (640, 480)
img_resize = img.resize(img_size)
font_size = 15
#title_font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", font_size)
title_font = ImageFont.truetype("D2Coding-Ver1.3.2-20180524-all.ttc", font_size)
@simryang
simryang / test_var_name.py
Created December 10, 2022 16:00
how to get variable name into string...
def retrieve_name(var):
callers_local_vars = inspect.currentframe().f_back.f_locals.items()
return [var_name for var_name, var_val in callers_local_vars if var_val is var][0]
def retrieve_names(var):
callers_local_vars = inspect.currentframe().f_back.f_locals.items()
return [var_name for var_name, var_val in callers_local_vars if var_val is var]
aaa="kkk"
bbb="kkk"