Clean files content

Useful command to clean all files content of a directory without removing it… Use cases: you have an application running and you don’t want to stop you don’t want to think about reset file permission that somebody else has configured in a bad way

SQL server

Select query for production (nolock) Table lock simulation Backup Command line database backup using SqlCmd tool (localhost database) Restore Command line database restore using SqlCmd tool (localhost database) Link tablespace to filegroup Get active connection Try catch block Ram by database Ram by tables Shrink database Table count and dimensions Read more…

Postgres

Clone a database with an existing local one Connect to the database with a user with proper right and make sure that the sourcedb does not have opened connection. Database dump Database restore Get table fields Try catch block

Git cherry pic

Sometimes you need to move your develop from a branch to another; in this case the cherry pick command is your friend. Definition: given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no Read more…

Certbot – SSL certificates

Certbot it’s an cool tool that automatically enable HTTPS on your website deploying Let’s Encrypt certificates. How to Centos not snap – not anymore supported Snap install See the official guide https://certbot.eff.org/lets-encrypt/centosrhel7-apache To create the certificates Your certificates are deployed (usually) under /etc/letsencrypt/live/domain.tld/ cert.pem is the certificate privkey.pem is the Read more…

Backup folders

Rsync, which stands for “remote sync”, is a remote and local file synchronization tool. It uses an algorithm that minimizes the amount of data copied by only moving the portions of files that have changed. Here an example

Docker

Docker installation for centos See active containers Docker file example Build using bocker file in the same dir See all docker images Delete an image Stop a container Enter in a container and start a /bin/bash session Copy file Docker compose up and build Prune images and containers Docker service