Skip to content

Instantly share code, notes, and snippets.

View simryang's full-sized avatar

Joseph simryang

  • WIZnet
  • 성남시
  • 04:53 (UTC +09:00)
View GitHub Profile
@simryang
simryang / mv_git_repo_with_history.sh
Last active December 29, 2023 01:06 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@simryang
simryang / asyncssh_nohup.py
Created September 22, 2023 01:03
example for how to do remote ssh command via asyncssh/asyncio
import time
import asyncssh
import asyncio
params = range(10)
async def run():
async with asyncssh.connect("localhost", 8090, username="tester", password="t35t3r", known_hosts=None) as conn:
for param in params:
await conn.create_process(f"nohup very_very_long_run.sh {param} &")
@simryang
simryang / vim_remember_last_cursor_remote.sh
Created June 20, 2023 07:53
Change vim global setting to remember last curosr position
ssh pi@pi_ip_address "sudo sed -i 's/"\""au/au/' /etc/vim/vimrc"
@simryang
simryang / get_rpi_serial.sh
Last active December 29, 2023 01:10
Get Rasbperry Pi Serial from /proc/cpuinfo
python3 -c 'from pathlib import Path; import yaml; print(yaml.safe_load(Path("/proc/cpuinfo").read_text().replace("\t", " ")).get("Serial"))'
@simryang
simryang / my_public_ip.sh
Last active June 9, 2023 06:53
Identify public IP address
echo $(curl -s 'https://ident.me')
@simryang
simryang / folding.md
Last active May 22, 2023 00:08
[github markdown] 접기 / 펼치기
접기

자세한 내용

@simryang
simryang / upgrade_openwrt.md
Last active June 20, 2023 07:51 — forked from jiananlu/gist:9258032
upgrade openwrt kernel and reinstall all packages manual

upgrade the system

Make sure you can ssh to the router by root and type in the command:

cd /tmp
wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-generic-mw4530r-v1-squashfs-sysupgrade.bin
sysupgrade -v openwrt-ar71xx-generic-mw4530r-v1-squashfs-sysupgrade.bin
@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"
@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 / 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를 제거한다.