commit 7e3b6a296cccd530984ac9ad96f047041cc59a60
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 8 Nov 2025 13:18:41 +0530
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 8 Nov 2025 13:18:41 +0530
Add sh and basic scripts from dump
18 files changed, 155 insertions(+), 0 deletions(-)
diff --git a/blog-permalink.sh b/blog-permalink.sh @@ -0,0 +1,12 @@ + +dirname=$(date "+%d%m%Y") + +mkdir -p "${dirname}" + +touch "${dirname}/$(shasum ${BLOG_INPUT_FILE}" | cut -d' ' -f1)" + +case $1 in + publish) echo "Push to git, git commit -m $(uname -a)" ;; + "") echo "Dfault action" ;; + *) echo "Unknown" ;; +esac
diff --git a/dump-colors.sh b/dump-colors.sh @@ -0,0 +1,4 @@ +for i in {0..255}; do + printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n" +done +
diff --git a/ffmpeg/split_videos_into_two.bash b/ffmpeg/split_videos_into_two.bash @@ -0,0 +1,18 @@ +#TODO finish this script, can be useful later +#!/usr/bin/env bash +input=$1 +output_prefix=$2 + +if [ -z "${input}" ]; then + echo "Input is invalid" + exit +fi + +if [ -z "${output_prefix}" ]; then + echo "output_prefix is not given, choosing default value, ${input}-" +fi + + +total_duration=$(~/converted $ exiftool check_once_and_upload/sai\ baba\ 60th\ birthday\ celebration.m4v | grep "Media Duration" | cut -d : -f 2-4 | xargs) + +ffmpeg -i converted/check_once_and_upload/sai\ baba\ 60th\ birthday\ celebration.m4v -vcodec copy -acodec copy -ss 00:00:00 -t 00:30:00 output-part1.m4v -vcodec copy -acodec copy -ss 00:30:00 -t 01:00:00 output-part2.m4v -vcodec copy -acodec copy -ss 01:00:00 -t 1:24:04 output-part3.m4v
diff --git a/getperms.vbs b/getperms.vbs @@ -0,0 +1,41 @@ +' GrantFullControlToUsers.vbs +Option Explicit + +' File to modify permissions for +Const TARGET_FILE = "C:/Program Files/SKGA Automation/PendingAutomation.ods" + +' Constants for security permissions +Const ADS_RIGHT_GENERIC_ALL = &H10000000 ' Full Control +Const ADS_ACETYPE_ACCESS_ALLOWED = 0 +Const ADS_ACEFLAG_INHERIT_ACE = &H2 +Const ADS_FLAG_OBJECT_TYPE_PRESENT = &H1 + +' Get the file's security descriptor +Dim objSD, objDACL, objACE, objSecurity, objUser +Set objSecurity = CreateObject("ADsSecurityUtility") +Set objSD = objSecurity.GetSecurityDescriptor("file:///" & TARGET_FILE) + +If objSD Is Nothing Then + WScript.Echo "Error: Could not access file security descriptor." + WScript.Quit 1 +End If + +' Get the Discretionary ACL (DACL) +Set objDACL = objSD.DiscretionaryAcl + +' Create an Access Control Entry (ACE) for "Users" +Set objUser = GetObject("WinNT://./Users,group") +Set objACE = CreateObject("AccessControlEntry") +objACE.Trustee = objUser.ADsPath +objACE.AccessMask = ADS_RIGHT_GENERIC_ALL +objACE.AceType = ADS_ACETYPE_ACCESS_ALLOWED +objACE.AceFlags = ADS_ACEFLAG_INHERIT_ACE + +' Add the ACE to the DACL +objDACL.AddAce objACE + +' Apply the modified DACL back to the file +objSD.DiscretionaryAcl = objDACL +objSecurity.SetSecurityDescriptor objSD + +WScript.Echo "Successfully granted Full Control to 'Users' for: " & TARGET_FILE
diff --git a/gpg/decrypt-all-keys.sh b/gpg/decrypt-all-keys.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +name=`find . -name '*.gpg'` +for i in ${name[@]}; do + output_file=$(echo "$i" | sed 's/.gpg//g') + echo $output_file + gpg -d $i > $output_file +done
diff --git a/gpg/remove-all-keys.sh b/gpg/remove-all-keys.sh @@ -0,0 +1 @@ +find . -name '*.gpg' -exec rm {} \;
diff --git a/gradle.sh b/gradle.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +
diff --git a/man2readme.sh b/man2readme.sh @@ -0,0 +1 @@ +cat nb.1 | groff -mandoc -T ascii > README
diff --git a/photos/optimize.sh b/photos/optimize.sh @@ -0,0 +1 @@ +optipng image-file.png
diff --git a/photos/reduce-size.sh b/photos/reduce-size.sh @@ -0,0 +1 @@ +jpegoptim -m90 file.jpg
diff --git a/photos/when.sh b/photos/when.sh @@ -0,0 +1,13 @@ +# Prints out when a file was created using exiftool +when () +{ + for i in *; + do + echo -n "$i"; + exiftool "$i" | grep "Create Date" | head -n 1 + echo "" + done +} + +# Usage +# when | sed '/^$/d'
diff --git a/profile-pic.sh b/profile-pic.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Generate the white background +convert -size 256x256 xc:white white.png + +# Add '~' in the centre +convert white.png -gravity Center -pointsize 90 -annotate 0 "~" white1.png
diff --git a/qrgen.sh b/qrgen.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +dir='./qr_out' +if [ -e $dir ]; then + #FIXME grammatical errors + echo -e "The directory $dir already exist, do you want to overwrite?[y/N]\c" + read desc + if [ $desc = 'y' ]; then + #FIXME alternative descision checking is recommended + rm -rf $dir + mkdir $dir + fi +else mkdir $dir +fi + + +#TODO query items in block to reduce load +#query items from db +items=`sqlite3 prod.db "select id from prod"` +for i in $items; do + #FIXME change accordingly, use 'qrencode --help' for more info + qrencode -o $dir/$i\.png $i +done
diff --git a/repo/rm-git.sh b/repo/rm-git.sh @@ -0,0 +1 @@ +for i in *; do [ -d "$i"/.git ] && zip -r "$i"/git.zip "$i"/.git && rm -rf "$i"/.git; done
diff --git a/repo/rm-submodules.sh b/repo/rm-submodules.sh @@ -0,0 +1 @@ +for i in *; do [ -d "$i"/.git ] && git rm --cached "$i"; done
diff --git a/tts-repeat.sh b/tts-repeat.sh @@ -0,0 +1 @@ +for i in Alex Victoria Fred; do say -v $i -The message- -o $i; done.md
diff --git a/wifi-connect.sh b/wifi-connect.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +WIFI_SSID=Home +WIFI_PASS=Home + +# linux +if iwctl wlan0 connect "${WIFI_SSID}" "${WIFI_PASS}"; then + exit 0 +fi + +# mac +if networksetup -setairportnetwork en0 "${WIFI_SSID}" "${WIFI_PASS}"; then + exit 0 +fi +# win +if netsh wlan connect "${WIFI_SSID}" "${WIFI_PASS}"; then + exit 0 +fi
diff --git a/xdg-setup.sh b/xdg-setup.sh @@ -0,0 +1 @@ +mkdir .local/share/newsboat
: bharatvaj/scripts