Skip to content

Instantly share code, notes, and snippets.

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

FMH (@gema_naranyala) naranyala

🎯
F11 - back to the context
View GitHub Profile
#!/bin/bash
# Get the application directory from the command line argument
APP_DIR="$1"
# Set installation path
INSTALL_DIR="/opt" # Standard directory for optional apps
BIN_PATH="/usr/local/bin" # Path where we symlink the executable
# Check if APP_DIR was provided
#!/bin/bash
# Check if the AppImage file path is provided
if [ -z "$1" ]; then
echo "Error: Please provide the path to the AppImage file as the first argument."
exit 1
fi
# Path to the AppImage file
appimage_path="$1"
@naranyala
naranyala / sizeof.sh
Created September 9, 2024 03:59
intuitive command to show file or directory size
#!/bin/bash
# Check if an argument (file or directory) is provided
if [ -z "$1" ]; then
echo "Usage: sizeof <file_or_directory>"
exit 1
fi
# Use du to calculate size in bytes, then dynamically adjust for KB, MB, GB, etc.
size_in_bytes=$(du -sb "$1" | cut -f1)
#!/bin/bash
# Update package list
echo "Updating package list..."
sudo apt update
# Install PHP
echo "Installing PHP..."
sudo apt install -y php8.0
#!/bin/bash
# Function to print a message in a specific format
print_message() {
echo "--------------------------------------------------"
echo "$1"
echo "--------------------------------------------------"
}
# Function to install Homebrew
@naranyala
naranyala / polybar-rofi-net-monitor.sh
Created June 7, 2024 07:40
smart selection and monitor your network-speed in polybar
#!/bin/bash
# Temporary file to store the selected interface
INTERFACE_FILE="/tmp/selected_network_interface"
# Default network interface
DEFAULT_INTERFACE="wlp2s0"
# Function to get available network interfaces
get_interfaces() {
@naranyala
naranyala / polybar-rofi-screen-mode.sh
Created June 7, 2024 07:36
switch between screen mode (like in case of presentation)
#!/bin/bash
# Define the path to the mode file
MODE_FILE=~/.config/polybar/current_screen_mode
# Create the mode file with a default value if it doesn't exist
if [ ! -f "$MODE_FILE" ]; then
echo "default" > "$MODE_FILE"
fi
@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:")