Fix weird flux menu

2017-05-03 1 min read Learning Linux
Some distro’s just add all the items under single menu and thus the menu itself becomes unusable because of the number of items in the submenu and this I did not like and hence ceated this simply python script to fix that. For using the script, back up you “menu” file, redirect the output of this script to ‘menu’ file again. #!/bin/python F = open("~/.fluxbox/menu", "r") count=0 mkc=1 started=0 for line in F: print line. Continue reading

scapy packet dump to packet

2017-04-10 1 min read Learning
First you need to have scapy installed. And if you don’t know about scapy, then Scapy is a powerful interactive packet manipulation program. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, match requests and replies, and much more. It can easily handle most classical tasks like scanning, tracerouting, probing, unit tests, attacks or network discovery (it can replace hping, 85% of nmap, arpspoof, arp-sk, arping, tcpdump, tethereal, p0f, etc. Continue reading

Get disk usage for all the containers with python script

2017-01-16 1 min read Python
With my increasing love for python, here is my attempt to get the disk usage of all the containers on some host. Well, since the requirements vary for everyone, so this script is far from complete. import docker import json # We will connect to 192.168.122.1 for docker daemon. If that is not the case, # then change the below. client = docker.DockerClient(base_url="tcp://192.168.122.1:4243") # Get list of all containers. cls=client.containers.list() stats={} # And now we will iterate over that list to get stats for all the containers. Continue reading

supernova – manage multiple openstack environment

2016-08-01 1 min read Vurtualization
supernova is an easy to use tool that helps manage multiple openstack environments. Details – Name : supernova Arch : noarch Epoch : 0 Version : 2.2.0 Release : 2.fc24 Size : 62 k Repo : @System From repo : fedora Summary : Use novaclient with multiple OpenStack nova environments the easy way URL : https://github.com/major/supernova License : ASL 2.0 Description : supernova manages multiple nova environments without sourcing novarc files or mucking with environment variables. Continue reading

Python script to manage virtual machines with python API for libvirt.

2016-07-04 4 min read Vurtualization
Most of times I use virt-manager to manage VMs but sometimes, I have to manage VMs on other hosts over ssh when connected over VPN or while I am working remotely. GUI like virt-manager thus becomes slow, and hence I like to use cli commands and nothing is better than virsh. But here is simple script that I use sometimes to manage the VMs with CLI based menu. Hope you find it useful. Continue reading

get the contents of whole site like some wiki or wikia

2014-02-24 1 min read Learning Uncategorized
For wikis and wikia, generally if you are trying to get some url mirror, then websucker.py is an excellent option. This script is in the python sources so, to get this tool, yumdownloader --source python Install the rpm downloaded in current directory and then go to ~/rpmbuild/SOUURCES. You should find a Python-*.tar.xz file here, just extract with tar xvf Python*.tar.xz and there you go, you should find the tool in Tools/webchecker/websucker. Continue reading

Check all vim colorschemes for minor issues

2013-10-10 2 min read bash Vim Tips
Here is script that checks all the colorschemes in the current directory and corrects them if possible (Processing of the file is done with simple commands like sed, grep) Checks that the color_name is same as Filename Here is the script: #!/bin/bash - #=============================================================================== # # FILE: check_colors.sh # # USAGE: ./check_colors.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka), # REVISION: --- #=============================================================================== cd ~/. Continue reading
Older posts