Compare commits
10 commits
486b7cea1d
...
e511ffa7f7
Author | SHA1 | Date | |
---|---|---|---|
e511ffa7f7 | |||
7668ef8f47 | |||
aaba7cbcc6 | |||
3ef93255e9 | |||
024172af9d | |||
bd35b13f73 | |||
2c0d6050ef | |||
459e85de92 | |||
a98294a65e | |||
5a88d127d6 |
6 changed files with 40 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
||||||
"""Wrap GRUB commands."""
|
"""Wrap GRUB commands."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from rwx import cmd, ps
|
from rwx import cmd, ps
|
||||||
|
|
||||||
cmd.need("grub-mkimage")
|
cmd.need("grub-mkimage")
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
"""Handle processes."""
|
"""Handle processes."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from rwx import Object, txt
|
from rwx import Object, txt
|
||||||
|
|
|
@ -145,6 +145,8 @@ rwx_ffmpeg_output_video_slow() {
|
||||||
rwx_ffmpeg_record_hdmi_precision() {
|
rwx_ffmpeg_record_hdmi_precision() {
|
||||||
local file="${1}"
|
local file="${1}"
|
||||||
[ -n "${file}" ] || return
|
[ -n "${file}" ] || return
|
||||||
|
# LATER alternative
|
||||||
|
# shellcheck disable=SC2046,SC2312
|
||||||
set -- \
|
set -- \
|
||||||
$(rwx_ffmpeg_input_hdmi) \
|
$(rwx_ffmpeg_input_hdmi) \
|
||||||
$(rwx_ffmpeg_input_dell_precision) \
|
$(rwx_ffmpeg_input_dell_precision) \
|
||||||
|
@ -158,6 +160,8 @@ rwx_ffmpeg_record_hdmi_precision() {
|
||||||
rwx_ffmpeg_record_hdmi_yeti() {
|
rwx_ffmpeg_record_hdmi_yeti() {
|
||||||
local file="${1}"
|
local file="${1}"
|
||||||
[ -n "${file}" ] || return
|
[ -n "${file}" ] || return
|
||||||
|
# LATER alternative
|
||||||
|
# shellcheck disable=SC2046,SC2312
|
||||||
set -- \
|
set -- \
|
||||||
$(rwx_ffmpeg_input_hdmi) \
|
$(rwx_ffmpeg_input_hdmi) \
|
||||||
$(rwx_ffmpeg_input_blue_yeti) \
|
$(rwx_ffmpeg_input_blue_yeti) \
|
||||||
|
@ -178,6 +182,8 @@ rwx_ffmpeg_reduce() {
|
||||||
local from="${3}"
|
local from="${3}"
|
||||||
local to="${4}"
|
local to="${4}"
|
||||||
[ -n "${output}" ] || return
|
[ -n "${output}" ] || return
|
||||||
|
# LATER alternative
|
||||||
|
# shellcheck disable=SC2046,SC2312
|
||||||
set -- \
|
set -- \
|
||||||
$(rwx_ffmpeg_input_file "${input}" "${from}" "${to}") \
|
$(rwx_ffmpeg_input_file "${input}" "${from}" "${to}") \
|
||||||
$(rwx_ffmpeg_output_video_slow) \
|
$(rwx_ffmpeg_output_video_slow) \
|
||||||
|
|
|
@ -1,33 +1,31 @@
|
||||||
# lint code
|
# lint code
|
||||||
rwx_lint() {
|
rwx_lint() {
|
||||||
local path="${1}"
|
local path="${1}"
|
||||||
[ -n "${path}" ] || exit 1
|
[ -n "${path}" ] || return 1
|
||||||
rwx_lint_clean
|
rwx_lint_clean "${path}"
|
||||||
|
rwx_lint_tasks "${path}"
|
||||||
set \
|
set \
|
||||||
"python" \
|
"python" \
|
||||||
"shell"
|
"shell"
|
||||||
local code
|
local code
|
||||||
for code in "${@}"; do
|
for code in "${@}"; do
|
||||||
rwx_log "${code}"
|
rwx_log "" "${code}"
|
||||||
"rwx_lint_${code}" "${path}"
|
"rwx_lint_${code}" "${path}"
|
||||||
done
|
done
|
||||||
rwx_lint_clean
|
rwx_lint_clean "${path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# clean
|
# clean
|
||||||
rwx_lint_clean() {
|
rwx_lint_clean() {
|
||||||
local path="${1}"
|
local path="${1}"
|
||||||
[ -n "${path}" ] || exit 1
|
[ -n "${path}" ] || return 1
|
||||||
rwx_log "py3clean"
|
rwx_log "" "clean" ""
|
||||||
py3clean \
|
py3clean "${path}"
|
||||||
--verbose \
|
|
||||||
"${path}"
|
|
||||||
set \
|
set \
|
||||||
"mypy" \
|
"mypy" \
|
||||||
"ruff"
|
"ruff"
|
||||||
local tool
|
local tool
|
||||||
for tool in "${@}"; do
|
for tool in "${@}"; do
|
||||||
rwx_log "${tool}"
|
|
||||||
rwx_remove "${path}/.${tool}_cache"
|
rwx_remove "${path}/.${tool}_cache"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -42,7 +40,7 @@ rwx_lint_python() {
|
||||||
"mypy" \
|
"mypy" \
|
||||||
"ruff"
|
"ruff"
|
||||||
for action in "${@}"; do
|
for action in "${@}"; do
|
||||||
rwx_log "${action}"
|
rwx_log "" "${action}"
|
||||||
"rwx_${action}" "${path}"
|
"rwx_${action}" "${path}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -55,7 +53,7 @@ rwx_lint_shell() {
|
||||||
"shellcheck" \
|
"shellcheck" \
|
||||||
"shfmt"
|
"shfmt"
|
||||||
for action in "${@}"; do
|
for action in "${@}"; do
|
||||||
rwx_log "${action}"
|
rwx_log "" "${action}"
|
||||||
"rwx_${action}" "${path}"
|
"rwx_${action}" "${path}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -69,8 +67,9 @@ rwx_lint_tasks() {
|
||||||
"TODO" \
|
"TODO" \
|
||||||
"FIXME"
|
"FIXME"
|
||||||
for type in "${@}"; do
|
for type in "${@}"; do
|
||||||
rwx_log "${type}"
|
rwx_log "" "${type}"
|
||||||
grep \
|
grep \
|
||||||
|
--after "1" \
|
||||||
--directories "recurse" \
|
--directories "recurse" \
|
||||||
--line-number \
|
--line-number \
|
||||||
" ${type}" \
|
" ${type}" \
|
||||||
|
|
14
sh/python.sh
Normal file
14
sh/python.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# ╭────────╮
|
||||||
|
# │ python │
|
||||||
|
# ╰────────╯
|
||||||
|
|
||||||
|
# ╭────────┬──────╮
|
||||||
|
# │ python │ venv │
|
||||||
|
# ╰────────┴──────╯
|
||||||
|
|
||||||
|
rwx_python_venv() {
|
||||||
|
local path="${1}"
|
||||||
|
[ -d "${path}" ] || return 1
|
||||||
|
export VIRTUAL_ENV="${path}" && \
|
||||||
|
export PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
||||||
|
}
|
|
@ -63,6 +63,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
|
||||||
for device in "${@}"; do
|
for device in "${@}"; do
|
||||||
members="${members} ${device}2"
|
members="${members} ${device}2"
|
||||||
done
|
done
|
||||||
|
# LATER alternative
|
||||||
|
# shellcheck disable=SC2086
|
||||||
rwx_fs_raid_create \
|
rwx_fs_raid_create \
|
||||||
"boot" "00000000:00000000:00000000:00000002" ${members}
|
"boot" "00000000:00000000:00000000:00000002" ${members}
|
||||||
#
|
#
|
||||||
|
@ -87,6 +89,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() {
|
||||||
for device in "${@}"; do
|
for device in "${@}"; do
|
||||||
members="${members} ${device}1"
|
members="${members} ${device}1"
|
||||||
done
|
done
|
||||||
|
# LATER alternative
|
||||||
|
# shellcheck disable=SC2086
|
||||||
rwx_fs_raid_create \
|
rwx_fs_raid_create \
|
||||||
"crypt" "00000000:00000000:00000000:00000001" ${members}
|
"crypt" "00000000:00000000:00000000:00000001" ${members}
|
||||||
# encrypt
|
# encrypt
|
||||||
|
|
Loading…
Add table
Reference in a new issue