Skip to content

Instantly share code, notes, and snippets.

View naranyala's full-sized avatar
🎯
F11 - back to the context

Fudzer M Huda naranyala

🎯
F11 - back to the context
View GitHub Profile
@naranyala
naranyala / polybar-module-net-usage.sh
Last active May 31, 2024 00:01
display daily internet usage in polybar
#!/bin/bash
# Get the network interface (e.g., eth0, wlan0)
INTERFACE=$(ip route | grep default | awk '{print $5}')
# Default values if files are not found
DEFAULT_RX_BYTES=0
DEFAULT_TX_BYTES=0
# Get the current bytes received and transmitted
@naranyala
naranyala / topten-cpu-usage-killprocess.sh
Created May 24, 2024 19:11
your cpu eater solution
#!/bin/bash
# Get the top ten processes consuming the most CPU
top_processes=$(ps -eo pid,comm,%cpu --sort=-%cpu | head -n 11 | tail -n 10)
# Format the process list for rofi
process_list=$(echo "$top_processes" | awk '{print $1 " " $2 " (" $3 "%)"}')
# Show the process list in rofi and get the user's choice
chosen=$(echo "$process_list" | rofi -dmenu -p "Kill Process:")
@naranyala
naranyala / topten-ram-usage-killprocess.sh
Created May 24, 2024 19:10
your ram eater solution
#!/bin/bash
# Get the top ten processes consuming the most memory
top_processes=$(ps -eo pid,comm,%mem --sort=-%mem | head -n 11 | tail -n 10)
# Format the process list for rofi
process_list=$(echo "$top_processes" | awk '{print $1 " " $2 " (" $3 "%)"}')
# Show the process list in rofi and get the user's choice
chosen=$(echo "$process_list" | rofi -dmenu -p "Kill Process:")
@naranyala
naranyala / polybar-module-switch-hlwm-window.sh
Created May 24, 2024 17:40
polybar module for herbstluftwm tags indicator
#!/bin/bash
# Get the list of tags (workspaces) with their states
tags=$(herbstclient tag_status)
# Primary Colors
clr_red="#FF0000"
clr_orange="#FFA500"
clr_yellow="#FFFF00"
clr_green="#008000"
@naranyala
naranyala / set-ungoogled-chromium-defaultbrowser.sh
Created May 24, 2024 08:43
install ungoogled-chromium in linux system
#!/bin/bash
###
# [0] download first
# https://ungoogled-software.github.io/ungoogled-chromium-binaries/
# [1] make it executable
# [2] move to system
# [3] set "https://search.brave.com/search?q=%s" as default search engine
###
@naranyala
naranyala / smart-polybar-net-speed.sh
Created May 22, 2024 09:17
"select" to switch net interface and "monitor" to watch your net speed
#!/bin/bash
# Temporary file to store the selected interface
INTERFACE_FILE="/tmp/selected_network_interface"
# Function to get available network interfaces
get_interfaces() {
ls /sys/class/net | grep -v lo
}
@naranyala
naranyala / polybar-rofi-volume-range.sh
Created May 21, 2024 10:25
easy select volume in range
#!/bin/bash
# Define the options for volume levels
options="0%\n5%\n10%\n15%\n20%\n25%\n30%\n35%\n40%\n45%\n50%\n55%\n60%\n65%\n70%\n75%\n80%\n85%\n90%\n95%\n100%"
# Use rofi to select a volume level
chosen=$(echo -e "$options" | rofi -dmenu -p "Set Volume Level")
# If the user made a selection, set the volume
if [ -n "$chosen" ]; then
@naranyala
naranyala / polybar-rofi-brightness-range.sh
Last active May 21, 2024 10:24
easy select brightness in range
#!/bin/bash
# Define the brightness levels as percentages
levels="0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70\n75\n80\n85\n90\n95\n100"
# Use rofi to select a brightness level
chosen=$(echo -e "$levels" | rofi -dmenu -p "Set Brightness Level")
# If the user made a selection, set the brightness and print the chosen level
if [ -n "$chosen" ]; then
@naranyala
naranyala / rofi-set-nightmode-inrange.sh
Created May 18, 2024 10:28
setup redshift in-range using rofi
#!/bin/bash
# Parses command-line arguments and executes the appropriate action
parse_args() {
case $1 in
-r | --reset)
reset_temperature
;;
-t | --temperature)
if [ -n "$2" ]; then
@naranyala
naranyala / rofi-set-brightness-inrange.sh
Created May 18, 2024 10:15
fix your brightness controls
#!/bin/bash
# Define the options for brightness levels
options="0%\n5%\n10%\n15%\n20%\n25%\n30%\n35%\n40%\n45%\n50%\n55%\n60%\n65%\n70%\n75%\n80%\n85%\n90%\n95%\n100%"
# Use rofi to select a brightness level
chosen=$(echo -e "$options" | rofi -dmenu -p "Set Brightness Level")
# If the user made a selection, set the brightness
if [ -n "$chosen" ]; then