Setup postgresql for RoR
Assume your database.yml file looks like this:
{: .yaml}
development:
adapter: postgresql
host: localhost
encoding: unicode
database: proj_development
pool: 5
username: proj
password:
template: template0
test:
adapter: postgresql
host: localhost
encoding: unicode
database: proj_test
pool: 5
username: proj
password:
template: template0
production:
adapter: postgresql
host: localhost
encoding:...
`ls` files in directory ordered by modification time
To do this you should type:
ls --full-time -t
The output will be similar to this:
drwxr-xr-x 2 konjoot konjoot 4096 2016-02-06 17:28:20.915296664 +0300 temp
drwxr-xr-x 40 konjoot konjoot 20480 2015-12-22 22:13:37.444222190 +0300 Books
-rw-rw-r-- 1 konjoot konjoot 186815 2015-05-26 21:52:29.326181000 +0300 ava.png
-rwx------ 1 konjoot konjoot 79011 2015-05-19 10:48:01.000000000 +0300 screen.png
drwxr-xr-x 3 konjoot konjoot 4096 2015-03-27 02:24:04.832060055 +0300 docs
drwxr-xr-x 2 konjoot konjoot 4096 2014-08-04 03...
SSH config for simplify connection to many similar hosts
Suppose you have three hosts (host.one.domain.name, host.two.domain.name host.three.domain.name) with the same credentials, with access by ssh key, then any time when you need to connect to host you must type something like this:
ssh user@host.one.domain.name -i path/to/key_file
^
ssh user@host.one.domain.name -i path/to/key_file
You can simplify your life by creating file ~/.ssh/config, with content:
Host one two three
HostName host.%h.domain.name
User user
IdentityFile path/to/key_file
And now ...
Extract contents of pfx bundle with Openssl
This card is the copycat from this awesome article, all thanks to Zsolt Agoston.
# Extract the private key
openssl pkcs12 -in wild.pfx -nocerts -nodes -out priv.cer
# Extract the public key
openssl pkcs12 -in wild.pfx -clcerts -nokeys -out pub.cer
# Extract the CA cert chain
openssl pkcs12 -in wild.pfx -cacerts -nokeys -chain -out ca.cer
Arch linux system upgrade
sudo pacman-mirrors -f5 # to update mirror list
sudo pacman -Syyu # system upgrade
Or oneliner
sudo pacman-mirrors -f5 && sudo pacman -Syyu
Reset RabbitMQ (Manjaro linux)
To reset RabbitMQ Mnesia database ensure that RabbitMQ process is running on your system. Then stop the running application:
sudo rabbitmqctl stop_app
After that run the command:
sudo rabbitmqctl reset
And then start the app:
sudo rabbitmq start_app
Ubuntu 14.04 locales reconfiguration.
If you getting messages like this: perl: warning: Setting locale failed. in your console, then you must configure your locales. First run:
locale
You will see something like this:
LANG=C
LANGUAGE=
LC_CTYPE=fi_FI.UTF-8
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE=fi_FI.UTF-8
LC_MONETARY="C"
LC_MESSAGES=fi_FI.UTF-8
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
Then generate the missing locale and reconfigure locales...