Skip to content

Instantly share code, notes, and snippets.

View simryang's full-sized avatar

Joseph simryang

  • WIZnet
  • 성남시
  • 14:27 (UTC +09:00)
View GitHub Profile
#!/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 / 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
@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 / 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 / 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 / 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 / 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 / readme_azsphere.txt
Last active October 15, 2020 08:27
abbreviate azsphere to az
make 'd:\aliases.cmd' and type following line
doskey az=azsphere $*
set target in property window of azure sphere developer command prompt to
C:\Windows\System32\cmd.exe /k ""C:\Program Files (x86)\Microsoft Azure Sphere SDK\\InitializeCommandPrompt.cmd" & D:\aliases.cmd"
import sys
n=input()
a=[sys.stdin.readline() for i in range(n)]
print sum(list(map(int,a)))-n+1
# https://www.acmicpc.net/board/view/855
import time
import threading
class testthread(threading.Thread):
def __init__(self, testvar=None):
threading.Thread.__init__(self)
self.enabled = False
def stop(self):
self.enabled = False