funny utp cable
  en [magyar]
mnb.hu p5-SOAP-Lite
2013-03-29 12:00 [ZL]
Perl example of getting current HUF-currency pairs from MNB (Hungarian National Bank) using p5-SOAP-Lite module:

#/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use SOAP::Lite;

my $objSoap = SOAP::Lite->new(proxy => 'http://www.mnb.hu/arfolyamok.asmx');
$objSoap->on_action(sub { '"' . $_[0] . $_[1] . '"' });
$objSoap->default_ns('http://www.mnb.hu/webservices/');
my $objSom = $objSoap->call('GetCurrentExchangeRates');
if($objSom->fault) {
  die $objSom->faultstring;
}
print Dumper $objSom->result, "\n";
cut ( and ) by using sed
2012-04-30 12:00 [ZL]
The following shell command gives an error:
echo $NAME | sed 's/\(//g'
sed: 1: "s/\(//": RE error: parentheses not balanced

Working version you can use:
echo $NEV | sed 's/[(]//g'
last column of TXT
2012-04-20 12:00 [ZL]
Here comes an AWK trick to get the last column:
cat <filename> | awk '{ print $NF }'

For getting the previous column:
cat <filename> | awk '{ print $(NF-1) }'
VirtualBox Ctrl+Alt+Del
2012-03-30 12:00 [ZL]
Sending soft reset to VM (it is like pressing Ctrl+Alt+Del on keyboard):
VBoxManage controlvm VMNAME keyboardputscancode 1d 38 53 b8 9d
determination of regexp position in a file
2011-05-13 12:00 [ZL]
We sometimes need to determinate the position of a certain regexp in a file using simple unix commands.
Here comes an easy way for that:
grep -B999999 'regexp' <filename> | wc -l

(This example works until 999999 lines, if you need more, please adjust -B value.)
skipping first line from file
2011-03-28 12:00 [ZL]
Skipping first line from a small size text file
more +2 filename
For file more than one page:
tail +2 filename
first weekday of the month
2011-03-23 12:00 [ZL]
It is easy to get the desired weekday of the next month in PostgreSQL 8.3+. For example let us get the first Tuesday:

SELECT
  CASE WHEN (2 - extract('dow' FROM date_trunc('month', now() + interval '1 month'))) < 0
 THEN 9 - extract('dow' FROM date_trunc('month', now() + interval '1 month'))
 ELSE 2 - extract('dow' FROM date_trunc('month', now() + interval '1 month'))
 END * interval '1 day' + date_trunc('month', now()) + interval '1 month' AS next_tue
Explanation:
extract('dow' from date_string): returns the week numbering of the day (0=Sunday, 9=Saturday), Tuesday=2
CASE WHEN ... THEN ... ELSE ... END: testing of negative number when shifting days. It is because we would like to prevent code from shifting back to previous month. If negative value detected then we add extra 7 days.
date_trunc('month', date_string): truncate the date with keeping month and larger entities (years in this case)
awk round()
2011-02-23 12:00 [ZL]
Round float values in 'awk':
# cat some.txt | awk '{ printf "%.0f", $1; }'
Linux blkid
2011-02-18 12:00 [ZL]
Messed up disks/partitions in Linux?
# blkid /dev/sdb1
/dev/sdb1: UUID="b9be1356-bc62-4bd5-9d76-e4a6da922c36" TYPE="reiserfs"
tells about their original UUIDs.





















 

NEWSGROUPS
  Projects
  Support
more info: lyuk@zl.hu
FOR CUSTOMERS
OF OURSELVES
  Bit Vader
  Blog