Skip to content

Instantly share code, notes, and snippets.

Avatar

Lattapon Yodsuwan clozed2u

View GitHub Profile
@clozed2u
clozed2u / gist:4971506
Last active Sep 16, 2018
My .bash_profile setup on OS X. Modified from Mark Otto's bash style (http://markdotto.com/2013/01/13/improved-terminal-hotness/) by adding git color for status.
View gist:4971506
alias ls='ls -Glah'
alias web='open -a Safari.app'
alias mail='open -a Mail.app'
alias todo='open -a Reminders.app'
git_branch () {
if git rev-parse --git-dir >/dev/null 2>&1
then echo -e "" [$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')]
else
echo ""
fi
@clozed2u
clozed2u / optimize-ssd.md
Last active Apr 4, 2018 — forked from ummels/os-x-enable-trim.md
Optimize non-Apple SSDs on OS X.
View optimize-ssd.md

Optimize non-Apple SSDs on OS X. (Run the following commands in the terminal.)

Enable TRIM support

Check IOAHCIBlockStorage version:

open /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/version.plist
@clozed2u
clozed2u / osxoptimize.md
Last active Apr 28, 2016
Customize OS X
View osxoptimize.md

#An cli to optimize OS X to suit my need.

###Dashboard To disable

defaults write com.apple.dashboard mcx-disabled -boolean YES

To enable

@clozed2u
clozed2u / uninstallgems.sh
Created Feb 3, 2014
Uninstall all ruby gems.
View uninstallgems.sh
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
@clozed2u
clozed2u / mysql.md
Last active Aug 29, 2015
Manaully install mysql on OS X from binary.
View mysql.md

#Install MySQL from binary on Maverick.

  1. Download MySQL from http://dev.mysql.com/downloads/mysql/
  2. Extract, rename folder, and place into directory you want.
  3. Add MySQL's bin and MySQL's man to your $PATH and $MANPATH.
  4. Go to scripts directory and execute mysql_install_db with parameters you want. For example
    ./mysql_install_db --verbose
    --user=clozed2u
    

--basedir=/usr/local/mysql

@clozed2u
clozed2u / vim.sh
Last active Aug 29, 2015
Compiled vim on os x.
View vim.sh
./configure --prefix=/usr/local --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-perlinterp=yes --enable-luainterp --with-luajit --enable-multibyte --disable-gui --with-tlib=ncurses --with-features=huge --with-compiledby=i@clozed2u.com --without-x --enable-cscope && make && make install
@clozed2u
clozed2u / tmux.md
Created Aug 27, 2014
Manual install tmux on os x
View tmux.md

Download Libevent and Tmux.

mkdir ~/build
cd ~/build
curl -OL http://downloads.sourceforge.net/tmux/tmux-1.9a.tar.gz
curl -OL http://downloads.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.16-stable.tar.gz
@clozed2u
clozed2u / uninstallnodemodule.sh
Created Oct 11, 2014
Uninstall all node modules globally except for npm
View uninstallnodemodule.sh
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm -g rm
@clozed2u
clozed2u / prompt_colors.sh
Created Nov 26, 2014
Display 256 colors in your terminal.
View prompt_colors.sh
for code in {0..255}; do echo -e "\e[38;05;${code}m $code: Test"; done
@clozed2u
clozed2u / microcache.conf
Created Feb 8, 2015
nginx confing for microcache
View microcache.conf
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:10m max_size=1024m inactive=15m;
map $http_cookie $cache_uid {
default nil; # hommage to Lisp :)
~SESS[[:alnum:]]+=(?<session_id>[[:alnum:]]+) $session_id;
}
map $request_method $no_cache {
default 1;
HEAD 0;
GET 0;