2013/07/10

Bufexplorer patch (shorter buffer names)

Buffer Explorer Version 7.3.5 (http://www.vim.org/scripts/download_script.php?src_id=19481):

463,466c463,466
<         syn match bufExplorerModBuf    /^\s*\d\+.\{4}+.*/
<         syn match bufExplorerLockedBuf /^\s*\d\+.\{3}[\-=].*/
<         syn match bufExplorerHidBuf    /^\s*\d\+.\{2}h.*/
<         syn match bufExplorerActBuf    /^\s*\d\+.\{2}a.*/
---
>         syn match bufExplorerModBuf    /^\s*\d\+.\{3}+.*/
>         syn match bufExplorerLockedBuf /^\s*\d\+.\{2}[\-=].*/
>         syn match bufExplorerHidBuf    /^\s*\d\+.\{1}h.*/
>         syn match bufExplorerActBuf    /^\s*\d\+.\{1}a.*/
667c667,675
<         let line = buf.attributes." "
---
>         let line = buf.attributes
>               " remove unnecessary symbols ('#', ' ') in buffer attributes
>               let line = substitute(line, '[# ]', '', 'g').' '
>               " keep unchanged buffers aligned with changed ones
>               if line !~ '+'
>                       let line .= ' '
>               endif
>               " restore space right after buffer number
>               let line = substitute(line, '\([0-9]\+\)', '\1 ', '')

2013/06/04

Permissions fix

find . -type d -exec chmod 755 \{\} \;
find . -type f -exec chmod 644 \{\} \;
find . -regex '.*pl$\|.*php$' -exec chmod 755 \{\} \;

2013/03/18

Find excluding dirs

find . -type d \( -name dir1 -o -name dir2 \) -prune -o -printf "%f\n"

2013/02/21

Markdown in Vim

Download "mkd.vim" from:
http://www.vim.org/scripts/script.php?script_id=1242

To .vim/syntax

Put in .vimrc:
au BufRead,BufNewFile *.md set filetype=mkd

2013/01/28

Screen

.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

2012/12/25

Reset root password for PostgreSQL

EITHER:

$ 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