using cat with grep – why?
Lot of times, I just want to copy the git url to clipboard. This is so common in my flow of work that I created an alias for it. Here it is:
alias git-url="cat .git/config|awk '/url/ {print $3}'|xclip -i -selection clipboard"
Here is the script. Very simple yet very useful script.
#!/bin/bash -
#===============================================================================
#
# FILE: kitty-theme.sh
#
# USAGE: ./kitty-theme.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Amit Agarwal (aka),
# ORGANIZATION: Individual
# CREATED: 12/06/2019 10:15
# Last modified: Fri Dec 06, 2019 10:41AM
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
FOLDER="/git/terminal.sexy/dist/schemes" ### This is git folder where you have terminal.sexy cloned
if [[ ! -d $FOLDER ]]
then
cd $FOLDER/../../../
git clone https://github.com/stayradiated/terminal.sexy
fi
cd $FOLDER
tmp=$(mktemp /tmp/color-XXXXXXXX)
echo $tmp
files=$(find . -type f -name \*json)
for line in $(echo ${files[*]})
do
echo "Processing $line"
>$tmp
echo "# From $line.. processed by Amit Agarwal script" >> $tmp
sed -n -e '/color/,/\],/ p' $line | sed -e 1d -e '$d'| \
sed 's/[",]//g'|awk '{count++; print "color"count"\t "$1}' >> $tmp
grep ground $line |sed 's/^ *//' |sed 's/[":,]//g' >> $tmp
kitty @ set-colors -a $tmp
ls --color=auto ~
read -p "If you like the theme, just press l ::" test
if [[ $test == "l" ]]
then
rm -f ~/.config/kitty/theme.conf
cp $tmp ~/.config/kitty/theme.conf
fi
done
rm -f $tmp
Here is a simple script that can show you the hotkeys bound in ~/.config/i3/config :
#!/bin/bash -
#===============================================================================
#
# FILE: i3-showkeys.sh
#
# USAGE: ./i3-showkeys.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# 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
do
printf "%20s\t?\t%s\n" "$key" "$line" >> /tmp/keys
done
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:
Continue readingHere is a quick command to show menu (applications) in simplistic windows managers with icons.
rofi -modi drun -show drun -show-icons
Here is the youtbe video that will walk you through bash script.
Lot of times, you have to ssh to a server with bastion host. If you dont know what is bastion host then see this:
Now, in such cases, either you add an entry in “~/.ssh/config