Xterm Configuration

Xterm is the fastest terminal emulator out there but it looks and feels crappy in its default settings. Here are a couple of tweaks that I apply for it to be usable for me.Add/Create the following in your ~/.Xresources file! Use a nice truetype font and size by default... xterm*faceName: DejaVu San…

Tracking Books Read in 2019

Catcher in the rye by J.D. SalingerDeep Work: Rules for Focused Success in a Distracted World by Cal Newport - NotesPeak: Secrets from the New Science of Expertise by K. Anders Ericsson and Robert Pool -Emphasizes on "Deliberate practice modelled by following the best in the area". It provides a lot…

Notes from Deep Work by Cal Newport

My notes from reading "Deep Work by Cal Newport"Deep work is the ability to focus without distraction on a cognitively demanding task. It's a skill that allows you to quickly master complicated information and produce better results in less time. Shallow work is Non-cognitively demanding, logistical…

Writing In Markdown

Writing in Markdown format is great to be able to version control your documents. But Markdown may not be a easy when there is too much formatting involved. like, tables etc. Welcome Pandoc! With Pandoc, you can write your documents in Microsoft word and convert them into Markdown automatically. Ins…

Parallel Processing in Python

Parallel processing has been made easy with the multiprocessing library. Earlier we had to use a Thread and Queue implementation to get a ThreadPool functionality with multiple workers. This has been simplified in the multiprocessing library. It is not very well documented though, Using multiprocess…

Fetching site cookies via Go

Depicts the usage of cookiejar to retrieve cookies from a website. type MyClient struct { client http.Client //http client jar *cookiejar.Jar //jar } // init - initialises the http client func (s *MyClient) init() { s.jar, _ = cookiejar.New(nil) s.client = http.Client{Jar: s.jar} } /…

Upgrading Fedora

For self, sudo dnf upgrade --refresh sudo dnf install dnf-plugin-system-upgrade sudo dnf system-upgrade download --refresh --releasever=28 sudo dnf system-upgrade reboot…

Removing Duplicate Iptables Rules

Snippet for removing duplicate entries from iptables iptables-save > /tmp/iptables_backup.conf iptables-save | awk '!x[$0]++' > /tmp/iptables.conf iptables -F iptables-restore < /tmp/iptables.conf service iptables save service iptables restart…

Running Commands As Apache User

I have some django apps that run as apache user. And I frequently need to run some commands as an apache user from my regular user shell. The following function in ~/.bashrc is awesome for such use cases run_as_apache_user() { su -s "/bin/bash" -c "$1" apache } Usage: $ run_a…

Analyzing Stock Tradebook With R

Given a year worth of trades, the following R script detects the stocks that were not directly bought. They were either acquired as a part of a bonus, split or IPO. setwd("/Users/vvb/work/projects/trades") getwd() library(data.table) library(readxl) trades <- readxl::read_excel("tr…

A Day With R

Datatypes A vector is always homogenous A list can be heterogenous A matrix is a list of vectors A dataframe is a list of lists. stockprice <- 1900L class(stockprice) stocks <- c("HEG", "Graphite", "Bajaj", "L&T") prices <- c(1900L, 650L, 500L, 13…

Two Eggs Problem

Problem A building has 100 floors. One of the floors is the highest floor an egg can be dropped from without breaking. If an egg is dropped from above that floor, it will break. If it is dropped from that floor or below, it will be completely undamaged and you can drop the egg again. Given two eggs,…

setting custom alerts on any device using pushbullet

pushbullet.com lets you send API based notification/alerts. Start with creating a Pushbullet account. Install the app on your phone. Go to the pushbullet website, head to "My Account" and then create an access token. Note this token. The below python code can then be used to send a notific…

Using http with pip

Enforce using http with pip, pip install --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org <packageName>…

Reflection in go!

Printing struct attributes and values using reflection. package main import ( "fmt" "reflect" ) type User struct { FirstName string LastName string Age int } func (f *User) reflect() { v := reflect.ValueOf(f).Elem() for i := 0; i < v.NumField(); i++ { val := v.…

ansible modules for Cisco UCS IMC server

imc-ansible imc-ansible are a set of ansible modules for Cisco UCS standalone servers(IMC servers). installation # Install ansible sudo pip install ansible # install imcsdk from github git clone https://github.com/ciscoucs/imcsdk cd imcsdk sudo make install # install imc-ansible from github git clon…

Inventory Ucs Managed servers via ucsmsdk

ucsmsdk 0.9.3.0 will add support for inventory APIs. This allows for multi-host multi-component inventory in multiple formats(enough of multiple? :-D ). The inventory APIs support inventorying, - fabric interconnects - cpus - disks - dimms - storage controller - VIC - vNICs - vHBAs - PSUs The suppor…

debugging in an ansible environment

I was looking for a PDB sort of debugger for debugging custom ansible modules written in Python. This is when i bumped into this blog. As recommended on the blog, I tried out epdb and it works great for debugging custom ansible modules written in python. Installation: pip install epdb epdb: https://…

imcsdk storage APIs

0.9.2.0 release of imcsdk will add support for imcsdk.apis.server.storage to manage virtual drives. virtual_drive_create virtual_drive_delete Basic usage, vd = virtual_drive_create(handle=handle, drive_group=[[1]], controller_slot="MEZZ"…

Inventorying IMC servers via imcsdk

The 0.9.2.0 release of imcsdk will add support for inventory APIs. The following output formats are supported - JSON (default) HTML CSV Refer the API documentation for a list of components that can be inventoried. all fetches inventory for all components. Usage is shown below, from imcsdk.apis.serve…