Skip to content

Instantly share code, notes, and snippets.

View dbwodlf3's full-sized avatar
🐢
I may be slow to respond.

Cogi dbwodlf3

🐢
I may be slow to respond.
  • SWLAB
  • Republic of Korea
View GitHub Profile
@dbwodlf3
dbwodlf3 / log.ts
Created April 25, 2024 04:38
node debugging with file log
import fs from "fs";
import util from "util";
const logFile = fs.createWriteStream('output.log', { flags: 'a' });
console.log = function (msg) {
logFile.write(util.format(msg) + '\n'); // 메시지를 파일에 쓰기
process.stdout.write(util.format(msg) + '\n'); // 표준 출력에도 쓰기
};
@dbwodlf3
dbwodlf3 / README.KR.MD
Last active February 1, 2024 12:56
Palworld update banlist from gist

사용법

Linux 기반으로 작성되어 있습니다.

curl -o https://gist.github.com/dbwodlf3/b42f9404d24d48255bc6ef240b99eec4/raw/update_banlist.sh
chmod +x ./update_banlist.sh

위의 명령어를 통해서, shell script 파일을 다운로드 받아주세요.

@dbwodlf3
dbwodlf3 / sh
Created October 26, 2023 01:52
Remove git untracked files
git status --porcelain | grep '^??' | cut -c 4- | xargs rm -r
@dbwodlf3
dbwodlf3 / board.constant.ts
Created July 30, 2023 02:35
bad code example
1
@dbwodlf3
dbwodlf3 / index.js
Last active March 6, 2023 03:15
check performance
const INIT_TIME = new Date().getTime();
const _t = _ => console.log(`${new Date().getTime() - INIT_TIME}ms`);
_t();
// Browser
const INIT_TIME = performance.now();
const _t = _ => console.log(`${performance.now() - INIT_TIME}ms`);
_t();
<?php
function my_parse_url($inputString){
$allowed_protocols = ["https", "http"];
$input_string = $inputString;
$protocol = "";
$hostname = "";
$subdomain = "";
$domain = "";
@dbwodlf3
dbwodlf3 / unzip.py
Created December 16, 2022 01:46
unzip many files
import os
import re
import zipfile
root_dir_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "8"));
dirs = os.listdir(root_dir_path);
for dir in dirs:
if(not re.match(".*_file_", dir)): continue;
@dbwodlf3
dbwodlf3 / index.js
Last active October 7, 2022 03:29
string to color
export function generate_hash_color(text, weight={red: 0, green:1, blue: 2}){
let color1 = 0;
let color2 = 0;
let color3 = 0;
if(text.length==0){
"rgb(0, 0, 0)";
}
else if(text.length==1){
color1 = text.charCodeAt(0) * 2 % 256
@dbwodlf3
dbwodlf3 / explain.txt
Created September 24, 2022 21:27
smc1~smc9 analysis explain
================================================================================
SMC1.c
================================================================================
C언어.
memcpy(ptr_key, instr10, 4);
Binary.
801: 48 8d 05 4d 00 00 00 lea 0x4d(%rip),%rax # 855 <main+0x6b>
808: 48 89 45 e8 mov %rax,-0x18(%rbp)
....
85c: 48 8b 45 e8 mov -0x18(%rbp),%rax
@dbwodlf3
dbwodlf3 / parse.js
Last active September 22, 2022 07:25
parse opengraph
/** Parsing only meta in headtag. */
export function parse_opengraph(inputHTML) {
const filter_head = /<head>[^]*<\/head>/i;
let filter_meta_og = /<meta[^>]*property[^>]*=[^>]*(og:)[^>]*>/ig;
let head = inputHTML.match(filter_head)[0];
const metas = head.match(filter_meta_og);
if(!metas) return;
const opengraph = {}