Skip to content

Instantly share code, notes, and snippets.

View namgivu's full-sized avatar

Nam G VU namgivu

View GitHub Profile
#!/bin/bash
_='run the below scripts line by line not run the whole as a batch file';
_='gist github ref. bit.ly/nnpipenv';
_='create $bashrc soft-linked to ~/.bash_profile, as in macos, if $bashrc file not exists while ~/.bash_profile does exist';
if [[ ! -f ~/.bashrc ]] && [[ -f ~/.bash_profile ]]; then ln -s ~/.bash_profile ~/.bashrc ; fi ;
bashrc="$HOME/.bashrc" ; `# must use $HOME instead of ~ here to get '>> $bashrc' working below`
_='#region install pyenv for ubuntu 16';
curl -s https://www.python.org/doc/versions/ | grep 3.6 | head -n1 | cut -d'>' -f3 | cut -d' ' -f2 | cut -d'<' -f1
bonus rule
https://help.trello.com/article/814-earning-activating-trello-gold
more google search http://bit.ly/trello-gantt-chart
give new user-candidate your refer link from
https://trello.com/recommend
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
# ref. https://stackoverflow.com/a/30659970/248616
#!/usr/bin/env bash -i
#ref. https://blog.bigdinosaur.org/easy-ps1-colors/
#ref. https://stackoverflow.com/a/5716557/248616
#ref. https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/
echo "
# color code color code bold
# ---------------- ----------------
ps1_BLACK='\[\033[0;30m\]' b_ps1_BLACK='\[\033[1;30m\]'
#!/bin/bash
: run the below scripts line by line not run the whole as a batch file
: install pyenv ref. bit.ly/nnpipenv
#create $bashrc soft-linked to ~/.bash_profile, as in macos, if $bashrc file not exists while ~/.bash_profile does exist
if [[ ! -f ~/.bashrc ]] && [[ -f ~/.bash_profile ]]; then ln -s ~/.bash_profile ~/.bashrc ; fi
bashrc='~/.bashrc'
cd ~/.pyenv; git pull # update pyenv to latest
@namgivu
namgivu / multi-line-bash-command.sh
Last active February 3, 2020 05:26
Multi-line bash command
echo `cat << EOF
line 1
line 2
EOF`
echo $(cat << EOF
line 1
line 2
EOF
@namgivu
namgivu / search-file.sh
Last active August 29, 2023 01:31
bash command search file or folder contain specific text
: search file containing specific text
YOUR_TEXT='YOUR_TEXT'; grep -R . -iE $YOUR_TEXT | cut -d':' -f1 | sort -u
# ref. https://stackoverflow.com/a/16957078/248616 https://unix.stackexchange.com/a/9923/17671
: search filename
find . -name "*YOUR TEXT*"
# ref. https://unix.stackexchange.com/a/248763/17671
: ref. https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-engine---community-1
`# remove previous version if any`
sudo apt -y remove docker docker-engine docker.io ;
`# set up apt repository`
sudo apt-get update ;
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common gnupg-agent ;
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - ; sudo apt-key fingerprint 0EBFCD88 ;
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" ;
@namgivu
namgivu / ubuntu-make-swap-file.sh
Last active August 16, 2023 12:42
increase swap file size to 8Gb
# ref. https://askubuntu.com/a/1075516/22308
sudo swapoff /swapfile # make all swap off
sudo rm -rf /swapfile # remove the current
# 8Gb = 8 * 1024Mb = 8192 Mb
# 4Gb = 4 * 1024Mb = 4096 Mb
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 # resize the swapfile to 4Gb
# =