Skip to content

Instantly share code, notes, and snippets.

View jigangkim's full-sized avatar
🎯
Focusing

Jigang Kim jigangkim

🎯
Focusing
View GitHub Profile
@jigangkim
jigangkim / merge_pdf.py
Created May 14, 2024 00:47
Miscellaneous tools
import PyPDF2
def merge_pdfs(pdf_file1, pdf_file2, output):
pdf_writer = PyPDF2.PdfWriter()
for file in [pdf_file1, pdf_file2]:
pdf_reader = PyPDF2.PdfReader(file)
for page_num in range(len(pdf_reader.pages)):
page = pdf_reader.pages[page_num]
pdf_writer.add_page(page)
@jigangkim
jigangkim / README.md
Last active September 14, 2023 06:26
fail2ban v0.11.1 setup for xrdp, code-server

testing custom regex

fail2ban-regex LOG REGEX -d DATEPATTERN -v

xrdp

Only works on xrdp version v0.9.18 or newer: https://github.com/neutrinolabs/xrdp/tree/v0.9.18.

Detects '[20230628-05:33:09] [INFO ] AUTHFAIL: user=testuser ip=192.168.0.2 time=1687930389' line from xrdp sesman log.

@jigangkim
jigangkim / gcloud_tts.py
Created April 3, 2023 07:24
Speech/Subtitle generation with Google Cloud and OpenAI Whisper
#!/usr/bin/env python
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
usage="usage: bash vpn.sh -c <config>"
quick_die() {
format="$1"; shift
>&2 printf "${format}\n" "$@"
exit 1
}
main() {
while getopts "hc:" opt; do
@jigangkim
jigangkim / .Xmodmap
Created September 30, 2021 10:25
Remap keys with ~/.Xmodmap (deprecated)
keycode 105 = Hangul_Hanja NoSymbol Hangul_Hanja
keycode 108 = Hangul NoSymbol Hangul
keycode 191 = Print NoSymbol Print
keycode 192 = Scroll_Lock NoSymbol Scroll_Lock
keycode 193 = Pause NoSymbol Pause
keycode 197 = XF86Launch1 NoSymbol XF86Launch1
@jigangkim
jigangkim / README.md
Created September 30, 2021 10:14
Remap keyboard keys (/usr/share/X11/xkb/symbols/pc)
@jigangkim
jigangkim / README.md
Created July 12, 2021 04:58
rEFInd setup for virtualbox

General

  1. Basic > Type: Linux, > Version: Other Linux (64-bit)

System

  1. Motherboard > Extended Features: Enable EFI

Display

  1. Screen > Graphics Controller: VMSVGA, > Acceleration: Enable 3D Acceleration

Storage

@jigangkim
jigangkim / auto_response.py
Created July 12, 2021 04:49
response prompt with auto-response functionality
from inputimeout import inputimeout, TimeoutOccurred
import time
import sys
def prompt_yes_or_no(query, timed=False, timeout=30, default_response=None):
while True:
if timed: # inputimeout does NOT work when called from a subprocess!
assert default_response is not None
try:
@jigangkim
jigangkim / matplotlib_animate.py
Created July 12, 2021 04:47
matplotlib animation examples
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
Writer = animation.writers['ffmpeg']
writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
def f(x, y):
@jigangkim
jigangkim / popos2004_initialsetup.sh
Created July 9, 2021 01:51
Pop OS quick setup script
# Misc
sudo apt update
sudo apt install guake
sudo apt install openssh-server
#sudo apt install patchelf
#sudo apt-get install -y python3-dev libasound2-dev
# NVIDIA CUDA & CUDNN
sudo apt install system76-cudnn-11.2
sudo update-alternatives --config cuda