Create htpasswd entry and print to stdout:
$ sudo apt install apache2-utils # Optional
$ htpasswd -n $USERNAME
New password:
Re-type new password:
$USERNAME:<Password Hash>
Related cards:
Create swap space on Linux
Create a 1 GB file to swap to (we have sufficient space on / on this machine. Use a different partition if necessary)
sudo dd if=/dev/zero of=/var/swapfile bs=1M count=1024
If you prefer 2GB swap, chose count=2048
, 4GB: count=4096
C...
dumping and restoring PostgreSQL databases
This card is just about creating simple PostgreSQL dumps. This is no instruction for a backup strategy nor a guide for SQL dump performance optimization.
Read before starting
- I will assume that all commands will be executed as local `postgr...
HowTo apply Test Driven Development to Container Images
Apply Test Driven Development(TDD) to the process of building container images by defining test before writing code and automate the testing process. Iterate through the TDD cycle while developing and running the tests later in continuous integrat...
FAQ for When PostgreSQL Indexes Are Corrupted After Locale Changes
When changing glibc versions, it's possible to end up with corrupt indexes in PostgreSQL.
Are My Indexes Affected?
If your database has...
Manually create Postgres password hash
For some reason you have to pass the password hash if you want to create a role in postgres. To calculate the hash use the following snippet:
echo -n "md5"; echo -n "${PG_PASSWORD}${PG_USERNAME}" | md5sum | awk '{print $1}'
HowTo: Clone and refresh all repos in a GitLab Group
If the project you're working on has, say, 39 repositories and counting in GitLab and you need all the repos checked out for some reason, here's how to do it.
Checking out all repos
- Create a personal access token for GitLab that has the `A...
How to unban host with Fail2ban
To see all jails:
fail2ban status
Our $JAIL is usually ssh
.
To see which IPs are banned currently:
fail2ban-client status ssh
If you want to unban a host banned by fail2ban on Ubuntu 14.04 or later use this method:
How to remove cloud init from ubuntu
If you're trying to start a cloud-init based Ubuntu VM with KVM you will suffer long boot times and confusing output on the terminal. If you want to get rid of it you need to remove cloud-init.
- wait until the VM boots
- login
- `echo 'datas...
Change / Update SSL certificate for Amazon Elastic Load Balancer with AWS Command Line Interface
-
Install and configure the AWS Command Line Interface
-
Show existing certificates to test if the AWS Cli is working:
$ aws iam list-server-certificates { "ServerCertificateMetadataList": [...
Useful PostgreSQL commands
on the bash (issued as postgres user)
Start/Stop/Restart PostgreSQL
pg_ctl -D $configdir start|stop|restart
Start/Stop/Restart the corresponding PostgreSQL using the given configuration directory. The configuration directory sh...