Skip to content

Instantly share code, notes, and snippets.

View susemeee's full-sized avatar

Suho Lee susemeee

View GitHub Profile
@susemeee
susemeee / supabase.ts
Created December 21, 2023 06:16
supabase-fetch-override-workaround
import { Database } from '@/lib/supabase-types'
import { createClient } from '@supabase/supabase-js'
export const SUPABASE_NEXTJS_CACHE_TAG = "supabase"
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
export const client = createClient<Database>(
supabaseUrl,
@susemeee
susemeee / mongodb-log-rotation.md
Created April 13, 2023 04:56
MongoDB log rotation
mongosh

rs [direct: secondary] test> db.adminCommand( { logRotate : "server" } )

cd /var/log/mongodb

sudo -u mongodb gzip [[MONGODB_LOG_FILENAME]]
@susemeee
susemeee / psql.md
Created April 6, 2023 06:47
PostgreSQL Create new user with database
sudo vim /etc/postgresql/12/main/pg_hba.conf
host    <db_name>             <user_name>             0.0.0.0/0               password
🌞 Morning 22 commits ▌░░░░░░░░░░░░░░░░░░░░ 2.9%
🌆 Daytime 302 commits ████████▍░░░░░░░░░░░░ 40.2%
🌃 Evening 377 commits ██████████▌░░░░░░░░░░ 50.1%
🌙 Night 51 commits █▍░░░░░░░░░░░░░░░░░░░ 6.8%
@susemeee
susemeee / MagicHole.js
Created November 3, 2020 11:07
MagicHole
window.MagicHole = new Proxy(function () { console.log('MagicHole:call', arguments); return window.MagicHole; }, {
get(target, name) {
console.log('MagicHole:get', name);
return window.MagicHole;
},
});
@susemeee
susemeee / initialize-linux.sh
Last active December 26, 2020 12:29
Script to initialize linux server
#!/bin/bash
# because I am too lazy to initialize linux server anymore
export DOTFILES_REPO_URL=https://github.com/susemeee/dotfiles.git
sudo apt update && sudo apt install -y zsh git htop git vim build-essential && git clone $DOTFILES_REPO_URL && cd dotfiles && ./install && cd ~
# tmuxconf
cd ~ && git clone https://github.com/gpakosz/.tmux.git && ln -s -f .tmux/.tmux.conf && cp .tmux/.tmux.conf.local .
$src = ".\goog"
$dest = ".\goog2"
$num=1
Get-ChildItem $src -Recurse -Include *.gif, *.jpg, *.jpeg, *.png, *.bmp, *.heic, *.heif, *.mov, *.mp4, *.webp, *.avi, *.tif, *.flv, *.mts | ForEach-Object {
$nextName = Join-Path -Path $dest -ChildPath $_.name
while(Test-Path -Path $nextName)
{
@susemeee
susemeee / hacker-ip.txt
Last active June 5, 2020 11:34
WordPress Hacker's IP address list
103.10.171.21
103.120.226.54
103.136.43.65
103.233.83.220
103.233.83.251
103.86.176.107
103.9.76.178
104.143.43.10
104.160.43.209
104.244.153.22
@susemeee
susemeee / compile-ffmpeg-nvenc.sh
Created April 20, 2020 01:03
FFmpeg + nvenc + libsrt
#!/bin/bash
#This script will compile and install a static ffmpeg build with support for nvenc un ubuntu.
#See the prefix path and compile options if edits are needed to suit your needs.
#install required things from apt
installLibs(){
echo "Installing prerequisites"
sudo apt-get update
sudo apt-get -y --force-yes install nettle-dev cmake tcl autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \
@susemeee
susemeee / check-corporation-number.js
Last active September 12, 2018 01:28
법인등록번호 검증하기
// 법인번호 오류검증 공식
// 법인번호에서 마지막 자리를 제외한
// 앞에 모든 자리수를 1과 2를 순차적으로 곱한다.
// 예) 1234567890123
// ************
// 121212121212
// 각각 곱한 수를 모든 더하고 10으로 나눈 나머지 수를 구한다.
// (각각더한수 % 10)
// 나눈 나머지 수와 법인번호 마지막 번호가 일치하면 검증일치
function isValidCorporationId(value = '') {