Skip to content

Instantly share code, notes, and snippets.

View buithehoa's full-sized avatar
🐢
Moving slowly ...

Bùi Thế Hòa buithehoa

🐢
Moving slowly ...
View GitHub Profile
@buithehoa
buithehoa / save-postgresql-output-to-csv.sql
Created September 22, 2015 09:36
Save PostgreSQL output to CSV
COPY (SELECT * FROM foo) T0 '/tmp/foo.csv' WITH CSV;
@buithehoa
buithehoa / extract-a-bz2-file
Created September 30, 2015 09:22
Extract a .bz2 file
bzip2 -d <filename>.bz2
@buithehoa
buithehoa / delete-blank-lines-in-vim
Created October 7, 2015 07:28
Delete blank lines in vim
:g/^$/d
@buithehoa
buithehoa / create-and-track-a-remote-branch
Created November 3, 2015 02:17
Create and track a remote branch
$ git checkout -b your_branch
$ git push -u origin your_branch
@buithehoa
buithehoa / create-a-tar-gz-file
Last active November 11, 2015 09:07
Create a tar.gz file
tar zcvf archive-name.tar.gz source-folder-name
@buithehoa
buithehoa / replace-all-non-alphanumeric-characters.rb
Created November 8, 2015 14:44
Replace all non-alphanumeric characters
"foo bar".downcase.gsub(/[^\p{Alnum}]/, '-') # Output: foo-bar
@buithehoa
buithehoa / show-remote-branches
Created November 11, 2015 01:44
Show remote branches
git fetch <remote-name>
git branch -r
@buithehoa
buithehoa / delete-a-remote-branch
Created November 11, 2015 02:25
Delete a remote branch
git push origin --delete <branch-name>
@buithehoa
buithehoa / remove-untracked-files-from-a-working-copy
Last active November 11, 2015 09:07
Remove untracked files from a working copy
git clean -f -d
@buithehoa
buithehoa / show-table-index-information.sql
Created January 19, 2016 10:03
Show table index information
SHOW {INDEX | INDEXES | KEYS}
{FROM | IN} tbl_name
[{FROM | IN} db_name]
[WHERE expr]