Rename scripts
Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
parent
df6b44e541
commit
410d0b33c6
46 changed files with 566 additions and 249 deletions
15
system/.local/bin/cmus-cover
Executable file
15
system/.local/bin/cmus-cover
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# cmus-cover
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Saves the current cmus cover to a file.
|
||||
#
|
||||
# USAGE:
|
||||
# ./cmus-cover
|
||||
FILE="$(cmus-remote -Q | grep -e "file " | cut -d " " -f 2-)"
|
||||
ffmpeg -y -i "${FILE}" -f image2 /home/severin/.local/share/cmus/.cover
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# games.sh
|
||||
# games
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -10,7 +10,7 @@
|
|||
# Displays a game menu using rofi.
|
||||
#
|
||||
# USAGE:
|
||||
# ./games.sh
|
||||
# ./games
|
||||
|
||||
# The rofi prompt
|
||||
PROMPT="Games"
|
||||
|
@ -19,7 +19,8 @@ PROMPT="Games"
|
|||
ACTIONS=(
|
||||
"1: Steam"
|
||||
"2: Guild Wars 2"
|
||||
"3: Pegasus"
|
||||
"3: Minecraft"
|
||||
"4: Pegasus"
|
||||
)
|
||||
|
||||
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | rofi -dmenu -p "${PROMPT}" | cut -d ":" -f1)
|
||||
|
@ -28,9 +29,12 @@ case "${SELECTION}" in
|
|||
steam
|
||||
;;
|
||||
"2")
|
||||
g2.sh
|
||||
gw2
|
||||
;;
|
||||
"3")
|
||||
pegasus-fe
|
||||
optirun -b primus minecraft-launcher
|
||||
;;
|
||||
"4")
|
||||
optirun -b primus pegasus-fe
|
||||
;;
|
||||
esac
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# gw2.sh
|
||||
# gw2
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -10,7 +10,7 @@
|
|||
# Starts Guild Wars 2 inside Wine.
|
||||
#
|
||||
# USAGE:
|
||||
# ./gw2.sh
|
||||
# ./gw2
|
||||
# Set custom wineprefix
|
||||
export WINEPREFIX="${HOME}/Games/Guild_Wars_2/"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# increase_volume.sh
|
||||
# increase_volume
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -12,7 +12,7 @@
|
|||
# using custom i3 keybindings.
|
||||
#
|
||||
# USAGE:
|
||||
# ./increase_volume.sh
|
||||
# ./increase_volume
|
||||
if [[ $(pamixer --get-volume) -lt 150 ]]; then
|
||||
pamixer -i 5 --allow-boost
|
||||
fi
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# music.sh
|
||||
# music
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -10,7 +10,7 @@
|
|||
# Prints out the title of the current playing song using cmus-remote.
|
||||
#
|
||||
# USAGE:
|
||||
# ./music.sh
|
||||
# ./music
|
||||
|
||||
QUERY="$(cmus-remote -Q)"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# power.sh
|
||||
# power
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -10,7 +10,7 @@
|
|||
# Displays a power menu using rofi.
|
||||
#
|
||||
# USAGE:
|
||||
# ./power.sh
|
||||
# ./power
|
||||
|
||||
# The rofi prompt
|
||||
PROMPT="Power Options"
|
||||
|
@ -33,13 +33,13 @@ case "${SELECTION}" in
|
|||
systemctl poweroff
|
||||
;;
|
||||
"3")
|
||||
screenlock.sh
|
||||
screenlock
|
||||
;;
|
||||
"5")
|
||||
"4")
|
||||
gksudo "cpupower frequency-set -g performance"
|
||||
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=2' -c :8 > /dev/null
|
||||
;;
|
||||
"6")
|
||||
"5")
|
||||
gksudo "cpupower frequency-set -g powersave"
|
||||
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=0' -c :8 > /dev/null
|
||||
;;
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# resolution.sh
|
||||
# resolution
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -11,6 +11,6 @@
|
|||
# is used by i3 and lightdm.
|
||||
#
|
||||
# USAGE:
|
||||
# ./resolution.sh
|
||||
# ./resolution
|
||||
#xrandr --setprovideroutputsource modesetting NVIDIA-0
|
||||
xrandr --output HDMI3 --off --output HDMI2 --off --output HDMI-1 --mode 1280x1024 --pos 80x56 --rotate normal --output eDP-1 --primary --mode 1920x1080 --pos 1360x0 --rotate normal --output DP3 --off --output DP2 --off --output DP1 --off
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# screenlock.sh
|
||||
# screenlock
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -11,5 +11,5 @@
|
|||
# using a custom i3 keybinding.
|
||||
#
|
||||
# USAGE:
|
||||
# ./screenlock.sh
|
||||
# ./screenlock
|
||||
i3lock-fancy -f "Noto Sans"
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# server.sh
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# This script starts / stops the Apache and MariaDB servers.
|
||||
#
|
||||
# USAGE:
|
||||
# ./server.sh start|stop
|
||||
if [ "${1}" == "start" ]; then
|
||||
sudo systemctl start httpd.service
|
||||
sudo systemctl start mariadb.service
|
||||
elif [ "${1}" == "stop" ]; then
|
||||
sudo systemctl stop httpd.service
|
||||
sudo systemctl stop mariadb.service
|
||||
else
|
||||
echo "${1} is an unknown option"
|
||||
exit 0
|
||||
fi
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# submodule_update.sh
|
||||
# submodule_update
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -11,14 +11,13 @@
|
|||
# new commit and pushes it. Only when there are no staged changes pending.
|
||||
#
|
||||
# USAGE:
|
||||
# ./submodule_update.sh
|
||||
. utils.sh
|
||||
# ./submodule_update
|
||||
. utils
|
||||
|
||||
START_DIR=$(pwd)
|
||||
|
||||
print_header "Updating submodules"
|
||||
|
||||
|
||||
while IFS= read -r -d '' dir
|
||||
do
|
||||
cd "$dir" || exit 1
|
22
system/.local/bin/sync_notes
Executable file
22
system/.local/bin/sync_notes
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# sync_notes
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Sync notes in ~/Notes using git
|
||||
#
|
||||
# USAGE:
|
||||
# ./sync_notes
|
||||
. /home/severin/.local/bin/utils
|
||||
|
||||
print_time_log "sync_notes" "Synchronizing notes"
|
||||
|
||||
cd "/home/severin/Notes" || exit
|
||||
git pull > /dev/null 2>&1
|
||||
git add --all > /dev/null 2>&1
|
||||
git commit -s -m "Update notes" > /dev/null 2>&1
|
||||
git push origin master > /dev/null 2>&1
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# sync_notes.sh
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Sync notes in ~/Notes using git
|
||||
#
|
||||
# USAGE:
|
||||
# ./sync_notes.sh
|
||||
# Set custom wineprefix
|
||||
cd "/home/severin/Notes" || exit
|
||||
git pull
|
||||
git add --all
|
||||
git commit -s -m "Update notes"
|
||||
git push origin master
|
17
system/.local/bin/sync_package_databases
Executable file
17
system/.local/bin/sync_package_databases
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# sync_package_databases
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Syncs the package database of pacman
|
||||
#
|
||||
# USAGE:
|
||||
# ./sync_package_databases
|
||||
. /home/severin/.local/bin/utils
|
||||
|
||||
print_time_log "sync_package_databases" "Syncing databases"
|
||||
yay -Syy > /dev/null 2>&1
|
33
system/.local/bin/todo
Executable file
33
system/.local/bin/todo
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# todo
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Lists the TODOs.
|
||||
#
|
||||
# USAGE:
|
||||
# ./todo
|
||||
clear
|
||||
|
||||
while read -r line
|
||||
do
|
||||
task=$(echo "${line}" | cut -d "," -f 6)
|
||||
project=$(echo "${line}" | cut -d "," -f 4 | sed -e "s/^#//")
|
||||
datetime=$(echo "${line}" | cut -d "," -f 3)
|
||||
echo -e "[${datetime}][${project}]\n☐ ${task}\n"
|
||||
done <<< "$(todoist s && todoist --csv list --filter "(overdue | today)")"
|
||||
|
||||
|
||||
TODOS=$(rg -g "!todo" --hidden --no-heading -n "TODO:" "${HOME}/dotfiles" "${HOME}/Projects")
|
||||
if [ -n "${TODOS}" ]; then
|
||||
while read -r line; do
|
||||
file=$(echo "${line}" | cut -d ":" -f 1 | sed -e "s/^[[:space:]]*//")
|
||||
lineNumber=$(echo "${line}" | cut -d ":" -f 2 | sed -e "s/^[[:space:]]*//")
|
||||
task=$(echo "${line}" | cut -d ":" -f 4 | sed -e "s/^[[:space:]]*//")
|
||||
echo -e "[Line ${lineNumber}][${file}]\n☐ ${task}\n"
|
||||
done <<< "${TODOS}"
|
||||
fi
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# twitch.sh
|
||||
# twitch
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -11,7 +11,7 @@
|
|||
# using streamlink.
|
||||
#
|
||||
# USAGE:
|
||||
# ./twitch.sh USERNAME [RESOLUTION]
|
||||
# ./twitch USERNAME [RESOLUTION]
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Please enter a username!"
|
||||
exit 1
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# upgrade.sh
|
||||
# upgrade
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -11,8 +11,8 @@
|
|||
# npm packages.
|
||||
#
|
||||
# USAGE:
|
||||
# ./upgrade.sh
|
||||
. utils.sh
|
||||
# ./upgrade
|
||||
. utils
|
||||
|
||||
print_header "Upgrading system"
|
||||
print_section "Update arch packages"
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# utils.sh
|
||||
# utils
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -39,12 +39,18 @@ function print_header() {
|
|||
echo -e "╚══════════════════════════════════════════════════════════════════════════════╝${RESET}"
|
||||
}
|
||||
|
||||
# Function to print out a log entry together with the current date and time.
|
||||
# USAGE: print_time_log SCRIPT MESSAGE
|
||||
function print_time_log() {
|
||||
echo -e "[$(date "+%F %T")][${1}] ${2}"
|
||||
}
|
||||
|
||||
# Function to print a info message with the current time and to send
|
||||
# a notification using notify-send.
|
||||
# USAGE: print_notify TITLE MESSAGE
|
||||
function print_notify() {
|
||||
notify-send "${1}" "${2}"
|
||||
echo -e "${YELLOW}[$(date "+%H:%M:%S")] ${1} ${2}${RESET}"
|
||||
echo -e "${YELLOW}[$(date "+%T")] ${1} ${2}${RESET}"
|
||||
}
|
||||
|
||||
# Prints a section title.
|
||||
|
@ -103,3 +109,15 @@ function copy_udev_rule() {
|
|||
print_log "Copying ${YELLOW}$(basename "${1}")${RESET} to ${YELLOW}/etc/udev/rules.d/${RESET}"
|
||||
sudo cp "${1}" "/etc/udev/rules.d/"
|
||||
}
|
||||
|
||||
# Function to copy sudoers files to /etc/sudoers.d/
|
||||
# USAGE: copy_sudoers_content FILE
|
||||
function copy_sudoers_content() {
|
||||
print_log "Copying ${YELLOW}$(basename "${1}")${RESET} to ${YELLOW}/etc/sudoers.d/${RESET}"
|
||||
|
||||
sudo mkdir -p "/tmp/sudoers"
|
||||
sudo cp "${1}" "/tmp/sudoers/$(basename "${1}")"
|
||||
sudo chmod 0440 "/tmp/sudoers/$(basename "${1}")"
|
||||
sudo cp -a "/tmp/sudoers/$(basename "${1}")" "/etc/sudoers.d/"
|
||||
|
||||
}
|
20
system/.local/bin/wallpaper
Executable file
20
system/.local/bin/wallpaper
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# wallpaper
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Sets the wallpaper using feh
|
||||
#
|
||||
# USAGE:
|
||||
# ./wallpaper
|
||||
. /home/severin/.local/bin/utils
|
||||
|
||||
print_time_log "wallpaper" "Changing wallpaper"
|
||||
|
||||
# When run from a cronjob the DISPLAY environment variable is not set
|
||||
|
||||
DISPLAY=:0 feh --randomize --bg-fill --no-fehbg "/home/severin/Documents/02_Media/Images/01_Wallpaper/Desktop/"
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# watch.sh
|
||||
# watch-file
|
||||
#
|
||||
# AUTHOR:
|
||||
# Severin Kaderli <severin.kaderli@gmail.com>
|
||||
|
@ -11,8 +11,8 @@
|
|||
# executes the given command.
|
||||
#
|
||||
# USAGE:
|
||||
# ./watch.sh FILE COMMAND...
|
||||
. utils.sh
|
||||
# ./watch-file FILE COMMAND...
|
||||
. utils
|
||||
|
||||
# The file to watch
|
||||
FILE="${1}"
|
Loading…
Add table
Add a link
Reference in a new issue