Showing posts from 2015

The Zen of Python

Abstract     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

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. SOURCE:

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. WARNING & ADVICE:  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' ./sample2.html ./sample3.html ./sample.html combine find with sed for mass modifications find . -iname '*.html' -exec

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 netwo

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)# end Router# To forward syslog messages as SNMP informs, use 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 informs Router(config)# snmp-server host informs version 2c ORATRAP syslog Route

fail2ban - a tool for linux security

From the official website of fail2ban: Fail2ban scans log files (e.g. /var/log/apache/error_log) and bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. Generally Fail2Ban is then used to update firewall rules to reject the IP addresses for a specified amount of time, although any arbitrary other action (e.g. sending an email) could also be configured. Out of the box Fail2Ban comes with filters for various services (apache, courier, ssh, etc). Fail2Ban is able to reduce the rate of incorrect authentications attempts however it cannot eliminate the risk that weak authentication presents. Configure services to use only two factor or public/private authentication mechanisms if you really want to protect services. Good uses of fail2ban: Your linux server has SSH and is exposed to the internet. The bad guys there will try to break into your system by brute-forcing/dictionary attacks. fail2ban will block 3 unsuccessful login attempts for

Demystifying the FREE command in LINUX

The free command is used in LINUX to give stats about MEMORY/SWAP usage. Others may have blogged about this simple command before but most important is HOW to understand & interpret the results. Beginners might be confused the first time they run the command. A little theory on MEMORY USAGE in LINUX : “In Linux, unused memory is wasted memory” That’s why memory is used for caching whenever possible. I got the following nice illustration from Linux Performance and Tuning Guidelines by IBM (RedPaper) The amount of FREE MEMORY is calculated by the formula: FREE = free + buffers + cached Another website dedicated completely to  the FREE command is :     by Vidar Holen

What Software Defined Networking (SDN) is all about?

I have been hearing a lot on SDN for quite a long time. There are many articles on the web which talks about it but does not adequately explain what IS SDN really. I finally decided to write on SDN from my perspective. Let’s start with a simple example. We have CISCO Router (I like cisco). I want to check whether my CISCO Router can ping an IP on the Internet. To do this I will carry the following steps: 1. telnet or ssh into the router 2. ping an IP address on the internet ( If I have to do this regularly it becomes a boring thing. What if I can write an Application which can telnet/ssh into my router, then perform a ping and check whether the ping was successful or not? This is where SDN comes into play. SDN allows you to programmatically configure or run commands on your switches and routers. I think that the right word for this should have been Programmable Networks (I have seen this on some networking vendor’s website) To make SDN ha

Play all file formats in Windows Media Player

Windows 8 Codec Pack is a FREE software which allows you to play lots of file formats such as flv and mkv in your Windows Media Player . The name of the software is misleading I think…it supports not only windows 8/8.1 but also 7, Vista, XP, 2000, 2008, & 2003. The software is compatible with Microsoft Windows Media Player 9, 10, 11, & 12. Now you can relax and play all your files in Windows Media Player . You don’t need any separate player for playing video files such as flv and mkv . From the Windows 8 Codec Pack website : Compression types that you will be able to play include: x265 | h.265 | HEVC | 10bit x264 | x264| h.264 | AVCHD | AVC | DivX | XviD | MP4 | MPEG4 | MPEG2 and many more. File types you will be able to play include: .bdmv | .evo | .hevc | .mkv | .avi | .flv | .webm | .mp4 | .ts | .m4v | .m4a | .ogm | .ac3 | .dts | .flac | .ape | .aac | .ogg | .ofr | .mpc | .3gp and many more. Codec's Explained : A codec is a piece of softw

Today March 31 is World Backup Day

The world backup day is an initiative to make people aware on the importance of backup. The official website of World Backup Day is at Your hard disk, smartphone or laptop may not be always loyal to you. Computers get infected with viruses, smartphones are lost and your hard disk gets fried. “Remember backup is a continuous process not a one off process. You must always backup your data not only on 31 March.” WHAT IS BACKUP? Let’s quote exactly from the website: A backup is a second copy of all your important files — for example, your family photos, home videos, documents and emails. Instead of storing it all in one place (like your computer), you keep another copy of everything somewhere safe. WHY SHOULD YOU BACKUP ? Your data is valuable. It’s important because you might need it for personal and professional reasons. Your ebooks, your final year dissertation, your source codes, your customer list, your chi

Best practices for virtual machine snapshots in the VMware environment (KB1025279)

The following has been taken from  VMware Knowledge Base  -  KB 1025279 Snapshots are not backups . A snapshot file is only a change log of the original virtual disk. Therefore, do not rely on it as a direct backup process. The virtual machine is running on the most current snapshot, not the original vmdk disk files. Snapshots are not complete copies of the original vmdk disk files. Taking a snapshot does not create a complete copy of the original vmdk disk file, rather it only copies the delta disks. The change log in the snapshot file combines with the original disk files to make up the current state of the virtual machine. If the base disks are deleted, the snapshot files are useless. Delta files can grow to the same size as the original base disk file , which is why the provisioned storage size of a virtual machine increases by an amount up to the original size of the virtual machine multiplied by the number

InstalledDriversList Tool - View Installed Drivers

About 5 minutes ago I found a nice freeware tool ( InstalledDriversList ) which can be used to view the installed drivers on your PC. From the official website of InstalledDriversList : InstalledDriversList is a simple tool for Windows that lists all device drivers that are currently installed on your system. For every device driver, the following information is displayed: Driver Name, Display Name, Description, Startup Type, Driver type, Driver Group, Filename, File Size, Modified/Created Time of the driver file, and version information of the driver file.  If the driver is currently running on Windows kernel, the following information is also displayed: Base Memory Address, End Address, Memory Size, and Load Count. This tool may be used to identify which drivers are causing trouble on Windows. Again quoting the original text: Green Icon - The driver is running on Windows kernel. Yellow Icon - The driver is not running on Windows kernel. Red Icon - The driver i

Murphy's computers laws

I found the following “laws” from Murphy's computers laws .  I selected the best ones which I think are true, funny and interesting. Read them and have a nice day. If a program is useless, it will have to be documented   Bugs will appear in one part of a working program when another 'unrelated' part is modified. Adding manpower to a late software project makes it later. A working program is one that has only unobserved bugs. No matter how many resources you have, it is never enough. Any cool program always requires more memory than you have. When you finally buy enough memory, you will not have enough disk space. Disks are always full. It is futile to try to get more disk space. Data expands to fill any void. If a program actually fits in memory and has enough disk space, it is guaranteed to crash. If such a program has not crashed yet, it is waiting for a critical moment before it crashes.   No matter how good of a deal you get on computer componen