Skip to content

Instantly share code, notes, and snippets.

View bylatt's full-sized avatar

Lattapon Yodsuwan bylatt

  • Bangkok, Thailand
View GitHub Profile
@bylatt
bylatt / gist:4971506
Last active September 16, 2018 16:58
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.
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
@bylatt
bylatt / optimize-ssd.md
Last active April 4, 2018 20:36 — forked from ummels/os-x-enable-trim.md
Optimize non-Apple SSDs on OS X.

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
@bylatt
bylatt / osxoptimize.md
Last active April 28, 2016 06:51
Customize OS X

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

###Dashboard To disable

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

To enable

@bylatt
bylatt / uninstallgems.sh
Created February 3, 2014 15:03
Uninstall all ruby gems.
for i in `gem list --no-versions`; do gem uninstall -aIx $i; done
@bylatt
bylatt / mysql.md
Last active August 29, 2015 13:58
Manaully install mysql on OS X from binary.

#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

@bylatt
bylatt / vim.sh
Last active August 29, 2015 14:01
Compiled vim on os x.
./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 [email protected] --without-x --enable-cscope && make && make install
@bylatt
bylatt / tmux.md
Created August 27, 2014 15:37
Manual install tmux on os x

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
@bylatt
bylatt / uninstallnodemodule.sh
Created October 11, 2014 18:12
Uninstall all node modules globally except for npm
npm -g ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm -g rm
@bylatt
bylatt / prompt_colors.sh
Created November 26, 2014 14:29
Display 256 colors in your terminal.
for code in {0..255}; do echo -e "\e[38;05;${code}m $code: Test"; done
@bylatt
bylatt / microcache.conf
Created February 8, 2015 07:24
nginx confing for microcache
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;