Skip to content

Instantly share code, notes, and snippets.

View telnet2's full-sized avatar

FreshStage telnet2

View GitHub Profile
@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 / .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 / 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 / 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_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 / checkout.sh
Created April 30, 2018 19:01
Git checkout file from another branch
git checkout anotherbranch path/to/file.txt