update:system keybinds+scripts
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Simple script to inject token:name into existing git remote URL
|
||||
# Usage: git-token <n> <token>
|
||||
|
||||
[ $# -ne 2 ] && { echo "Usage: git-token <username> <token>"; exit 1; }
|
||||
|
||||
NAME="$1"
|
||||
TOKEN="$2"
|
||||
|
||||
REMOTE=$(git remote get-url origin 2>/dev/null) || { echo "No origin remote found"; exit 1; }
|
||||
|
||||
# if ssh convert, else normal
|
||||
if [[ $REMOTE =~ ^git@([^:]+):(.+)$ ]]; then
|
||||
# SSH format: git@host:path -> https://token:name@host/path
|
||||
HOST="${BASH_REMATCH[1]}"
|
||||
PATH="${BASH_REMATCH[2]}"
|
||||
NEW_URL="https://${NAME}:${TOKEN}@${HOST}/${PATH}"
|
||||
elif [[ $REMOTE =~ ^https://(.+)$ ]]; then
|
||||
# HTTPS format: https://rest -> https://token:name@rest
|
||||
NEW_URL="https://${NAME}:${TOKEN}@${BASH_REMATCH[1]}"
|
||||
else
|
||||
echo "Unsupported remote format: $REMOTE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set new remote
|
||||
git remote set-url origin "$NEW_URL"
|
||||
|
||||
echo "Remote updated: $NEW_URL"
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
# init needs to be ran in this specific script's folder
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
imp() {
|
||||
local path="$1"
|
||||
if [ -f "$path" ]; then
|
||||
set -a
|
||||
source $path
|
||||
set +a
|
||||
fi
|
||||
}
|
||||
imp "utils/import_print"
|
||||
current_script=$(basename "$0")
|
||||
|
||||
if [ ! -d "$HOME/.local/bin" ]; then
|
||||
print_status "INFO" "~/.local/bin directory does not exist"
|
||||
mkdir -p ~/.local/bin
|
||||
print_status "INFO" "Created ~/.local/bin ..."
|
||||
fi
|
||||
|
||||
changed_count=0
|
||||
unchanged_count=0
|
||||
|
||||
for file in *; do
|
||||
[ "$file" = "$current_script" ] && continue
|
||||
[ ! -f "$file" ] && continue
|
||||
|
||||
target_path="$HOME/.local/bin/$file"
|
||||
|
||||
if [ -e "$target_path" ]; then
|
||||
# dont change
|
||||
((unchanged_count++))
|
||||
else
|
||||
ln -s "${SCRIPT_DIR}/$file" "$target_path"
|
||||
((changed_count++))
|
||||
print_status "OK" "Added $target_path"
|
||||
fi
|
||||
done
|
||||
|
||||
print_status "OK" "Ignored: $unchanged_count, Added: $changed_count scripts"
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
if ! command -v mpv &> /dev/null; then
|
||||
echo "mpv is not installed"
|
||||
exit 1
|
||||
fi
|
||||
echo "space = play/pause"
|
||||
echo "<,> = back,next"
|
||||
echo "q = quit"
|
||||
echo "left/right = skip seconds"
|
||||
mpv --shuffle --loop-playlist=inf "$@"
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <string_to_check>"
|
||||
echo "Example: $0 discord-0.0.20.tar.gz"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
func_validate_filename() {
|
||||
# Convert to lowercase for case-insensitive matching
|
||||
local lower_input=$(echo "$1" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Check if both "discord" and ".deb" are present
|
||||
if [[ "$lower_input" == *"discord"* ]] && [[ "$lower_input" == *".tar.gz"* ]]; then
|
||||
echo "✓ Updated Discord with file: '$1'"
|
||||
return 0
|
||||
else
|
||||
echo "✗ No match: '$1' does not contain both 'discord' and '.tar.gz'"
|
||||
|
||||
# Provide specific feedback
|
||||
if [[ "$lower_input" != *"discord"* ]]; then
|
||||
echo " - Missing 'discord' ✗"
|
||||
fi
|
||||
|
||||
if [[ "$lower_input" != *".deb"* ]]; then
|
||||
echo " - Missing '.deb' ✗"
|
||||
fi
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
if func_validate_filename "$1"; then
|
||||
sudo tar -xzf "$1"
|
||||
sudo rm -rf /opt/discord
|
||||
sudo mv Discord /opt/discord
|
||||
sudo ln -sf /opt/discord/Discord /usr/bin/discord
|
||||
fi
|
||||
|
||||
#TODO check for .desktop file and create if not exists
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# print colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
print_status() {
|
||||
local status=$1
|
||||
local message=$2
|
||||
case $status in
|
||||
"OK") echo -e "${GREEN}[OK]${NC} $message" >&2 ;;
|
||||
"WARN") echo -e "${YELLOW}[WARN]${NC} $message" >&2 ;;
|
||||
"ERROR") echo -e "${RED}[ERROR]${NC} $message" >&2 ;;
|
||||
"INFO") echo -e "${BLUE}[INFO]${NC} $message" >&2 ;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user