This repo contains small scripts I have written for various tasks, some still work, some are under development and some I have abandoned.
The summary of scripts are in following table, you can refer to specific section for full details.
Script Group | File name | language | Short description |
---|---|---|---|
Args Open | ./args-open.sh | Bash | Opens a command with given arguments. |
Autocomplete* | ./autocomplete.py | python | Autocomplete frequent phrases |
Battery Logs | ./battery.py | Python | Logs the battery percentage |
Battery Logs | ./plot_battery.gnuplot | Gnuplot | Plots the battery log and shows trend |
Battery Logs | ./plot_battery.py | Python | Plots the battery log |
Brightness | ./brightness.sh | Bash | Control the brightness of screen. |
Capture Clip | ./capture_clipboard.py | Python | Capture the contents of the clipboard. |
Conky | ./conky.sh | Bash | Conky start scripts and prerequisites |
Conky | ./daily_for_conky.sh | Bash | Scripts to run daily for conky. |
File Open | ./file-open.sh | Bash | Opens a file with a command. |
Latex-compile | ./latex-compile | bash | Compile the latex file given. |
./mail.py | Python | Checks for the emails and sends notification | |
Menu | ./menu.sh | Bash | dmenu based menu for scripts |
Microphone | ./microphone.sh | bash | Changes Mic volume and shows shows it |
Move Download | ./move-download | bash | Move recently downloaded files to PWD |
Notification | ./notification.sh | bash | Notification rules for dunst |
OCR screen | ./ocr-screen.sh | bash | Run tesserace OCR on selected rectangle |
Pdf Images* | ./pdf_extract_images.py | Python | Extract images from pdfs. |
Radio | ./radio.sh | Bash | Plays chosen radio from the given list. |
Rename All | ./rename-all.py | Python | Renames all the files to snake case. |
Save Screenshot | ./save-screenshot | Bash | Saves the screenshot from clip to file. |
Searchable PDFs | ./make-pdf-searchable.sh | Bash | Make image pdfs searchable. |
Speak | ./speak.sh | bash | TTS whatever is typed after command. |
Timer | ./timer.py | Python | Timer |
Volume | ./volume.sh | bash | Changes Speaker volume and shows it |
Word Count | ./word-count.sh | bash | Count the number of lines/words/chars |
Youtube | ./myyt.sh | Bash | Searches and plays videos from YouTube. |
Note: * denotes the script is either incomplete or there is better alternative.
Abandoned project
Basically saves a json of phrases you use frequently and then you can use them.
I’m planning to update this one using Dmenu, with two script options
- Add new phrase
- Insert phrase
I’ll probably rewrite it on bash if I do it again.
Logs the % of battery you give to it in a file. There is plot_battery.{gnuplot,py} scripts to visualize the logged data.
Script to run the scripts I have on conky directory, as well as to run the necessary scripts before the conky one.
The file daily_for_conky.sh
is to put into the crontab.
It uses dmenu to open a file, It’s basically same as using dmenu to open a program, but the second option will be like a file browser so you can pass that filename as an argument to the program.
It checks the email, sees if there is changes from the saved previous mails. And sends notification if there is a new one. It also prints the text in a colored format for conky.
It’s a simple script which saves the screenshot/image on the
clipboard to a file. You can give a filename, or just let it save as
screenshot.png
which replaces the old one.
I use this line of command (import png:- | xclip -selection c -t
image/png
binded to PrtSc
key) to take screenshots and keep it in
the clipboard. I can just paste the screenshot into places that
takes image input, instead of saving it always, so when I do want to
save it, I use this script.
Simple timer to time events continuously. Like Lap time thing.
It renames all the files into given path a snake case format. Ignores the hidden files.
Plays chosen radio from the list.
This script can search and play videos from youtube, it uses your google API and the youtube-dl program. I forgot where exactly I got it from but it should be from somewhere in reddit.
This script uses the tesseract OCR tool to convert a pdf into a searchable pdf. It converts the pdf to images and runs OCR on them then joins all the output from the OCR.
This script captures the clipboard continuously and prints the contents on the stdout.This is useful when you want to collect a bunch of things like the links to various youtube videos from search address, or copy a buuch of lines or paragraphs in to a same place.
This is to simply change the brightness because the default driver was not working for me for some reasons.
You can use -inc val
or -dec val
or -set val
to increase,
decrease or set the brightness to/by certain percentage.
This is just a dmenu based menu to run scripts, the scripts could be ones from here or any other program with specific command/arguments.
For example, this is my menu.json
file that is used by menu.sh
script. I have to make it show the tooltips someway inn future.
{
"bgcolor": "black",
"scripts": {
"c2-picture": {
"name": "c2 picture",
"script": "feh /home/gaurav/Pictures/cc.jpg",
"tooltip": "c2 background incase I need black blackground for transparent windows"
},
"radio-online": {
"name": "Online Radio",
"script": "/home/gaurav/scripts/radio.sh",
"tooltip": "Play different radios online, from the list on file."
},
"file-open": {
"name": "Open Files",
"script": "/home/gaurav/scripts/file-open.sh",
"tooltip": "open the program with command line arguments while opening."
},
"ddg-search": {
"name": "Search word in DuckDuckGo",
"script": "firefox --new-tab \"duckduckgo.com/$(xclip -o)\"",
"tooltip": "Searches the highlighed word in duckduckgo."
}
}
}
It extracts the images from pdf files, it can recursively look through the pdf files in the path.
Recently Found out poppler-tools
has pdfimages
which does it for us, so no need to use it.
Compile latex files.
Few flags and arguments are added for ease of operation.
Here is the help output for the script.
Usage: latex-compile [-a|--auto] [-s|--supress] [-d|--debug] [-w|--watch <files>] [-r|--recipe <recipe>] [-c|--commands <args>] [-h|--help] [<files>] Options: [-a|--auto] Automatically compile latex each time file is modified. [-s|--supress] Supress as much output as possible. [-d|--debug] Debug mode; print variables and exit. [-w|--watch] <files> Add more files to watch list which trigger auto compile. [-r|--recipe] <recipe> Recipe to use for compilation [-c|--commands] <args> Arguments to pass to latex compile program. [-h|--help] Display this and exit. [<files>] Files to compile, defaults to all .tex in PWD.
Most helpful, and the reason I wrote this is the -a|--auto
flag which means the latex will be recompiled whenever I change something and save the tex file. Along with auto refreshing in the viewer we can set a automatic compile and see setup.
i3status config to get the output.
read_file volume{ path = "/tmp/volume" format = "Spk: %content" format_bad = "Spk: MUTE" } read_file mic{ path = "/tmp/mic" format = "Mic: %content" format_bad = "Mic: MUTE" }
And this is how I have keybindings in my i3 config file, you can make similar things.
# Use pactl to adjust volume in PulseAudio. set $refresh_i3status killall -SIGUSR1 i3status bindsym XF86AudioRaiseVolume exec --no-startup-id ~/scripts/volume.sh -inc 5 && $refresh_i3status bindsym XF86AudioLowerVolume exec --no-startup-id ~/scripts/volume.sh -dec 5 && $refresh_i3status bindsym XF86AudioMute exec --no-startup-id ~/scripts/volume.sh -toggle && $refresh_i3status bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status bindsym XF86MonBrightnessUp exec --no-startup-id ~/scripts/brightness.sh -inc 5 bindsym XF86MonBrightnessDown exec --no-startup-id ~/scripts/brightness.sh -dec 5 bindsym $mod+XF86AudioRaiseVolume exec --no-startup-id ~/scripts/microphone.sh -inc 5 && $refresh_i3status bindsym $mod+XF86AudioLowerVolume exec --no-startup-id ~/scripts/microphone.sh -dec 5 && $refresh_i3status bindsym $mod+XF86AudioMute exec --no-startup-id ~/scripts/microphone.sh -toggle && $refresh_i3status # to set up and make the files exec --no-startup-id ~/scripts/microphone.sh -echo exec --no-startup-id ~/scripts/volume.sh -echo # bindsym XF86MonBrightnessUp exec --no-startup-id # bindsym XF86MonBrightnessDown exec --no-startup-id
This script plays notification sounds for notifications form dunst.
put this in the dunstrc file. (NOTE: ~~/scripts/notification.sh~ is the path to this script.)
[notification_sound] summary = "*" script = ~/scripts/notification.sh