Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
:)

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
hienvd / git_deleted_file_history.md
Created Dec 5, 2017
Find history of deleted file
View git_deleted_file_history.md

List of all deleted files:

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

Find the log git log --all -- FILEPATH

@hienvd
hienvd / react-setting-up.md
Last active Sep 27, 2017
Setting up a React Project
View react-setting-up.md

Init

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
hienvd / hexo.md
Created Jul 2, 2017
My Hexo docs
View hexo.md

Create page

hexo new page "about"
hexo new page "404"
@hienvd
hienvd / haml_rails5.md
Created May 25, 2017
Using haml Rails 5
View haml_rails5.md
  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
hienvd / rvm.md
Last active Apr 18, 2017
RVM with non-root user
View rvm.md

curl -sSL https://get.rvm.io | bash -s stable --path $HOME/.rvm

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

View jenkin.md
@hienvd
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
Hi,
I got it sorted. Here is what I did to fix it:
I found a revision in the Sprockets Github repo
(https://github.com/sstephenson/sprockets/commit/743c1b1a6433195e440e2d863e5d4767cc41271a)
when searching for a fix for the undefined method error relating to
default_mime_type. I then applied this change to the following ruby
scripts
in the sprockets 2.11.0 gem directory: jst_processor, sass_compressor,
@hienvd
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