Posts

Showing posts from October, 2023

damshote

damshote stands for dash msh note . It is a single dash script to manage plain text notes in a folder using neovim . Put this script in a folder that you want your plain text notes to reside, cd into the folder and run the script. #!/bin/dash # check if it is run as ROOT and exit. ROOID=$( id -u) if [ $((ROOID)) -eq 0 ]; then exit 0 fi # check if it is running in terminal. otherwise exit. case " $(ps -o stat= -p $$) " in *+*) clear; echo "\ndamshote continue..." ;; *) notify-send -t 2700 "clean exit" "please run it in terminal." ;; esac # check it is already running and exit. SCRIPTNAME= " $(basename -- " $0 " ) " if pidof -x " $SCRIPTNAME " -o $$ > /dev/null 2>&1; then echo "Oop! it is already running. clean exit" exit 0 fi HEREDIR= " $(dirname " $(readlink -f " $0 " ) " ) " NOTEDIR= "" $HEREDIR...

dashinet

This is a single dash script to manage WiFi Connections. It can connect to new WiFi and can manage known connections such as activating, deactivating, deleting, checking password of a ever connected (known) connection. Dash is required because the script is a single dash script and it needs nmcli command. It is blazing first. #!/bin/dash # test if it is running as ROOT and exit. if [ $(($(id -u))) -eq 0 ]; then exit 0 fi # test if it is running in terminal or exit. case " $(ps -o stat= -p $$) " in *+*) echo "continue..." ;; *) notify-send -t 2700 "clean exit" "please run it in terminal." ; exit 0 ;; esac # test if it is already running or exit. SCRIPTNAME= " $(basename -- $0) " if pidof -x " $SCRIPTNAME " -o $$ > /dev/null 2>&1; then echo "the script is already running. clean exit." exit 0 fi # test if nmcli command is available or exit if !...

Code Block in Blogger

Inserting code block in Blogger is basically to insert your code between HTML code tags. But it is very raw and without syntax highlighting. To get the code block with syntax highlighting and styling, you can use highlight.js . It is also on GitHub @ highlight.js GitHub . On the highlight.js GitHub pages, copy and paste on the top of post the snippet of HTML and replace respective library link with the links copied from chnjs.com/libraries/highlight.js as follow. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github-dark.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script> <script>hljs.highlightAll();</script> Then in HTML View of Blogger's composing post/page, insert your codes between <pre><code class="language- name > and </code></pre> and replace n...

Dash (Debian Almquist shell)

Dash (Debian Almquist shell) is a modern POSIX-compliant implementation of /bin/sh (sh, Bourne shell). Dash is not Bash compatible, but Bash tries to be mostly compatible with POSIX, and thus Dash. Dash is roughly 4 times faster than Bash in speed and very limited resources like space, RAM or CPU. As minimalistic as possible, much smaller than Bash comparing 134.1 KB vs 6.5 MB installed. Dash is a long-established, tiny project with simple and long-established functionality; one that is still very alive and with many active developers. Thus, Dash has a much smaller attack surface, while still having many eyes on its code. The following example dash script is to manage your plain text notes in a folder using neovim. It is a very straight and fucking fast single script. #!/bin/dash # check if it is run as ROOT and exit. ROOID=$(id -u) if [ $((ROOID)) -eq 0 ]; then notify-send "clean exit" "Oop! it was run as ROOT. please run it as NORMAL user again." ex...