Skip to content

Instantly share code, notes, and snippets.

View telnet2's full-sized avatar

Joohwi Lee telnet2

View GitHub Profile
@telnet2
telnet2 / checkout.sh
Created April 30, 2018 19:01
Git checkout file from another branch
git checkout anotherbranch path/to/file.txt
@telnet2
telnet2 / setup_tools.sh
Last active July 24, 2019 20:57
Setup frequently used linux tools
# sudo apt-get -y install build-essential vim silversearcher-ag zsh httpie
sudo add-apt-repository ppa:aacebedo/fasd && sudo apt-get update
sudo apt-get install -y httpie silversearcher-ag fasd
if [[ ! -d ~/.fzf ]]; then
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
fi
if [[ ! -d ~/.nvm ]]; then
@telnet2
telnet2 / gist:a625903d4debd56237043a35b3ead122
Created August 12, 2019 22:24
BASH getopts with mixed positional arguments
ARGS=()
while [ $# -gt 0 ]; do
unset OPTIND
unset OPTARG
while getopts v options; do
case $options in
v) VERBOSE=true ;;
esac
done
shift $((OPTIND - 1))
@telnet2
telnet2 / setup.zsh
Last active December 21, 2019 18:14
ZSH Cloud Setting
ZHOME="${ZDOTDIR:-$HOME}/.zprezto"
sudo apt-get install git software-properties-common
if [ ! -d "${ZHOME}" ]; then
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZHOME}"
git clone https://github.com/zdharma/fast-syntax-highlighting "${ZHOME}/modules/fast-syntax-highlighting"
if [ ! -d "${HOME}/.fzf" ]; then
git clone --depth 1 https://github.com/junegunn/fzf.git ${HOME}/.fzf
@telnet2
telnet2 / .vimrc
Last active December 11, 2019 17:07
VIM RC file
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/vundle'
@telnet2
telnet2 / resize_swap.sh
Last active December 21, 2019 19:47
How to change swap size in ubuntu
free -h
sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
sudo mkswap /swapfile
sudo swapon /swapfile
sudo chmod 0600 /swapfile
grep SwapTotal /proc/meminfo
@telnet2
telnet2 / fs.sh
Last active December 13, 2019 18:49
Mount file system
sudo apt-get install xfsprogs
sudo mkfs.xfs /dev/vdb
sudo mkfs.xfs /dev/vdc
sudo mkdir /data /backup
sudo mount -t xfs /dev/vdb /data
sudo mount -t xfs /dev/vdc /backup
@telnet2
telnet2 / ssh-config
Last active June 6, 2020 23:57
SSH over SOCKS5
Host autoxdl
HostName a.b.c.d
User USER
ProxyCommand /usr/bin/nc -X 5 -x 127.0.0.1:1086 %h %p
# install bash-it
git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
~/.bash_it/install.sh
# change theme to clean for bash-it
# install fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
// This file was initially generated by Windows Terminal 1.0.1401.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
// You can add more global application settings here.