Posts

shell loop through dates

 Easy command to loop through the dates :  for i in 2022-01-{01..31} 2022-02-{01..15}; do echo $i; done More comprehensive command : d=2015-01-01 while [ " $d " != 2015-02-20 ]; do echo $d d=$(date -I -d " $d + 1 day" ) done

tp-link archer t3u on ubuntu

Recently got tp-link T3u mini wifi adapter   but as usual ubuntu did not have its drivers. So executed following commands and it worked perfectly.  cd /opt   git clone https://github.com/cilynx/rtl88x2bu.git   cd rtl88x2bu VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf) sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER} sudo dkms add -m rtl88x2bu -v ${VER} sudo dkms build -m rtl88x2bu -v ${VER} sudo dkms install -m rtl88x2bu -v ${VER} sudo modprobe 88x2bu

sudo access to ldap user

 Typically, if you dont have sudo and "gain" sudo access, you cant just add yourself to sudo group. In that scenario, we need to reboot in "advanced mode" and gain access to root shell. Once in, you can have following :  $ sudo cat /etc/sudoers.d/hpatil  hpatil ALL=(ALL) ALL and then we will have sudo access. 

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 )