Skip to content

Instantly share code, notes, and snippets.

Ruslan Zaporojets Ruzzz

View GitHub Profile
@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 longest_streak_of_posts.sql
SELECT
uid,
max(date_sequence_count) as max_date_sequence_count
FROM (
SELECT
uid,
COUNT(date_sequence_id) + 1 AS date_sequence_count
FROM (
-- same rank for sequence
SELECT
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
View backup_mysql_to_dropbox.sh
# DEPS:
# https://github.com/dropbox/dbxcli
# sudo apt-get install p7zip-full
DB_USER=
DB_PASS=
DB_NAME=
DB_TABLES=
ARC_PASS=
View cmake_gen.cmd
:: Author: Ruslan Zaporojets
:: Email: ruzzzua[]gmail.com
:: Date: 2017-10-12
:: Usage: this.cmd DIR GENERATOR [TOOLSET]
:: Example: this.cmd VS2017x64XP "Visual Studio 15 Win64" v141_xp
if "%1"=="" goto :MY
cd /d "%~dp0"
set BUILD_DIR=build
if not "%3"=="" ( set TOOLSET=-T %3 ) else ( set TOOLSET= )
You can’t perform that action at this time.