i3 – show mapped hotkeys

Here is a simple script that can show you the hotkeys bound in ~/.config/i3/config :


#!/bin/bash - 
#          FILE:
#         USAGE: ./ 
#       OPTIONS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka)
#  ORGANIZATION: Individual
#       CREATED: 11/26/2019 14:22
# Last modified: Tue Nov 26, 2019  02:43PM
#      REVISION:  ---

set -o nounset                              # Treat unset variables as an error

> /tmp/keys
cd ~/.config/i3
grep '^bindsym $mod' config|grep -v '^#'|grep -v 'move container to'|grep -v 'workspace $ws'|sed 's/bindsym //'|grep -v '='|while read key line
    printf "%20s\t?\t%s\n" "$key" "$line"  >> /tmp/keys

xterm -e "cat /tmp/keys; read -p 'press any key to continue'"
rm -f /tmp/keys

And once this is done, you can bind the script in i3 config like this:


bindsym $mod+Shift+h exec ~/bin/

Restart i3. And then you can press “Mod key + Shift + h” at any time to see all the bindings in your config.


scan your network with bash IP scan script

Here is the youtbe video that will walk you through bash script.



Add files to dropbox with single curl command

I have been thinking of posting this for sometime now. This is very useful, when you are working on a different Linux box and want to upload a file to dropbox.


So, before you run this command, you need to create your auth token in Dropbox developer API page. Once that is done, need to change the 2 parameters in command below. Export your Access token and run the below command.

Here is the command:

tar cvzf /tmp/backup.tgz <folder of your choice>
curl -X POST \
    --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" \
    --header "Dropbox-API-Arg: {\"path\": \"/<dropbox path>/$(hostname -s)/$NOW.tgz\"}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary @/tmp/backup.tgz