Author Archives: Vitalijus Ryzakovas

docker bash autocompletion

cd /etc/bash_completion.d/
wget https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker

For docker-compose:
curl -L https://raw.githubusercontent.com/Yelp/docker-compose/master/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose

docker-compose latest version

VERSION=$(curl –silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po ‘”tag_name”: “\K.*\d’)
curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

wkhtmltopdf without x server

apt-get install libxrender1
Download https://wkhtmltopdf.org/downloads.html
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

ar vx wkhtmltox_0.12.5-1.bionic_amd64.deb
x – debian-binary
x – control.tar.gz
x – data.tar.xz

tar xf data.tar.xz
mv -v ./usr/local/bin/wkhtmlto* /usr/bin/
renamed ‘./usr/local/bin/wkhtmltoimage’ -> ‘/usr/bin/wkhtmltoimage’
renamed ‘./usr/local/bin/wkhtmltopdf’ -> ‘/usr/bin/wkhtmltopdf’

wkhtmltopdf
You need to specify at least one input file, and exactly one output file
Use – for stdin or stdout

Name:
wkhtmltopdf 0.12.5 (with patched qt)

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash curl: (22) The requested URL returned error: 404

Ubuntu 20 install Ruby 3

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
curl: (22) The requested URL returned error: 404

curl -fsSL https://raw.githubusercontent.com/rbenv/rbenv-installer/main/bin/rbenv-installer | bash
Installing rbenv with git…
Initialized empty Git repository in /root/.rbenv/.git/
Updating origin
remote: Enumerating objects: 2960, done.
remote: Counting objects: 100% (117/117), done.
remote: Compressing objects: 100% (66/66), done.
remote: Total 2960 (delta 62), reused 91 (delta 51), pack-reused 2843
Receiving objects: 100% (2960/2960), 577.31 KiB | 7.60 MiB/s, done.
Resolving deltas: 100% (1850/1850), done.
From https://github.com/rbenv/rbenv
* [new branch] master -> origin/master
* [new tag] v0.1.0 -> v0.1.0
* [new tag] v0.1.1 -> v0.1.1
* [new tag] v0.1.2 -> v0.1.2
* [new tag] v0.2.0 -> v0.2.0
* [new tag] v0.2.1 -> v0.2.1
* [new tag] v0.3.0 -> v0.3.0
* [new tag] v0.4.0 -> v0.4.0
* [new tag] v1.0.0 -> v1.0.0
* [new tag] v1.1.0 -> v1.1.0
* [new tag] v1.1.1 -> v1.1.1
* [new tag] v1.1.2 -> v1.1.2
* [new tag] v1.2.0 -> v1.2.0
Branch ‘master’ set up to track remote branch ‘master’ from ‘origin’.
Already on ‘master’
make: Entering directory ‘/root/.rbenv/src’
gcc -fPIC -c -o realpath.o realpath.c
gcc -shared -Wl,-soname,../libexec/rbenv-realpath.dylib -o ../libexec/rbenv-realpath.dylib realpath.o
make: Leaving directory ‘/root/.rbenv/src’

Installing ruby-build with git…
Cloning into ‘/root/.rbenv/plugins/ruby-build’…
remote: Enumerating objects: 12195, done.
remote: Counting objects: 100% (888/888), done.
remote: Compressing objects: 100% (302/302), done.
remote: Total 12195 (delta 604), reused 773 (delta 529), pack-reused 11307
Receiving objects: 100% (12195/12195), 2.54 MiB | 9.16 MiB/s, done.
Resolving deltas: 100% (8071/8071), done.

All done!

/root/.rbenv/bin/rbenv install 3.0.2
Downloading ruby-3.0.2.tar.gz…
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.gz
Installing ruby-3.0.2…
Installed ruby-3.0.2 to /root/.rbenv/versions/3.0.2

MySecureShell

MySecureShell is a solution which has been made to bring more features to sftp/scp protocol given by OpenSSH. By default, OpenSSH brings a lot of liberty to connected users which imply to trust in your users. The goal of MySecureShell is to offer the power and security of OpenSSH, with enhanced features (like ACL) to restrict connected users.

postgresql vacumm disk space

Run vacuumdb without increasing disk space:

service postgresql stop
mv /var/lib/postgresql/9.5/main /mnt/new_disk
ln -s /mnt/new-disk/main /var/lib/postgresql/9.5
chown postgres:postgres /mnt/new-disk
service postgresql start
vacuumdb –all –full
service postgresql stop
rm /var/lib/postgresql/9.5/main
mv /mnt/new_disk/main /var/lib/postgresql/9.5
service postgresql start