Skip to content

Instantly share code, notes, and snippets.

View ratanachai's full-sized avatar

Ken Ratanachai S. ratanachai

View GitHub Profile
@ratanachai
ratanachai / .bash_aliases
Last active February 3, 2020 03:24
bash_aliases
# cmd
alias vs="code"
alias ll="ls -l"
alias la="ls -a"
alias lla="ls -la"
alias lt="ls -lt"
alias t="tree"
alias h="history"
alias g="grep"
alias hg="history|grep"
@ratanachai
ratanachai / rbenv-install-system-wide.sh
Created May 3, 2019 08:53
How to Install Ruby on Ubuntu 18.04
# Escapte to root
# su -
# Update, upgrade and install development tools:
apt update
apt -y upgrade
apt -y install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
@ratanachai
ratanachai / rbenv-install-system-wide.sh
Last active April 24, 2019 01:45 — forked from berga/rbenv-install-system-wide.sh
rbenv install and system wide install on Ubuntu 16.04 LTS.
# Escapte to root
# su -
# Update, upgrade and install development tools:
apt update
apt -y upgrade
apt -y install build-essential git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
@ratanachai
ratanachai / gist:1a22fd6718bc1e464e41510b3d3c445b
Last active September 18, 2018 04:04
Backup and extract Android SQLite DB
# From your PC terminal
$ adb backup -noapk com.example.app
$ dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
@ratanachai
ratanachai / TestProvider.java
Created September 30, 2015 15:43
Why direct db query and content provider query return different result
// https://github.com/ratanachai/popularmovies/blob/dup-db-bug/app/src/androidTest/java/com/ratanachai/popularmovies/data/TestProvider.java
// From the file in link above. When setup() delete in the whold database instead of just delete all records in all tables,
// assertEquals will fails. Direct DB query will return correct amount of rows, but ContentProvider will not, because Data from
// the previous test still persists, likely caused by database couldn't deleted successfully.
//
// Question 1: Why direct db query and content provider query return different result as if there were 2 databases.
// I tried pulling out sqlite database to view and the show direct database query version. Where is Content Provider version?
// Question 2: Why mContext.deleteDatabase() was not success?
@ratanachai
ratanachai / new_dom_structure
Created February 18, 2015 10:23
new_dom_structure
<section class="" id="body_content">
<div class="row>
<h1 id="body_content_title">Blog</h1>
</div>
<div class="row>
<section id="body">
</section>
<section id="side_body">
</section>
</div>