Skip to content

Instantly share code, notes, and snippets.

View geunho's full-sized avatar
🎯
Focusing

Geunho Kim geunho

🎯
Focusing
View GitHub Profile
@geunho
geunho / cetos_gcc_4.4_to_4.7.sh
Created February 7, 2019 23:52
CentOS gcc 4.4에서 4.7 업그레이드
####################################################################################
# Upgrade CentOS GCC 4.4 to 4.7
#
# CentOS6의 기본 gcc 버전은 4.4,
# nodejs의 node-gyp 빌드를 하다보면 C++11 컴파일이 필요한데 gcc 4.7부터 11을 지원
# 이런 경우 직접 업그레이드 해줘야한다.
#
####################################################################################
# INSTALL
@geunho
geunho / .bashrc
Created January 23, 2019 04:29
.bashrc
# 로그인이 아닌 Non-interactive shell에서는 프로파일을 로드하지 않는 default 설정이 들어간 경우가 있다.
#
# 예. Ubuntu default .bashrc의 시작 부분
#
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@geunho
geunho / robocopy_example.bat
Created January 14, 2019 06:42
robocopy sync dir and output CUD list to file
REM Sync destination dir to source dir
REM retry max 10 times wait 1 second every try
REM output created, updated, deleted file list to both stdout and rc-list.txt file
robocopy %src_path% %dest_path% /MIR /R:10 /W:1 /NJH /NJS /NC /NS /NDL /NP /TEE /LOG:rc-list.txt /XF *.log
@geunho
geunho / web_req.ps1
Created January 14, 2019 06:35
powershell 2 web get request
################################################################################################
# http get request
################################################################################################
$uri = "http://mydomain/~"
$webclient = [System.Net.HttpWebRequest]::Create($uri)
[System.Net.HttpWebResponse]$res = $webclient.GetResponse()
$reader = New-Object System.IO.StreamReader($res.GetResponseStream())
$result = $reader.ReadToEnd()
################################################################################################
@geunho
geunho / netstat_8002_count_each_10s.bat
Created January 10, 2019 02:02
cmd batch to keep track of specific tcp connection count from netstat
:loop
(echo|set /p="%date% %time% " & netstat -anon | find /c ":8002 ") >> 8002_netstat.log
ping localhost -n 11 > nul
goto loop
{
"__inputs": [
{
"name": "DS_TELEGRAF",
"label": "telegraf",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
},
@geunho
geunho / add_apt_proxy.sh
Last active March 17, 2020 10:47
apt.conf 생성 및 프록시 서버 추가
#!/bin/bash
#
# Ubuntu
# apt.conf에 프록시 서버 설정 추가
#####################################
PROXY_SERVER=$1
if [ -z "$1" ]; then
echo "Usage: add_apt_proxy.sh [proxy_server]"
@geunho
geunho / add_bashrc.sh
Created August 24, 2016 00:43
Ubuntu bash skeleton 파일 추가
#!/bin/bash
#
# Ubuntu
# 기본 bash 파일이 없는 경우 (.bashrc, .profile)
# skeleton 파일을 복사하여 추가
##################################
if [ ! -f "~/.bashrc" ]; then
cp /etc/skel/* ~/
source ~/.profile
@geunho
geunho / copy-ssh-keys.sh
Created August 24, 2016 00:23
원격 호스트에 ssh key를 한번에 복제
#!/bin/bash
#
# $1: key를 저장할 원격 호스트 사용자 아이디
# $2: 원격 호스트 사용자의 패스워드가 기록된 파일 경로
# $3: linebreak으로 구분된 원격 호스트 목록
# e.g. target_hosts
# myhost01
# myhost02
# myhost03
# ...
@geunho
geunho / add_user.sh
Last active August 24, 2016 00:19
Ubuntu 사용자 추가 스크립트
#!/bin/bash
#
# Ubuntu
# 사용자 추가 스크립트
#################################
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: add_user [user_name] [home_dir]"
exit 0
elif [ -d "$2" ]; then