Monthly Archive for February, 2014

WordPress: disabling quotes convertion

You have to edit the file default-filters.php which is located here:

Comment out the line:
add_filter( 'the_content', 'wptexturize' );

Based on this topic: .


Print the first line:
cat somefile.txt | awk ‘{print $1}’

… and see the number of active calls on Asterisk PBX:

asterisk -rx 'core show calls' | head -n 1 | awk '{print $1}'

Print all but first 6 columns of the file:
cat somefile.txt | awk ‘{$1=$2=$3=$4=$5=$6=””; print $0}’

… and see who’s trying to connect to 5060/TCP and 22/TCP (some fields reduced):

root@vds:~# tail -n 2 /var/log/syslog | awk '{$1=$2=$3=$4=$5=$6=""; print $0}'
      iptables denied Asterisk IN=eth0 SRC= DST=XX.XX.YY.ZZ PROTO=UDP SPT=5072 DPT=5060
      iptables denied SSH IN=eth0 SRC= DST=XX.XX.YY.ZZ PROTO=TCP SPT=6000 DPT=22

By default, awk doesn’t separate columns. To do that, use comma:

root@vds:~# grep Aster /var/log/syslog | awk '{print $1,$2,$3,$9,$13}'
Feb 17 07:03:25 Asterisk SRC=
Feb 17 07:13:23 Asterisk SRC=
Feb 17 07:56:31 Asterisk SRC=
Feb 17 08:12:02 Asterisk SRC=

PS: all these IPs are bad guys. They’re trying to connect to my SSH and SIP ports. So, I do not hide their addresses :)


In case you’ve got an output like


and want to get rid of first and last symbols:

rev input_file.txt | cut -c2- | rev | cut -c2-

In case your columns have some other delimiters than space, p.e. comma, specify it:

cat file.txt | awk -F',' '{print $3}'

Debian/Ubuntu: set default applications (both X11 and console)

To set the default web browser type:

sudo update-alternatives --config x-www-browser

This will lead to:

lexus@lexus:~$ sudo update-alternatives --config x-www-browser
There are 3 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                    Priority   Status
  0            /usr/bin/google-chrome   200       auto mode
* 1            /usr/bin/firefox         40        manual mode
  2            /usr/bin/google-chrome   200       manual mode
  3            /usr/bin/opera           200       manual mode

Press enter to keep the current choice[*], or type selection number: 

To set default editor:

update-alternatives --config editor

To edit (or leave with defaults) all variants, use:

sudo update-alternatives --all