Skip to content

Instantly share code, notes, and snippets.

View rkdgusrnrlrl's full-sized avatar

Kang Hyeon Ku rkdgusrnrlrl

View GitHub Profile
{
"name": "Next.js Inbox",
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-20",
"forwardPorts": [3000],
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
@rkdgusrnrlrl
rkdgusrnrlrl / date-utils.test.ts
Created March 19, 2025 15:13
기간을 기준으로 기준 날짜, 비교할 날짜
import moment from 'moment';
import { adjustDateWithDuration } from './date-utils';
describe('date-utils', () => {
describe('adjustDateWithDuration', () => {
it('차이가 duration 이내인 경우 원래 targetDate를 유지해야 한다', () => {
// Arrange
const baseDate = '20250315'; // YYYYMMDD 형식
const targetDate = '20250325'; // 10일 차이
const duration = moment.duration(14, 'days'); // 14일 기간
@rkdgusrnrlrl
rkdgusrnrlrl / README.md
Created July 14, 2023 00:30 — forked from JosimarCamargo/README.md
How to setup a Postgres replication with docker and docker-compose

How to setup a Postgres replication with docker and docker-compose

How to use

To run you will need docker and docker-compose installed, and run the command docker-compose up on a folder within this file named docker-compose.yml(attached in this Gist)

How the PGAudit is enable, you will see the queries log and in which database is running which query, this is the main purpose of this Gist, along with have a database with replication working out of the box

To add user with just reading rights to access the database on slave replica

git for-each-ref refs/heads/ --count=10 --format='%(refname:short)' --sort=committerdate | grep users
echo "delete that branches(y/n): "
read name
if [ $name == 'y' ]; then
git for-each-ref refs/heads/ --count=10 --format='%(refname:short)' --sort=committerdate | grep users | xargs git branch -D
echo "deleted branches"
else
echo "cencel delete branches"
@rkdgusrnrlrl
rkdgusrnrlrl / pdf_manager.py
Created July 27, 2021 14:29
pdf 암호 제거 및 병합 하는 기능 함수(pikepdf, PyPDF2 라이브러리 설치 필요)
import pikepdf
import os
from PyPDF2 import PdfFileMerger
# pip install pikepdf
# pip install PyPDF2
def pdf_merge(key_file_names, dir_path):
ff = os.listdir(dir_path)
import sys
kor_num = {'영': 0, '일': 1, '이': 2, '삼': 3, '사': 4, '오': 5,
'육': 6, '칠': 7, '팔': 8, '구': 9, '십': 10, '백': 100, '천': 1000,
'만': 10000, '억': 100000000, '조': 1000000000000 }
def int_kor(str_num):
num_strs = [ss for ss in str_num]
idx = 0
total = 0
import sys
if __name__ == "__main__":
f_str = [ss for ss in sys.argv[1]]
f_str.reverse()
s_str = [ss for ss in sys.argv[2]]
s_str.reverse()
@rkdgusrnrlrl
rkdgusrnrlrl / change_mobile.py
Last active November 2, 2020 05:01
chrome remote debugger
import websocket
# pip install websocket-client
import json
try:
import thread
except ImportError:
import _thread as thread
import time
import requests
# pip install requests
import websocket
# pip install websocket-client
import json
try:
import thread
except ImportError:
import _thread as thread
import time
import requests
# pip install requests
@rkdgusrnrlrl
rkdgusrnrlrl / network.py
Created November 28, 2019 05:32
remote debugger network
import websocket
import json
import requests
import signal
import sys
from os import path
import logging
logging.basicConfig(filename='network_monitor.log',level=logging.DEBUG)
from time import sleep