Skip to content

Instantly share code, notes, and snippets.

View peterpham's full-sized avatar

Peter Pham peterpham

  • Amazon Web Services
  • Sydney
View GitHub Profile
@peterpham
peterpham / .bash_profile
Created December 6, 2018 09:12
Custom Bash Profile (color and git branch)
export CLICOLOR=1
export LSCOLORS=BxDxfxfxgxdxdxhbadbxbx
PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;33m\]\u\[\033[00m\]@\[\033[01;31m\]\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]'
#export PS1
# Git branch in prompt.
parse_git_branch() {
@peterpham
peterpham / gist:e7676678d95c7302a694d01e9badf628
Created November 2, 2018 22:30
Zip each folder into separate file
for i in */; do zip -r "${i%/}.zip" "$i"; done
@peterpham
peterpham / gist:898c0c64abcbaa427945fd8a4b4b6559
Created October 22, 2018 06:04
Useful command: check running processes
# list all listening ports
sudo lsof -i -P | grep -i "listen"
# list all processes using specific port - this will list all pid that using port 8080
lsof -i :8080 | grep "LISTEN"
# tell which application is running on specfic pid (for example, 1237)
ps -ef | grep 12337
# kill processes using port 8888
@peterpham
peterpham / console-happy-birthday.js
Created April 12, 2016 03:27
Create a message Happy Birthday in browser's console
(function(){
var text = "Happy Birthday, Steve!",
length = text.length,
chr = 1,
ar = text.split(),
today = new Date();
try {
if (window.console) {
if (console.clear && console.log) {
if (today.getDate() === 17 && today.getMonth() === 2) {