Posts

Bootable USB

In case your laptop has good old booting system and not advanced system like UEFI, you can use following command to create bootable USB. In case your laptop is fancy, you will have to use software like Rufus which works only on "amazing" windows. sudo dd bs=4M if=~/Downloads/ of=/dev/sdc1 status=progress oflag=sync you can find out /dev/sdc1 via df command.

Highlight mouse with win + F5

When you have multiple monitors, and we need to search for a mouse, it becomes difficult to see where its hiding. Windows had a good feature to highlight mouse when you press Ctrl, but linux typically dont have that. So I used following workaround to achieve same effect in i3. sudo apt install libx11-dev libxcomposite-dev libxdamage-dev libxrender-dev mkdir ~/git cd git git clone https://github.com/Carpetsmoker/find-cursor.git cd find-cursor make echo "bindsym $mod+F5 exec /home/maahi/git/find-cursor/find-cursor -of" >> ~/.config/i3/config

docker commands

A while ago, I was playing around with docker. Here is the collection of all the commands I used. I used following to install dockers: sudo echo 'deb https://apt.dockerproject.org/repo debian-stretch main' > /etc/apt/sources.list.d/dockertemp.list sudo apt-get update sudo apt-get install docker-engine sudo rm /etc/apt/sources.list.d/dockertemp.list sudo service docker start  Once installation was done, these were basic commands I used : https://sakuli.readthedocs.io/en/v1.0.0/docker-containers/ sudo docker pull harsshal/tws:first sudo docker run -it -p 5901:5901 -p 8000:6901 harsshal/tws:first sudo docker run -it -p 5901:5901 -p 8000:6901 -exec -u 0 harsshal/tws:first /bin/bash sudo docker run -it -p 5901:5901 -p 8000:6901 -e "VNC_PW=ibtrader" harsshal/tws:first sudo docker ps -a sudo docker start sudo docker commit harsshal/tws:second sudo docker push harsshal/tws:second sudo docker images sudo docker ps -a | awk '{print $1}' | xargs sudo docker r...

Display all dataframe lines in ipython / jupyter notebook

Sometimes when you want to see all lines in ipython, either in IDE or in notebook, it wont show you because of in-build options. Here are those options, in case you want to change that : import pandas as pd pd . set_option ( 'display.max_rows' , None ) pd . set_option ( 'display.max_columns' , None ) pd . set_option ( 'display.width' , 1000 )

Vertica creating a temporary list of numbers

I just wanted to quickly check what is the behavior of NULL in analytics functions like median. So rather than creating a table, I  wanted to pass a list of numbers and see what happens. This is how I achieved it : SELECT median(val) over() FROM ( SELECT * from (SELECT 1 as val, 1 as row UNION SELECT 2, 2 UNION SELECT NULL,3 UNION SELECT NULL,4 UNION SELECT 4,5)temp )temp2;

i3 layout reload configuration

Recently started playing around with i3. I liked it so far. It can open all the applications where you need after a restart. After learning how to split the screens etc, get to your desired configuration. Once fixed, execute following :  i3-save-tree > i3.json We need to edit json file so that "class" entries in "swallows" sections are un-commented. Enter following in config "~/.config/i3/config" : exec load_i3_layout.sh Where as contents of the shell scripts are : i3-msg 'workspace 1; append_layout i3.json' i3-msg 'exec /usr/bin/chromium-browser' i3-msg 'exec /usr/bin/dbeaver' i3-msg 'exec /snap/bin/pycharm-community' i3-msg 'exec /usr/bin/nautilus' i3-msg 'exec /usr/bin/gnome-terminal' i3-msg 'exec /usr/bin/chromium-browser' This will open up all the windows at your needed locations.

awk delimiters

I have been using awk for a while and I had a use case where I wanted to use multiple delimiter, ' ' being one of them. If its just space, we can use : awk -F' ' '{print $2}' If its bunch of characters, we can use : awk -F'[.:]' '{print $2}'  But with space, we need to use as follows : awk -F'[[:space:].]+' '{print $2}' I have not been able to figure out to associate '+' only to space. But for now this will server the purpose as long as I can combine multiple '.' Some other classes are: [[:blank:][:cntrl:]]  [ \t,:;]