initial commit
This commit is contained in:
commit
b39b82463b
13 changed files with 214 additions and 0 deletions
11
audio_mixer
Executable file
11
audio_mixer
Executable file
|
@ -0,0 +1,11 @@
|
|||
#/usr/bin/env bash
|
||||
# docstring=simple mixer gui app, for the desktop
|
||||
set -E -o pipefail
|
||||
|
||||
mixxc \
|
||||
--anchor right \
|
||||
--margin 22 \
|
||||
--anchor bottom \
|
||||
--margin 22 \
|
||||
--icon \
|
||||
--master
|
5
battery
Executable file
5
battery
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=just shows the current capacity
|
||||
set -E -o pipefail
|
||||
|
||||
cat /sys/class/power_supply/BAT0/capacity
|
23
brght
Executable file
23
brght
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=simplifies the brightnessctl command
|
||||
set -E -o pipefail
|
||||
|
||||
# when invoked without parameter will print current brightness in percent
|
||||
# it accepts a parameter from 0 to 100 for brightness. Please ommit the % symbol.
|
||||
|
||||
if [[ "$1" == "--toggle" ]]; then
|
||||
if [[ "$(brightnessctl get)" == "0" ]]; then
|
||||
brightnessctl --restore || brightnessctl set '50%' # just in case --restore fails
|
||||
else
|
||||
brightnessctl --save && brightnessctl set 0
|
||||
fi
|
||||
exit 0 # if toggle is used don't continue
|
||||
fi
|
||||
|
||||
# default path
|
||||
percentage(){ brightnessctl -m | cut -d',' -f4; }
|
||||
printf "current: "; percentage
|
||||
if [[ -n "$1" ]]; then
|
||||
brightnessctl set "$1\%" > /dev/null
|
||||
printf "now: "; percentage
|
||||
fi
|
10
dlp-trnsrpt
Executable file
10
dlp-trnsrpt
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=transcript of youtube videos
|
||||
set -E -o pipefail
|
||||
|
||||
TEMP_FOLDER='/tmp/dlp-trnsrpt'
|
||||
mkdir -p "$TEMP_FOLDER"
|
||||
cd "$TEMP_FOLDER"
|
||||
|
||||
yt-dlp --write-auto-sub --sub-langs 'en.*,.*orig' --convert-subs=srt --skip-download "$*"
|
||||
nvim "$TEMP_FOLDER"/*-orig*
|
5
hyprperf
Executable file
5
hyprperf
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=disable hyprland blur for performance
|
||||
set -E -o pipefail
|
||||
|
||||
hyprctl keyword decoration:blur:enabled false
|
15
mserve
Executable file
15
mserve
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=serve files with http.
|
||||
set -E -o pipefail
|
||||
|
||||
miniserve \
|
||||
--auth=guest:Super9000! \
|
||||
--color-scheme-dark=monokai \
|
||||
--qrcode \
|
||||
--dirs-first \
|
||||
--hide-version-footer \
|
||||
--show-wget-footer \
|
||||
--title="Rano's quick share"
|
||||
|
||||
|
||||
# implement a switch for easy --upload-files=DIR
|
59
mytools
Executable file
59
mytools
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/env python3
|
||||
# docstring=lists all tools and their docstrings
|
||||
import os
|
||||
import os.path as path
|
||||
|
||||
CFG = {
|
||||
"max_lines": 20,
|
||||
"offset": 20
|
||||
}
|
||||
|
||||
def parse_docstring(file_path, max_lines=CFG["max_lines"]):
|
||||
"""
|
||||
in file `file_path` and from the top until `max_lines` is reached,
|
||||
checks if `docstring=` is present.
|
||||
"""
|
||||
with open(file_path, "r") as file_fd:
|
||||
count = 0
|
||||
while count <= max_lines:
|
||||
count += 1
|
||||
|
||||
line = file_fd.readline()
|
||||
if "docstring=" in line:
|
||||
try:
|
||||
return line.split("=")[1].strip("\n").strip(" ")
|
||||
except IndexError:
|
||||
return ""
|
||||
return ""
|
||||
|
||||
|
||||
def offset(element, offset=CFG["offset"]):
|
||||
"""
|
||||
calculates the amount of spaces until `offset` is reached for `element` length
|
||||
"""
|
||||
element_length = len(element.strip(""))
|
||||
if element_length >= offset:
|
||||
return ""
|
||||
else:
|
||||
return " " * (offset - element_length)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
lists all tools and their docstring from the same directory this sits in
|
||||
"""
|
||||
script_path = os.path.dirname(os.path.realpath(__file__))
|
||||
list_dir = sorted(os.listdir(script_path))
|
||||
|
||||
for element in list_dir:
|
||||
element_path = path.join(script_path, element)
|
||||
if path.isfile(element_path):
|
||||
print(element, end="")
|
||||
docstring = parse_docstring(element_path)
|
||||
if docstring:
|
||||
print(f":{offset(element)}{docstring}", end="")
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
5
nstore-find
Executable file
5
nstore-find
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=searches the nix store with find
|
||||
set -E -o pipefail
|
||||
|
||||
find /nix/store/ -maxdepth 1 -iname '*'"$@"'*'
|
14
nswitch
Executable file
14
nswitch
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
# from https://github.com/0atman/noboilerplate/blob/main/scripts/38-nixos.md#dont-use-nix-env
|
||||
# docstring=quick edit (or ling xD) for nixos config
|
||||
set -E -o pipefail
|
||||
|
||||
cd ~/Projects/NixOS/
|
||||
nvim
|
||||
nix fmt . &>/dev/null
|
||||
git diff -U0 *.nix
|
||||
echo "NixOS Rebuilding..."
|
||||
sudo nixos-rebuild switch &>nixos-switch.log || (
|
||||
cat nixos-switch.log | grep --color error && false)
|
||||
gen=$(nixos-rebuild list-generations | grep current)
|
||||
git commit -am "$gen"
|
25
rustdesk_profile
Executable file
25
rustdesk_profile
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=have and create multiple rustdesk profiles
|
||||
set -E -o pipefail
|
||||
|
||||
# define frist element in argument list as profile name
|
||||
RUSTDESK_PROFILE="$1"
|
||||
|
||||
# Check user input
|
||||
if [[ $RUSTDESK_PROFILE == \-* ]] || [[ $RUSTDESK_PROFILE == \-\-* ]] || [[ -z "$RUSTDESK_PROFILE" ]];
|
||||
then
|
||||
#printf "Please provide first a profile name and then optional options with - or --.\n"
|
||||
printf "Please provide a profile name.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure profile folder for config exists.
|
||||
export XDG_CONFIG_HOME="$HOME/.config/rustdesk_${RUSTDESK_PROFILE}"
|
||||
mkdir -p "$XDG_CONFIG_HOME"
|
||||
printf "Using profile: $XDG_CONFIG_HOME\n"
|
||||
#exit 0
|
||||
|
||||
# As of rustdesk 1.1.9 giving rustdesk unknown arguments crashes it with an address boundary error.
|
||||
# (At least on my machines)
|
||||
# Thats why we are calling rustdesk without arguments, until thats solved
|
||||
rustdesk #"${*:2}"
|
5
screenshot
Executable file
5
screenshot
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=do a screenshots on wayland compositors
|
||||
set -E -o pipefail
|
||||
|
||||
grim -g "$(slurp -o -r -c '#ff0000ff')" - | satty --filename - --fullscreen --output-filename ~/Media/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png
|
22
scrnl
Executable file
22
scrnl
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python3
|
||||
# docstring=wraps kanshictl and adds features
|
||||
import os
|
||||
import os.path as path
|
||||
|
||||
HOME = os.environ["HOME"]
|
||||
CFG = {
|
||||
"config_path": path.join(HOME, ".config/kanshi/config")
|
||||
}
|
||||
|
||||
def extract_layouts(config_path=CFG["config_path"]):
|
||||
with open(config_path, "r") as file_fd:
|
||||
for line in file_fd:
|
||||
print(line)
|
||||
|
||||
|
||||
def main():
|
||||
extract_layouts()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
15
webcam
Executable file
15
webcam
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# docstring=open the webcam or v4l2 /dev/video* device
|
||||
set -E -o pipefail
|
||||
|
||||
if [[ "-h" == "$1" ]]; then
|
||||
echo "-l list devices"
|
||||
exit 0
|
||||
elif [[ "-l" == "$1" ]]; then
|
||||
ls -la /dev/video*
|
||||
exit 0
|
||||
fi
|
||||
|
||||
device="/dev/video""${1:-"0"}"
|
||||
echo ">>> opening: $device"
|
||||
mpv --panscan=1.0 --no-osc --profile=low-latency --untimed "av://v4l2:$device"
|
Loading…
Add table
Reference in a new issue