Skip to content

Instantly share code, notes, and snippets.

View Ruzzz's full-sized avatar

Ruslan Zaporojets Ruzzz

View GitHub Profile
@Ruzzz
Ruzzz / dockerfile-entrypoint-cmd.md
Last active March 25, 2021 16:31
Dockerfile ENTRYPOINT + CMD
  • 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
Last active February 1, 2023 23:36
gnupg directory permissions
chmod 700 ~/.gnupg
chmod 600 ~/.gnupg/*
find ~/.gnupg -type f -exec chmod 600 {}
find ~/.gnupg -type d -exec chmod 700 {}
@Ruzzz
Ruzzz / ssh_directory_permissions.sh
Last active September 28, 2020 11:48
ssh directory permissions
chmod 700 ~/.ssh
chmod 644 ~/.ssh/*
chmod 600 ~/.ssh/id_rsa
@Ruzzz
Ruzzz / postgres_11_hints.md
Last active February 24, 2020 17:45
postgres 11 hints

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 / build-python.md
Last active October 14, 2021 21:30
Build Python on Ubuntu

Python-3.7.0 - Ubuntu ??

sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential libbz2-dev libdb5.3-dev libexpat1-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev tcl-dev tk-dev zlib1g-dev tk openssl

cd /opt
sudo curl -sL https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz | sudo tar xJ

cd Python-3.7.0
# On remote host do:
# ------------------
# Add user
sudo adduser <USER> sudo
# Or:
sudo adduser <USER>
sudo usermod -a -G sudo <USER>
# Change ssh configuration
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 / wsl_ssh.sh
Created July 16, 2018 06:49
Enable SSH on Windows Subsystem for Linux (WSL)
sudo apt-get update
sudo apt-get upgrade
sudo nano /etc/ssh/sshd_config
# PasswordAuthentication yes
# UsePrivilegeSeparation no
sudo service ssh start
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
# DEPS:
# https://github.com/dropbox/dbxcli
# sudo apt-get install p7zip-full
DB_USER=
DB_PASS=
DB_NAME=
DB_TABLES=
ARC_PASS=