.screenrc:
hardstatus alwayslastline "%{+b rk}%H%{gk} %c %{yk}%d.%m.%Y %?%{wk}%-Lw%?%{gk}%n*%f %t%?(%u)%?%?%{wk}%+Lw%?%{yk}%84=Load: %l %{wk}"
screen -ls
screen
screen -x : show attached
screen -d : detach
screen -r : reattach
^a c : new window
^a ^a : toggle windows
^a 1 : show window #1
^a A : rename window
2013/01/28
2012/12/25
Reset root password for PostgreSQL
EITHER:
OR:
# vi $(grep 'hba_file' $(ps -ef | grep postgres | awk '{ if ( $3 == 1 ) print $NF }' | cut -d '=' -f 2) | cut -d "'" -f 2)
#local all postgres md5
local all postgres trust
# service postgresql-8.4 restart
# su - postgres
$ psql -d template1 -U postgres
> alter user postgres with password 'new_password';
# vi /etc/postgresql/8.4/main/pg_hba.conf
OR:
# vi $(grep 'hba_file' $(ps -ef | grep postgres | awk '{ if ( $3 == 1 ) print $NF }' | cut -d '=' -f 2) | cut -d "'" -f 2)
local all postgres md5
#local all postgres trust
# service postgresql-8.4 restart
$ psql -d template1 -U postgres
$ ps -ef | grep postgres
postgres 3940 1 0 12:38 ? 00:00:00 /usr/lib/postgresql/8.4/bin/postgres -D /var/lib/postgresql/8.4/main -c config_file=/etc/postgresql/8.4/main/postgresql.conf
$ grep 'hba_file' /etc/postgresql/8.4/main/postgresql.conf
hba_file = '/etc/postgresql/8.4/main/pg_hba.conf' # host-based authentication file
# vi /etc/postgresql/8.4/main/pg_hba.conf
OR:
# vi $(grep 'hba_file' $(ps -ef | grep postgres | awk '{ if ( $3 == 1 ) print $NF }' | cut -d '=' -f 2) | cut -d "'" -f 2)
#local all postgres md5
local all postgres trust
# service postgresql-8.4 restart
# su - postgres
$ psql -d template1 -U postgres
> alter user postgres with password 'new_password';
# vi /etc/postgresql/8.4/main/pg_hba.conf
OR:
# vi $(grep 'hba_file' $(ps -ef | grep postgres | awk '{ if ( $3 == 1 ) print $NF }' | cut -d '=' -f 2) | cut -d "'" -f 2)
local all postgres md5
#local all postgres trust
# service postgresql-8.4 restart
$ psql -d template1 -U postgres
2012/11/08
Efficient splitting every 3 digits
my $num = 12_345_678;
$num = reverse $num;
$num = reverse join( ' ', grep( $_, split( /(...)/g, $num ) ) );
# $num = '12 345 678';
$num = reverse $num;
$num = reverse join( ' ', grep( $_, split( /(...)/g, $num ) ) );
# $num = '12 345 678';
2012/10/31
UTF8
# flags source code as UTF8
use utf8;
# flags STDOUT as UTF8
binmode(STDOUT, ":encoding(utf-8)");
use utf8;
# flags STDOUT as UTF8
binmode(STDOUT, ":encoding(utf-8)");
2012/10/23
Stop "sshd" in Ubuntu
Internet says this one works:
sudo update-rc.d -f sshd remove
but it isn't.
It does NOT work.
The following works:
sudo apt-get remove openssh-server
sudo update-rc.d -f sshd remove
but it isn't.
It does NOT work.
The following works:
sudo apt-get remove openssh-server
2012/10/18
Real UID vs Effective UID
If you think about a large company where employees have different levels
of access to different locations, you could compare the Real User ID
to the name badges people wear, and the Effective User ID to the set of
keys they've been given.
2012/10/12
Subscribe to:
Posts (Atom)