Skip to content

Instantly share code, notes, and snippets.


Hien Vuong hienvd

  • ITviec
  • Ho Chi Minh City, Viet Nam
View GitHub Profile
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
hienvd /
Created Dec 5, 2017
Find history of deleted file

List of all deleted files:

git log --diff-filter=D --summary | grep pattern_to_search

Find the log git log --all -- FILEPATH

hienvd /
Last active Sep 27, 2017
Setting up a React Project


npm init --y

Install React and ReactDom

npm install react react-dom --save-dev

Install Babel, webpack, webpack-dev-server

npm install babel-core babel-loader webpack webpack-dev-server --save-dev

Install ES2015 and React presets

hienvd /
Created Jul 2, 2017
My Hexo docs

Create page

hexo new page "about"
hexo new page "404"
hienvd /
Created May 25, 2017
Using haml Rails 5
  1. install HAML Gemfile: add gem 'haml-rails' to Gemfile
  2. bundle
  3. run rake haml:erb2haml to convert all erb to haml files => has option to delete old erb files, but becareful :) that's all
hienvd /
Last active Apr 18, 2017
RVM with non-root user

curl -sSL | bash -s stable --path $HOME/.rvm

source /var/lib/non-user/.rvm/scripts/rvm

hienvd / Fix_sprockets_rails_s
Created Oct 30, 2015
Fix can not start rails server when upgrade sprockets to 2.12.3
View Fix_sprockets_rails_s
I got it sorted. Here is what I did to fix it:
I found a revision in the Sprockets Github repo
when searching for a fix for the undefined method error relating to
default_mime_type. I then applied this change to the following ruby
in the sprockets 2.11.0 gem directory: jst_processor, sass_compressor,
hienvd / Tmux cheatsheet
Last active Aug 29, 2015
Tmux cheatsheet
View Tmux cheatsheet
Manage Sessions
tmux new -s session_name
>> creates a new tmux session named session_name
tmux attach -t session_name
>> attaches to an existing tmux session named session_name
tmux switch -t session_name
>> switches to an existing session named session_name
tmux list-sessions
>> lists existing tmux sessions