Compare commits
No commits in common. "cb3fc72d2b2684573a08062fc53c96d1bb1d2ef5" and "13eb0576b71d98b46e0cf89b629c9a78fb49e042" have entirely different histories.
cb3fc72d2b
...
13eb0576b7
9 changed files with 266 additions and 65 deletions
6
bin/coless
Executable file
6
bin/coless
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
export \
|
||||
LESSOPEN='| /usr/bin/src-hilite-lesspipe.sh %s' \
|
||||
LESS="${LESS} -R"
|
||||
exec less "$@"
|
||||
|
50
bin/convertofut
Executable file
50
bin/convertofut
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
|
||||
error() {
|
||||
printf '\033[1;31m%s\033[0m %s\n' "ERROR:" "$1"
|
||||
shift
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
trap 'error "$error" "$?"' EXIT; set -e
|
||||
|
||||
error="Le premier argument doit être l'extension des fichiers à convertir."
|
||||
[ -n "$1" ]; format_in="$1" ; shift
|
||||
error="Le second argument doit être l'extension des fichiers convertis."
|
||||
[ -n "$1" ]; format_out="$1"; shift
|
||||
|
||||
set +e; trap - EXIT
|
||||
|
||||
while [ -z "$input" ] ; do
|
||||
printf '%s' "Dossier à convertir : "
|
||||
read -r input
|
||||
done
|
||||
|
||||
output=../output
|
||||
|
||||
set -e
|
||||
cd "$input"
|
||||
mkdir -p "$output"
|
||||
set +e
|
||||
|
||||
case "$format_out" in
|
||||
mp3)
|
||||
options="-ab 320k"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
for file in **/*".${format_in}"; do
|
||||
while [ "$(jobs -p | wc -l)" -ge 10 ]; do
|
||||
sleep 1
|
||||
done
|
||||
basename "$file"
|
||||
output_file="${output}/$(dirname "$file")/$(basename "${file}" ".${format_in}").${format_out}"
|
||||
mkdir -p "$(dirname "${output_file}")"
|
||||
# shellcheck disable=SC2086
|
||||
ffmpeg -loglevel quiet -i "$file" $options "$output_file" &
|
||||
done
|
||||
|
||||
wait
|
||||
|
4
bin/docker-browse_volume
Executable file
4
bin/docker-browse_volume
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
mount_point="/mnt/${1}"
|
||||
docker run --rm -it -v "${1}:${mount_point}" -w "$mount_point" busybox sh
|
||||
|
118
bin/glurp
118
bin/glurp
|
@ -1,81 +1,83 @@
|
|||
#!/usr/bin/env sh
|
||||
# Function to print an error in stderr
|
||||
perror() {
|
||||
>&2 printf '\033[1;31mERROR:\033[0m \033[1m%s\033[0m\n' "$*"
|
||||
#!/bin/bash
|
||||
|
||||
declare -A temp_files
|
||||
temp_files[command_to_source]=$(mktemp)
|
||||
|
||||
clean() {
|
||||
rm -- "${temp_files[@]}"
|
||||
}
|
||||
|
||||
usage() {
|
||||
name=$(basename "$0")
|
||||
|
||||
printf %s "${name}: usage
|
||||
${name} f[ull]|a[rea] c[lip]|f[ile]
|
||||
${name} -h
|
||||
"
|
||||
cat << EOF
|
||||
Usage:
|
||||
glurp full|area clip|file
|
||||
EOF
|
||||
}
|
||||
|
||||
# Function to throw an error usage
|
||||
error_usage() {
|
||||
perror "invalid usage"
|
||||
>&2 usage
|
||||
error() {
|
||||
>&2 printf '\033[0m\033[1;31mERROR:\033[0m \033[1m%s\033[0m\n' "$*"
|
||||
}
|
||||
|
||||
exit 1
|
||||
error_usage() {
|
||||
error "Invalid usage"
|
||||
>&2 usage
|
||||
}
|
||||
|
||||
error_usage_clean() {
|
||||
error_usage
|
||||
clean
|
||||
}
|
||||
|
||||
screenshot_path() {
|
||||
if [ -d "$XDG_RUNTIME_DIR" ]; then
|
||||
base=${XDG_RUNTIME_DIR}/screenshots
|
||||
local path
|
||||
if [ -n "$1" ]; then
|
||||
path="$1"
|
||||
else
|
||||
base=/tmp/${USER}-screenshots
|
||||
path=.
|
||||
fi
|
||||
|
||||
# I literally know, shellcheck
|
||||
# shellcheck disable=2174
|
||||
mkdir -p -m 700 -- "$base"
|
||||
|
||||
printf %s "${base}/screenshot-$(date +%Y%m%d_%H%M%S%N).png"
|
||||
mkdir -p "$path"
|
||||
printf '%sscreenshot-%s.png' "${path}/" "$(date +%Y_%m_%d_%H_%M_%S_%N)"
|
||||
}
|
||||
|
||||
while getopts :h opt; do
|
||||
case "$opt" in
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
error_usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
trap error_usage_clean EXIT
|
||||
set -e
|
||||
|
||||
# Initial variables
|
||||
slurp=
|
||||
grim="grim -t png"
|
||||
clipboard=
|
||||
slurp=()
|
||||
grim_args=()
|
||||
wl_copy=()
|
||||
|
||||
# f* = full, a* = area
|
||||
case "$1" in
|
||||
f*) : ;;
|
||||
a*)
|
||||
slurp="slurp |"
|
||||
grim="${grim} -g -"
|
||||
full)
|
||||
:
|
||||
;;
|
||||
area)
|
||||
slurp+=(slurp \|)
|
||||
grim_args+=(-g -)
|
||||
;;
|
||||
*)
|
||||
false
|
||||
;;
|
||||
*) error_usage ;;
|
||||
esac
|
||||
shift
|
||||
|
||||
# c* = clip, f* = file
|
||||
case "$2" in
|
||||
c*)
|
||||
grim="${grim} -o -"
|
||||
clipboard="| wl-copy -t image/png"
|
||||
case "$1" in
|
||||
clip)
|
||||
wl_copy+=(\| wl-copy -t image/png)
|
||||
grim_args+=(-)
|
||||
;;
|
||||
f*)
|
||||
grim="${grim} -o '$(screenshot_path)'"
|
||||
file)
|
||||
grim_args+=("$(screenshot_path "${XDG_RUNTIME_DIR:-/tmp/$(whoami)}/screenshots")")
|
||||
;;
|
||||
*)
|
||||
false
|
||||
;;
|
||||
*) error_usage ;;
|
||||
esac
|
||||
shift
|
||||
|
||||
set -- sh -c "${slurp} ${grim} ${clipboard}"
|
||||
set -x
|
||||
#: "$@"
|
||||
#exit
|
||||
exec "$@"
|
||||
cat > "${temp_files[command_to_source]}" << EOF
|
||||
${slurp[@]} grim ${grim_args[@]} ${@} ${wl_copy[@]}
|
||||
EOF
|
||||
|
||||
trap clean EXIT
|
||||
|
||||
sh -s < "${temp_files[command_to_source]}"
|
||||
|
|
5
bin/hyprkill
Executable file
5
bin/hyprkill
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env sh
|
||||
set -- killall -u "$(whoami)" -9 Hyprland
|
||||
|
||||
set -x
|
||||
exec "$@"
|
|
@ -1,2 +1,2 @@
|
|||
#!/usr/bin/env sh
|
||||
exec drill @resolver1.opendns.com myip.opendns.com
|
||||
#!/bin/sh
|
||||
dig +short @resolver1.opendns.com myip.opendns.com
|
||||
|
|
107
bin/mcserv
Executable file
107
bin/mcserv
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/bin/bash
|
||||
|
||||
exec_as() {
|
||||
local user="$1"
|
||||
shift
|
||||
if [ "$(whoami)" != "$user" ]; then
|
||||
exec sudo -u "$user" "$0" "$@"
|
||||
else
|
||||
cd
|
||||
fi
|
||||
}
|
||||
|
||||
exec_as minecraft "$@" || exit
|
||||
bin=bin
|
||||
PATH="${bin}:${PATH}"
|
||||
EDITOR="${EDITOR:-nvim}"
|
||||
alias ls='ls --color=auto'
|
||||
shopt -s expand_aliases
|
||||
|
||||
print_error() {
|
||||
>&2 printf '\033[31;1mERROR:\033[0m \033[1m%s\033[0m\n' "$*"
|
||||
}
|
||||
|
||||
public_usage() {
|
||||
local name
|
||||
name="$(basename "$0")"
|
||||
cat << EOF
|
||||
${name}: utilisation
|
||||
${name} start|status|stop|watch|restart|edit <nom serveur>
|
||||
${name} list|active|usage|shell
|
||||
EOF
|
||||
}
|
||||
|
||||
error_usage() {
|
||||
print_error "Utilisation invalide."
|
||||
>&2 public_usage
|
||||
return 1
|
||||
}
|
||||
|
||||
public_start() {
|
||||
if [ -n "$1" ]; then
|
||||
exec screen -S "$1" \
|
||||
"$1"
|
||||
else
|
||||
error_usage
|
||||
fi
|
||||
}
|
||||
|
||||
public_status() {
|
||||
if [ -n "$1" ]; then
|
||||
printf '\033[1m%s\033[0m : ' "$1"
|
||||
if screen -ls "$1" > /dev/null 2>&1; then
|
||||
echo "en cours d'exécution"
|
||||
else
|
||||
echo "non en cours d'exécution"
|
||||
fi
|
||||
else
|
||||
error_usage
|
||||
fi
|
||||
}
|
||||
|
||||
public_stop() {
|
||||
if [ -n "$1" ]; then
|
||||
exec screen -S "$1" -X stuff '^E^Ustop^M'
|
||||
else
|
||||
error_usage
|
||||
fi
|
||||
}
|
||||
|
||||
public_watch() {
|
||||
exec screen -dr "$1"
|
||||
}
|
||||
|
||||
public_active() {
|
||||
exec screen -ls
|
||||
}
|
||||
|
||||
public_list() {
|
||||
echo "Serveurs disponibles :"
|
||||
exec ls "$bin"
|
||||
}
|
||||
|
||||
public_restart() {
|
||||
set -e
|
||||
stop "$@"
|
||||
start "$@"
|
||||
set +e
|
||||
}
|
||||
|
||||
public_edit() {
|
||||
exec "$EDITOR" "${bin}/${1}"
|
||||
}
|
||||
|
||||
public_shell() {
|
||||
exec bash -i
|
||||
}
|
||||
|
||||
verb="$1"
|
||||
shift
|
||||
|
||||
if [ -z "$verb" ]; then
|
||||
public_active
|
||||
elif declare -F | cut -d \ -f 3 | grep '^public_' | sed 's/^public_//' | grep -q "^${verb}$"; then
|
||||
"public_${verb}" "$@"
|
||||
else
|
||||
error_usage
|
||||
fi
|
19
bin/waybar
Executable file
19
bin/waybar
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash -x
|
||||
# Waybar wrapper to reload it anytime the
|
||||
# configuration is edited
|
||||
|
||||
# Variable
|
||||
waybar_config_d="${HOME}/.config/waybar"
|
||||
monitored_events=(
|
||||
modify
|
||||
create
|
||||
delete
|
||||
)
|
||||
|
||||
# Execution
|
||||
while :; do
|
||||
/usr/bin/waybar "$@" &
|
||||
inotifywait "${monitored_events[@]/#/-e}" "${waybar_config_d}"
|
||||
jobs -p | xargs kill
|
||||
done
|
||||
|
8
bin/waylectron
Executable file
8
bin/waylectron
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
name=$(basename "$0")
|
||||
path=$(dirname "$0")
|
||||
mapfile wayland_args < ~/.config/electron-flags.conf
|
||||
|
||||
PATH=$(echo "$PATH" | sed "s|$path||g" | sed 's/^://' | sed 's/::/:/g' | sed 's/:$//')
|
||||
|
||||
exec "$name" "${wayland_args[@]}"
|
Loading…
Reference in a new issue