Skip to content

Instantly share code, notes, and snippets.

@Ruzzz
Ruzzz / dockerfile-entrypoint-cmd.md
Last active Mar 25, 2021
Dockerfile ENTRYPOINT + CMD
View dockerfile-entrypoint-cmd.md
  • Shell form: exec param
  • Exec form: ["exec", "param"]
No ENTRYPOINT ENTRYPOINT e0 p0 ENTRYPOINT ["e0", "p0"]
No CMD error /bin sh -c e0 p0 e0 p0
CMD ["e1", "p1"] e1 p1 /bin sh -c e0 p0 e0 p0 e1 p1
CMD ["p1", "p2"] p1 p2 /bin sh -c e0 p0 e0 p0 p1 p2
CMD e1 p1 /bin sh -c e1 p1 /bin sh -c e0 p0 e0 p0 /bin sh -c e1 p1
@Ruzzz
Ruzzz / gnupg_directory_permissions.sh
Created Sep 28, 2020
gnupg directory permissions
View gnupg_directory_permissions.sh
chmod 700 ~/.gnupg
chmod 600 ~/.gnupg/*
@Ruzzz
Ruzzz / ssh_directory_permissions.sh
Last active Sep 28, 2020
ssh directory permissions
View ssh_directory_permissions.sh
chmod 700 ~/.ssh
chmod 644 ~/.ssh/*
chmod 600 ~/.ssh/id_rsa
@Ruzzz
Ruzzz / postgres_11_hints.md
Last active Feb 24, 2020
postgres 11 hints
View postgres_11_hints.md

Pre-installation cleanup

dpkg -l | grep postgres
sudo apt-get purge postgresql*  # or
sudo apt-get --purge remove postgresql\*

sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/
@Ruzzz
Ruzzz / make_python.sh
Created Dec 17, 2019
Make python from source and install
View make_python.sh
# prerequsitis
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
# download, see https://www.python.org/ftp/python/
cd /opt
sudo wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
sudo tar xzf Python-3.8.0.tgz
cd Python-3.8.0
View ssh_vps_access.sh
# On remote host do:
# ------------------
# Add user
sudo adduser <USER> sudo
# Or:
sudo adduser <USER>
sudo usermod -a -G sudo <USER>
# Change ssh configuration
View openvpn_tips.sh
sudo apt install openvpn
# Download and apply configuration file
sudo cp ~/Download/NNN.ovpn /etc/openvpn/work.conf
rm ~/Download/NNN.ovpn
# Optional
sudo nano /etc/openvpn/work.pass
# Add password of private certificate
sudo chmod 600 /etc/openvpn/work.pass
@Ruzzz
Ruzzz / python_build.sh
Last active Aug 1, 2018
Build Python on Ubuntu
View python_build.sh
sudo apt update
sudo apt upgrade
sudo apt install -y build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev tcl-dev tk-dev tk openssl
# TODO: The necessary bits to build these optional modules were not found: _uuid
wget https://github.com/python/cpython/archive/v3.7.0.zip
unzip v3.7.0.zip
cd cpython-3.7.0
mkdir build1
cd build1
@Ruzzz
Ruzzz / wsl_ssh.sh
Created Jul 16, 2018
Enable SSH on Windows Subsystem for Linux (WSL)
View wsl_ssh.sh
sudo apt-get update
sudo apt-get upgrade
sudo nano /etc/ssh/sshd_config
# PasswordAuthentication yes
# UsePrivilegeSeparation no
sudo service ssh start
View python_virtualenv.cmd
pip3 install virtualenv
# mkdir project & cd project
virtualenv venv
virtualenv venv -p python3
source venv/bin/activate # linux
venv\Scripts\activate # windows
pip install Flask
pip install Flask==0.9
pip install --upgrade Flask
pip freeze > requirements.txt