November 09, 2011
Posted by: gdelmatto : Category:
Cisco,
TCL
Being used to other languages sometime leads to false assumptions, like having the same commands every now and then.
While doing some TCL scripting on a Cisco I just had the need for a ‘sleep’ command or equivalent.
Since no ‘sleep’ exists, the ‘after’ command will do. Just supply it with the timeout in milliseconds, like this for a 10-second timeout:
after 10000
Or, with a bit more overhead, but some may think it’s more readable:
after [expr {int(10 * 1000)}]
Comments Off on Sleep Timeout on TCL (and Cisco too…) :
Add Comment
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…
Comments Off on Extract and Unify Cisco Device-Types with SNMP and Perl :
Add Comment
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…
Comments Off on Print File Contents in Reverse Order (“reverse cat”) :
Add Comment
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…
Comments Off on RegExp Filter: Extract complete interface blocks without ‘shutdown’ statement :
Add Comment
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…
Comments Off on Fixing “Cannot find autoconf” error while building PHP extension from a FreeBSD port :
Add Comment
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…
Comments Off on Mac OS HFS+ case-insensitivenesss screws SVN :
Add Comment
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…
Comments Off on Obfuscated PHP code in WordPress Themes or PHP scripts may be a security hole! :
Add Comment
December 15, 2010
Posted by: admin : Category:
PHP,
Programming,
Scripting,
Security
Comments Off on De-Scrambler for obfuscated PHP code :
Add Comment