Showing posts from November, 2015

The Zen of Python

    Long time Pythoneer Tim Peters succinctly channels the BDFL's
    guiding principles for Python's design into 20 aphorisms, only 19
    of which have been written down.

The Zen of Python

    Beautiful is better than ugly.    Explicit is better than implicit.    Simple is better than complex.    Complex is better than complicated.    Flat is better than nested.    Sparse is better than dense.    Readability counts.    Special cases aren't special enough to break the rules.    Although practicality beats purity.    Errors should never pass silently.    Unless explicitly silenced.    In the face of ambiguity, refuse the temptation to guess.    There should be one-- and preferably only one --obvious way to do it.    Although that way may not be obvious at first unless you're Dutch.    Now is better than never.    Although never is often better than *right* now.    If the implementation is hard to explain, it's a bad idea.    If the implementation is easy to …

Windows 3.1 is still being used in the most important networks and systems today

I was really surprised when I read this news from zdnet: … "A Paris airport was forced to shut down earlier this month after a computer running Windows 3.1, a prehistoric operating system from 23 years ago, crashed in bad weather." … But old is not necessary bad as the article says: … "A few years ago we did a complete analysis of our entire network. Cyber engineers found out that the system is extremely safe and extremely secure on the way it's developed,"
"Those older systems provide us some, I will say, huge safety, when it comes to some cyber issues that we currently have in the world,"

Read the full report on the below given link.

Practical sed commands

I am posting a summary of my  commands after a bit of Googling and after playing on my CentOS VM with sed.

1. Always backup your files before playing with sed

2.The -i option in sed will replace the original file. So I recommend you run your
sed commands without the -i option first. Once you get the desired results of your sed command you
can then use the -i option.

append after <body>

sed  '/<body>/a Hello World' sample.html
sed -i  '/<body>/a Hello World' sample.html

append contents of file header-js.txt after <body>

sed -i '/<body>/ r header-js.txt' sample.html
sed -i '/<\/body>/ r footer-js.txt' sample.html

Some tests before proceeding further (tip: don't ignore the single quote)

[root@localhost mydir]# find . -name '*.html'

combine find with sed for mass modifications

find . -iname '*.html' -exec sed -i '/<body>/ r header-js.txt…

Bandwidth vs Speed Part 2

In one of my earlier posts I wrote about bandwidth vs speed using the road and car analogy.

This post has been written by Chandan Singh Takuli from CISCO.

Too fast Too furious - who doesn't like speed, especially when we talk about the internet or network connectivity? But the real question is, which is better to have: fast speed or more bandwidth? Although these terms are inter-related, they're not same. As an internet or network user, "fast speed" means a faster rate of data communications. That sounds good, because who doesn't want a fast network connection? But when we start thinking about it as network engineers, things change a little bit as we talk about bandwidth over WAN and speed over LAN. Many network engineering friends of mine ask me, "What’s the difference?" So let’s dive into it.
The data traveling speed over media is a different concept than the speed of network we are talking about here. When we say "high speed network," we are n…

Cisco - Sending Syslog Messages As SNMP Traps and Informs

The following is an extract from the book Cisco IOS Cookbook,2nd edition (available online) Problem You want to send syslog messages as SNMP traps or informs. Solution You can configure the router to forward syslog messages to your network management server as SNMP traps instead of syslog packets with the following configuration commands: Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#logging history informational Router(config)#snmp-server enable traps syslog Router(config)#snmp-server host ORATRAP syslog Router(config)#