Skip to content

Instantly share code, notes, and snippets.

View fonylew's full-sized avatar
🐝
Go Jackets!

Kamolphan Lewprasert fonylew

🐝
Go Jackets!
View GitHub Profile
@fonylew
fonylew / docker-run.sh
Created April 18, 2020 17:36
RStudio Docker run command
docker run -d --name rstudio -p [TARGET_PORT]:8787 -v $(pwd):/home/[USER]/[MOUNT_DIR] --restart=always -e ROOT=TRUE -e USER=[USER] -e PASSWORD=[PASSWORD] rocker/rstudio
@fonylew
fonylew / install_python3.7.sh
Created March 6, 2020 12:27
Install Python 3.7 (Ubuntu 18.04)
sudo apt install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
@fonylew
fonylew / .bash_aliases
Created February 27, 2020 07:55
Bash Password Generator
function gen_pass(){
default_len=13
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-${1:-$default_len}};echo;
## OpenSSL random (alternatives: base64)
#openssl rand -base64 ${1:-$default_len} | colrm 17
}
@fonylew
fonylew / README.md
Last active March 6, 2020 11:41
Common Python Problem

Common Python Problems and Solutions

pip3 is broken

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

Solution: sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall Ref: pypa/pip#5447 (comment)

@fonylew
fonylew / install-local-server.sh
Last active August 31, 2023 12:50
A bunch of script to install Nvidia with CUDA10, CUDNN 7.4 and so on.
#!/bin/bash
# First sudo command
sudo whoami
# Update and upgrade
sudo apt update
sudo apt upgrade -y
# Utility
@fonylew
fonylew / beer-gpu-note.md
Created February 13, 2019 11:03
Beer's post-it as a caveat of GPU troubleshooting on Ubuntu (16.04 or later)
sudo apt purge nvidia-*
sudo apt autoremove
sudo reboot
--------------------------------

sudo apt remove --purge nvidia*
sudo dpkg --configure -a
sudo reboot
--------------------------------
@fonylew
fonylew / nuc-setup-script.sh
Last active January 23, 2019 07:04
Setup script for an Ubuntu PC
#!/bin/bash
sudo apt update
sudo apt upgrade -y
# Essential
sudo apt install -y git python3-pip gcc cmake
# Networking tools
sudo apt install -y curl net-tools
@fonylew
fonylew / setup-script.sh
Created January 2, 2019 10:31
my Ubuntu setup script
#!/bin/bash
sudo apt update
sudo apt upgrade -y
# Essential
sudo apt install -y git python3-pip gcc cmake
# Networking tools
sudo apt install -y curl net-tools
@fonylew
fonylew / .bash_aliases
Last active July 31, 2018 08:50
Public: Bash aliases that useful for me, also some simple wrapper for GCloud SDK
alias usage='du -sh *|sort -n'
alias pubip="curl 'https://api.ipify.org'"
alias vbashal='vim ~/.bash_aliases'
alias vsshconfig='vim ~/.ssh/config'
alias sbashrc='source ~/.bashrc'
alias sourceme='source ~/.bashrc'
alias clipboard='xclip -selection clipboard'
@fonylew
fonylew / start-sandbox-hdp-standalone_2-6-4-presto.sh
Created May 24, 2018 11:41
Start HDP 2.6.4 Sandbox with Presto 0.202 [fonylew/sandbox-hdp-standalone:2.6.4-presto-0.202]
#!/bin/bash
echo "Waiting for docker daemon to start up:"
until docker ps 2>&1| grep STATUS>/dev/null; do sleep 1; done; >/dev/null
docker ps -a | grep sandbox-hdp
if [ $? -eq 0 ]; then
docker start sandbox-hdp
else
docker pull fonylew/sandbox-hdp-standalone:2.6.4-presto-0.202
docker run --name sandbox-hdp --hostname "sandbox-hdp.hortonworks.com" --privileged -d \
-p 15500:15500 \