Skip to content

Instantly share code, notes, and snippets.

View code-yeongyu's full-sized avatar
🧘
Conquering the world

YeonGyu-Kim code-yeongyu

🧘
Conquering the world
View GitHub Profile
@code-yeongyu
code-yeongyu / socket_wrapper.py
Last active February 10, 2020 14:50
wrap function into socket for ipc
def args_to_dict_accessor(args):
code = ""
for arg in args:
code += f"content['{arg}'], "
return code[:-2]
def args_to_dict(args):
code = "{"
for arg in args:
@code-yeongyu
code-yeongyu / cloudSettings
Last active November 25, 2020 05:25
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-11-25T05:25:32.025Z","extensionVersion":"v3.4.3"}
@code-yeongyu
code-yeongyu / git-sync-date.py
Last active May 31, 2021 06:26
Sync the GIT_COMMITTER_DATE as the value of GIT_AUTHOR_DATE
from os import system
system("""FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' -f"""
@code-yeongyu
code-yeongyu / install-docker.sh
Last active September 20, 2021 12:28
Install Docker on Ubuntu
sudo apt update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
sudo apt upgrade -y
@code-yeongyu
code-yeongyu / install-docker-compose.sh
Last active September 20, 2021 12:28
Install docker-compose on ubuntu
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
@code-yeongyu
code-yeongyu / quit.py
Created February 12, 2022 11:46
macOS Quit Command
from os import system
from sys import argv
if len(argv) > 1:
commands = [
f'osascript -e \'quit app "{app_name}"\'' for app_name in argv[1:]
]
system(';'.join(commands))
else:
print("Usage: quit.py <application name>")
@code-yeongyu
code-yeongyu / execute_parallel.py
Last active April 20, 2023 06:11
Execute Functions in parallel easily
from multiprocessing import cpu_count
from multiprocessing.dummy import Pool
from typing import Any, Callable, Iterable
def execute_parallel(
func: Callable[..., Any],
args: Iterable[tuple[Any, ...]],
) -> None:
pool = Pool(cpu_count())
@code-yeongyu
code-yeongyu / .gitconfig
Last active October 14, 2022 14:24
Gitconfig setup with so many aliases
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
@code-yeongyu
code-yeongyu / gh-auto-merge.py
Last active July 6, 2022 04:20
loops until pr got merged, local github pr automerge
from os import system
from time import sleep
from sys import argv
try:
pr_id = argv[1]
except:
pr_id = ''
while True:
@code-yeongyu
code-yeongyu / bkt.py
Last active November 10, 2022 06:15
Open bitbucket with command like gh-cli
#!/usr/bin/env python
import subprocess
import types
from enum import Enum
from typing import Optional
def import_or_install(package: str) -> types.ModuleType:
try: