init home-manger (clean old)

This commit is contained in:
2026-09-20 03:37:13 +05:00
parent 8b24c9f318
commit 5b8b371e4d
92 changed files with 99 additions and 1159 deletions
-4
View File
@@ -1,4 +0,0 @@
#!/bin/bash
pacmd load-module module-null-sink sink_name=$1 sink_properties=device.description=$1
pacmd set-default-sink $1
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
echo Status: $(cat /sys/class/power_supply/BAT0/status)
echo Capacity: $(cat /sys/class/power_supply/BAT0/capacity) %
cat << EOF
Health: $(cat /sys/class/power_supply/BAT0/capacity_level)
EOF
-48
View File
@@ -1,48 +0,0 @@
#!/bin/bash
# Usage check
if [ $# -ne 1 ]; then
echo "Usage: $0 <URL>"
exit 1
fi
# Extract the protocol, hostname, port, and path from the URL
url=$1
protocol="${url%%://*}"
host_port="${url#*://}"
host="${host_port%%/*}"
path="/${host_port#*/}"
port=80
# Check if the protocol is HTTP
if [ "$protocol" != "http" ]; then
echo "Only HTTP protocol is supported."
exit 1
fi
# Check if a port is specified
if [[ $host == *:* ]]; then
IFS=':' read -ra ADDR <<< "$host"
host=${ADDR[0]}
port=${ADDR[1]}
fi
# Open connection to the host
exec 3<>/dev/tcp/$host/$port
# Send HTTP GET request
echo -e "GET $path HTTP/1.1\r\nHost: $host\r\nConnection: close\r\n\r\n" >&3
# Read the response and output the file content
{
# Skip HTTP headers
while IFS= read -r line; do
[[ $line == $'\r' ]] && break
done
# Output the body (file content)
cat >&1
} <&3
# Close the connection
exec 3<&-
-27
View File
@@ -1,27 +0,0 @@
#!/bin/bash
# Ensure the directory for failed fingerprint images exists
mkdir -p ~/pictures/failed_finger
# Lock the screen with all passed arguments
i3lock "$@" &
while true; do
# Run the fingerprint verification and redirect output to /dev/null
fprintd-verify &> /dev/null
# Capture the exit code
exit_code=$?
# Check the exit code
if [ $exit_code -eq 0 ]; then
pkill i3lock
exit 0
elif [ $exit_code -eq 1 ]; then
timestamp=$(date "+%Y%m%d_%H%M%S")
timestamp_human=$(date -d "${timestamp:0:8} ${timestamp:9:2}:${timestamp:11:2}:${timestamp:13:2}" "+%Y-%h-%d %H:%M:%S")
ffmpeg -f video4linux2 -s 1280x720 -i /dev/video0 -frames:v 1 ~/pictures/failed_finger/$timestamp.png
kdeconnect-cli --device $(kdeconnect-cli -a --id-only) --ping-msg "Failed to unlock at $timestamp_human"
fi
done
-2
View File
@@ -1,2 +0,0 @@
#!/bin/bash
/usr/bin/i3lock -c 000000
-72
View File
@@ -1,72 +0,0 @@
#!/bin/bash
# Check if an interface name is provided
if [ -z "$1" ]; then
echo "Usage: $0 <network-interface>"
exit 1
fi
INTERFACE=$1
# Get the IP subnet for the provided network interface
IP_SUBNET=$(ip route show dev "$INTERFACE" | grep -v default | awk '{print $1}')
# Check if the IP information was found
if [ -z "$IP_SUBNET" ]; then
echo "No IP address found for interface $INTERFACE."
exit 1
fi
# Scan the subnet using nmap, running as root
echo "Scanning the subnet $IP_SUBNET..."
OUTPUT=$(sudo nmap -sP "$IP_SUBNET")
# Parse the nmap output and present it in a table
#echo "$OUTPUT" | awk '/Nmap scan report for/{
# if ($5 ~ /^\(/) { ip=$5; name="Unknown"; }
# else if ($6 ~ /^\(/) { name=$5; ip=$6; }
# else { name="Unknown"; ip=$5; }
#
# ip=gensub(/\(|\)/, "", "g", ip); # Remove parentheses from IP
#
# getline; getline; mac=$3; brand="";
#
# # Capture the entire remainder as brand, remove parentheses
# for (i=4; i<=NF; i++) brand = brand $i " ";
# brand=gensub(/^\(|\)$/, "", "g", brand); # Clean brand formatting
# print name, ip, mac, brand
#}' | column -t -s ' ' -o ' | ' | awk 'BEGIN {print "Name | IP Address | MAC Address | Brand\n-----------------------------------------------------------------"} {print}'
# Parse the nmap output and present it in a table
echo "$OUTPUT" | awk '/Nmap scan report for/{
if ($5 ~ /^\(/) { ip=$5; name="Unknown"; }
else if ($6 ~ /^\(/) { name=$5; ip=$6; }
else { name="Unknown"; ip=$5; }
ip=gensub(/\(|\)/, "", "g", ip); # Remove parentheses from IP
getline; getline; mac=$3; brand=$4; # Skip status line and move to MAC and Brand
gsub(/\(|\)/, "", brand); # Clean brand formatting
print name, ip, mac, brand
}' | column -t -s ' ' -o ' | ' | awk 'BEGIN {print "Name | IP Address | MAC Address | Brand\n-----------------------------------------------------------------"} {print}'
## Parse the nmap output and present it in a table
#echo "$OUTPUT" | awk '/Nmap scan report for/{
# if ($5 ~ /^\(/) { ip=$5; name="Unknown"; }
# else if ($6 ~ /^\(/) { name=$5; ip=$6; }
# else { name="Unknown"; ip=$5; }
#
# ip=gensub(/\(|\)/, "", "g", ip); # Remove parentheses from IP
#
# getline; getline; mac=$3; brand="";
#
# # Capture the entire remainder as brand
# if ($(NF-1) ~ /^\(/) { # Check if the second last field starts with (
# for (i=4; i<=NF; i++) brand = brand $i " ";
# sub(/\s+$/, "", brand); # Trim trailing space
# brand=gensub(/\((.*)\)/, "\\1", "g", brand); # Remove outer parentheses
# }
# print name, ip, mac, brand
#}' | column -t -s ' ' -o ' | ' | awk 'BEGIN {print "Name | IP Address | MAC Address | Brand\n--------------------------------------------------------------------------------"} {print}'
-22
View File
@@ -1,22 +0,0 @@
#!/bin/bash
doas tail -fn0 /var/log/audit/audit.log | while read -r line; do
key=$(echo "$line" | grep -oP '(?<=key=").*?(?=")')
exe=$(echo "$line" | grep -oP '(?<=exe=").*?(?=")')
pid=$(echo "$line" | awk -F'ppid=[0-9]+ pid=' '{print $2}' | awk -F' ' '{print $1}')
username=$(echo "$line" | grep -oP '(?<=EUID=").+?(?=")')
if [ "$key" = "ssh-key-read" ]
then
SUBJECT="SSH Key accessed!"
MESSAGE="exec=$exe\nuser=$username\npid=$pid"
if [ "$exe" = "/usr/bin/scp" ] || [ "$exe" = "/usr/bin/ssh" ]
then
notify-send "$SUBJECT" "$MESSAGE"
else
notify-send -u critical "$SUBJECT" "$MESSAGE"
fi
fi
done
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
xrandr --output eDP-1 --mode 1920x1080 --pos 0x360 --rotate normal --output HDMI-1 --off --output DP-1 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-2 --off
-3
View File
@@ -1,3 +0,0 @@
#!/bin/bash
xdg-open "$1"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

-23
View File
@@ -1,23 +0,0 @@
#!/bin/bash
# Check if two arguments are provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <hostname or ip> <port-range>"
exit 1
fi
hostname=$1
port_range=$2
# Split the port range into start and end
IFS='-' read -ra PORTS <<< "$port_range"
start_port=${PORTS[0]}
end_port=${PORTS[1]}
# Iterate over the port range
for ((port=start_port; port<=end_port; port++))
do
(echo > /dev/tcp/$hostname/$port) &>/dev/null && echo "Port $port open"
done
exit 0
-13
View File
@@ -1,13 +0,0 @@
#!/bin/bash
while true; do
if [ -L /dev/android_adb ]
then
# scrcpy --no-audio --turn-screen-off --stay-awake & sndcpy
scrcpy --turn-screen-off --stay-awake
else
adb wait-for-device
fi
done
-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
if [ "$1" = "-e" ]; then
shift # Remove the first argument (-e) from the argument list
command_args="$*"
/sbin/xfce4-terminal -e "$command_args"
elif [ -z "$1" ]; then
/sbin/xfce4-terminal
fi
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
WALLDIR=$HOME/Pictures/Wallpapers
FILE=$(ls -l $WALLDIR | tail -n +2 | sort -R | head -1 | awk '{print $9}')
echo Setting Wallaper: $FILE
feh --no-fehbg --bg-scale $WALLDIR/$FILE
#ln -s $WALLDIR/$FILE ~/.config/wallpaper
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
LAYOUT_OLD=$(setxkbmap -query | grep layout | cut -d ':' -f 2)
LAYOUT_NEW=$(grep -A 1 $LAYOUT_OLD $HOME/.config/keyboard_layout | tail -n1)
if [ "$LAYOUT_NEW" = "END" ]
then
LAYOUT_NEW=$(head -n1 $HOME/.config/keyboard_layout)
fi
setxkbmap $LAYOUT_NEW
notify-send "New Layout $LAYOUT_NEW set"
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
SOCKET_ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)
# Start socat in the background
socat UNIX-LISTEN:/tmp/xdg-open$SOCKET_ID.socket,fork EXEC:"xargs -n 1 xdg-open" &
# Run the Podman container
podman run --rm \
--name 64gram \
--hostname 64gram \
-e DISPLAY \
--device /dev/snd:/dev/snd \
--device /dev/video0:/dev/video0 \
-v $HOME/.local/share/64Gram:/root/.local/share/64Gram \
-v $HOME/Downloads:/root/Downloads \
-v $HOME/Pictures:/root/Pictures \
-v $HOME/Documents:/root/Documents \
-v /etc/localtime:/etc/localtime \
-v /usr/share/icons:/usr/share/icons \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /tmp/xdg-open$SOCKET_ID.socket:/tmp/xdg-open.socket \
git.shihaam.dev/dockerfiles/64gram
# Wait for all background processes to finish
wait
-55
View File
@@ -1,55 +0,0 @@
#!/bin/bash
if [[ $XDG_SESSION_TYPE != "x11" ]]; then
echo "Unsupported session type: $XDG_SESSION_TYPE"
exit 1
fi
get_tg_window_id(){
tg_window_id=$(wmctrl -lx | grep telegram-desktop | awk '{print $1}')
}
get_mouse_location(){
mouse_xy=$(xdotool getmouselocation --shell)
mouse_x=$(printf "%s\n" "$mouse_xy" | grep X= | cut -d= -f2)
mouse_y=$(printf "%s\n" "$mouse_xy" | grep Y= | cut -d= -f2)
}
return_mouse(){
xdotool mousemove $mouse_x $mouse_y
}
lock_tg(){
xdotool windowactivate --sync $tg_window_id key ctrl+l
}
read_passcode(){
if [[ ! -f $HOME/.local/.tgpasscode ]]; then
echo "Passcode file not found!, Enter Telegram local passcode seperated characters by space."
echo "Example: If passcode is 1234, then enter 1 2 3 4 "
read -p "Enter passcode: " PASSCODE
echo $PASSCODE > $HOME/.local/.tgpasscode
echo Telegram Passcode saved at: $HOME/.local/.tgpasscode
fi
tgpasscode=$(cat $HOME/.local/.tgpasscode)
}
unlock_tg(){
xdotool windowactivate --sync $tg_window_id key $tgpasscode Return
}
if [ "$1" == "lock" ]; then
get_tg_window_id
get_mouse_location
lock_tg
return_mouse
elif [ "$1" == "unlock" ]; then
read_passcode
get_tg_window_id
get_mouse_location
unlock_tg
return_mouse
else
echo "Invalid argument. Please use 'lock' or 'unlock'."
exit 1
fi
-19
View File
@@ -1,19 +0,0 @@
la2110 ~/.scripts ❯ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ DELL0959:00 06CB:CDD5 Mouse id=9 [slave pointer (2)]
⎜ ↳ DELL0959:00 06CB:CDD5 Touchpad id=10 [slave pointer (2)]
⎜ ↳ PS/2 Generic Mouse id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Video Bus id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ Integrated_Webcam_HD: Integrate id=8 [slave keyboard (3)]
↳ Intel HID events id=11 [slave keyboard (3)]
↳ Intel HID 5 button array id=12 [slave keyboard (3)]
↳ Dell WMI hotkeys id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
xinput set-prop 10 "Device Enabled" 1