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
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global alias.sweep '!git branch --merged $([[ $1 != "-f" ]] \
&& git rev-parse master) | egrep -v "(^\*|^\s*(master|develop)$)" \
| xargs git branch -d'
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_CUDA=ON \
-D ENABLE_FAST_MATH=1 \
-D WITH_FFMPEG=ON \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_MKL=ON \
-D MKL_USE_MULTITHREAD=ON \
sudo apt-get install --reinstall ubuntu-desktop && sudo apt-get install -f
#another way
sudo apt-get install gnome-desktop-environment metacity metacity-common libmetacity0 compiz-core compiz-gnome compiz python-compizconfig compizconfig-settings-manager compiz-plugins compiz-wrapper libdecoration0 compiz-fusion-plugins-main compiz-fusion-plugins-extra compizconfig-backend-gconf
@fonylew
fonylew / install.sh
Last active April 22, 2020 05:05
Server installation script (update April 2020)
#!/bin/bash
sudo whoami
sudo apt update
sudo apt -y upgrade
sudo apt install -y openssh-server neovim net-tools nfs-common cifs-utils
sudo apt install -y curl git python3-pip gcc cmake nmap
@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 / 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 / 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 / .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 / 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