Skip to content

Instantly share code, notes, and snippets.

View DarrenKwonDev's full-sized avatar

drkdev DarrenKwonDev

  • Proprietary Trading Firm
  • ap-northeast-2
  • 00:45 (UTC +09:00)
View GitHub Profile
#!/bin/bash
# --------------------
# register this script in cronjob
# --------------------
TARGET_IP="" # fill this
PING_TIMEOUT=10
LOG_FILE="/var/log/ts_monitor.log"
CNT_FILE="/tmp/ts_fail_cnt"
@DarrenKwonDev
DarrenKwonDev / Windows Defender Exclusions VS 2022.ps1
Created March 4, 2024 01:42 — forked from Braytiner/Windows Defender Exclusions VS 2022.ps1
Adds Windows Defender exclusions for Visual Studio 2022
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\Downloads\HeidiSQL_11.3_64_Portable') > $null
$pathExclusions.Add($userPath + '\.dotnet') > $null
@DarrenKwonDev
DarrenKwonDev / fstream_utf8.cpp
Created February 16, 2024 00:21 — forked from leafbird/fstream_utf8.cpp
std::fstream 계열로 파일 I/O를 할 때 utf-8인코딩을 사용하도록 설정하는 코드. 출처 : http://sockbandit.wordpress.com/2012/05/31/c-read-and-write-utf-8-file-using-standard-libarary/
#include <fstream>
#include <iostream>
#include <string>
#include <locale>
#include <codecvt>
...
// Write file in UTF-8
std::wofstream wof;
wof.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t,0x10ffff,std::generate_header>));
@DarrenKwonDev
DarrenKwonDev / fstream_utf8.cpp
Created February 16, 2024 00:21 — forked from leafbird/fstream_utf8.cpp
std::fstream 계열로 파일 I/O를 할 때 utf-8인코딩을 사용하도록 설정하는 코드. 출처 : http://sockbandit.wordpress.com/2012/05/31/c-read-and-write-utf-8-file-using-standard-libarary/
#include <fstream>
#include <iostream>
#include <string>
#include <locale>
#include <codecvt>
...
// Write file in UTF-8
std::wofstream wof;
wof.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t,0x10ffff,std::generate_header>));
@DarrenKwonDev
DarrenKwonDev / .bashrc
Created February 1, 2024 17:30 — forked from karlhorky/.bashrc
Bash Git Aliases
# Git Aliases (sorted alphabetically with some inculsive functions)
# Adapted from oh-my-zsh git alias plugin. "compdef" is a Z shell autocompletion function, disabled throughout where applicable.
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gapa='git add --patch'
alias gb='git branch'
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@DarrenKwonDev
DarrenKwonDev / nextTick.js
Created October 20, 2022 17:39 — forked from mmalecki/nextTick.js
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}
@DarrenKwonDev
DarrenKwonDev / about.md
Created October 17, 2022 00:27 — forked from caike/about.md
Node.js streams 1 vs. 2

NodeJS Streams

  • Current implementation is known as streams2.
  • Introduced in node v0.10.
  • "suck" streams instead of "spew" streams.
  • Instead of data events spewing, call read() to pull data from source.
  • When there isn't any data to consume, then read() will return undefined.
  • Adding a data event listener will switch the Readable stream into "old mode", where data is emitted as soon as it is available rather than waiting for you to call read() to consume it. This requires you to handle backpressure problems manually.
  • The pipe method helps write less code and handles back-pressure.
  • If you add an end listener and don't ever read() or pipe(), it'll never emit end.
@DarrenKwonDev
DarrenKwonDev / latency.txt
Created August 15, 2022 17:24 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@DarrenKwonDev
DarrenKwonDev / vpn_psk_bingo.md
Created July 12, 2022 18:07 — forked from kennwhite/vpn_psk_bingo.md
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016