November 02, 2011
Posted by: gdelmatto : Category:
Cisco,
Networking,
Perl,
Programming
Here’s a short script which I use to extract Cisco device-types from SNMP.
Bad enough, most of these devices return their device type ID differently, e.g. sometimes prefixed with an uppercase ‘C’, sometimes without any prefix, then again sometimes we find a suffix.
So here’s a snippet, that makes them look neat, so I can work with simple and unified looking device IDs.
Read more…
July 27, 2011
Posted by: gdelmatto : Category:
Perl,
Programming,
Scripting
The ‘cat’ utility serves it’s purpose print the content of a file at once. So do ‘more’ and other tools as well. But they all do in ‘forward’ mode only.
To print a file in reverse order, at least some linux distros come with the ‘tac’ command, which will do a ‘reverse cat’.
But what to do, if ‘tac’ is missing?
Read more…
July 14, 2011
Posted by: gdelmatto : Category:
Cisco,
Networking,
Programming,
RegExp
A project I’m currently working on involges much Regurlar Expressions trickery to parse values from Cisco’s running configuration.
Here’s how to extract a complete interface block not in ‘shutdown’ state.
Read more…
June 10, 2011
Posted by: gdelmatto : Category:
FreeBSD,
Operating Systems,
PHP
Today I had to add the PHP ‘bcmath’ extension to my FreeBSD host.
Actually, that’s a fairly easy one-liner:
[root@localhost ~]# cd /usr/ports/math/php5-bcmath && make clean install
However, I ended up with a crude error message:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
Bummer! So let’s see how to fix this.
Read more…
May 08, 2011
Posted by: admin : Category:
FreeBSD,
HowTo's,
Programming,
Utilities
“Redmine is a flexible project management web application. Written using Ruby on Rails framework, it is cross-platform and cross-database.” (redmine.org)
Here’s my short primer on setting up Redmine on FreeBSD.
Read more…
April 29, 2011
Posted by: admin : Category:
OS X,
Programming,
Utilities
So I work on OS X for a few years now, but until today that I didn’t really care about the underlying HFS+ file system.
But while working on a project using SVN, I got this unexpected error message:
gianpaolo-del-mattos-macbook-pro:trunk Gianpaolo$ svn update
svn: URL 'svn+ssh://...../webinterface/files/lib/webmin' of existing directory '...../webinterface/files/lib/Webmin' does not match expected URL 'svn+ssh://..../webinterface/files/lib/Webmin'
Read more…
March 31, 2011
Posted by: admin : Category:
Perl,
Programming,
Scripting
When writing shell scripts (bash, sh, etc) maybe you had to work with POSIX/UNIX timestamps from time to time.
While the serialized nature of the timestamp is great to work with for scripting, it’s easier for human beings to have them printed in date format.
Before you start digging around using some fancy conversion in Perl, check out the ‘date’ command first.
Read more…
December 15, 2010
Posted by: admin : Category:
PHP,
Programming,
Security
Gosh, some things really shouldn’t be done!
One thing for example is that stupid attitude to “scramble” PHP code by nesting it a zillion times using eval(), gz_deflate(), base64_encode() and str_rot13.
You find this in some “freely” available PHP scripts and some WordPress Themes as well. Actually nobody seems to care, that this may be well worth considering as a huge security hole!
Read more…
December 15, 2010
Posted by: admin : Category:
PHP,
Programming,
Scripting,
Security
November 22, 2010
Posted by: admin : Category:
Programming,
Scripting,
Shells
A discussion today was about error handling in shell scripts, Bash in particular.
Well, we all know about the usual knitpicks about error handling and the possible consequences in not doing so properly 
Read more…