mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-29 11:36:16 +01:00
Cleanup
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
4561f946ad
commit
c1ddc6a7c7
Binary file not shown.
Binary file not shown.
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p ffmpeg
|
||||
|
||||
for file in *.flac; do
|
||||
BASENAME="`basename "${file}" .flac`"
|
||||
COVER="${BASENAME}-cover.jpg"
|
||||
METADATA="${BASENAME}.meta"
|
||||
|
||||
echo "${BASENAME}"
|
||||
echo $PATH
|
||||
|
||||
ffmpeg -y -i "${file}" -an -c:v mjpeg "${COVER}"
|
||||
ffmpeg -i "${file}" -f ffmetadata "${METADATA}"
|
||||
ogg-cover-art "${COVER}" >> "${METADATA}"
|
||||
ffmpeg -i "${METADATA}" -i "${file}" -map_metadata 0 -b:a 320k -c:a libopus -map 1:a:0 "${BASENAME}.ogg"
|
||||
rm "${COVER}"
|
||||
rm "${METADATA}"
|
||||
done
|
||||
|
||||
# Local Variables:
|
||||
# mode: sh
|
||||
# End:
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
shopt -s nullglob
|
||||
for g in /sys/kernel/iommu_groups/*; do
|
||||
echo "IOMMU Group ${g##*/}:"
|
||||
for d in $g/devices/*; do
|
||||
echo -e "\t$(lspci -nns ${d##*/})"
|
||||
done;
|
||||
done;
|
Binary file not shown.
|
@ -1,89 +0,0 @@
|
|||
# -*- mode: sh -*-
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p unixtools.xxd
|
||||
|
||||
usage(){
|
||||
fmt <<EOF
|
||||
DESCRIPTION
|
||||
Adapted from ogg-cover-art by acabal: https://github.com/acabal/scripts/blob/master/ogg-cover-art
|
||||
|
||||
USAGE
|
||||
ogg-cover-art [COVER-FILENAME] META-FILENAME
|
||||
convert normal image into ogg supported metadata
|
||||
EOF
|
||||
exit
|
||||
}
|
||||
die(){ printf "Error: ${1}\n" 1>&2; exit 1; }
|
||||
require(){ command -v $1 > /dev/null 2>&1 || { suggestion=""; if [ ! -z "$2" ]; then suggestion=" $2"; fi; die "$1 is not installed.${suggestion}"; } }
|
||||
if [ $# -eq 1 ]; then if [ "$1" = "--help" -o "$1" = "-h" ]; then usage; fi fi
|
||||
#End boilerplate
|
||||
|
||||
#require "opuscomment.pl" "Try: apt-get install opus-tools"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
imagePath=""
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
imagePath="$1"
|
||||
fi
|
||||
|
||||
if [ ! -f "${imagePath}" ]; then
|
||||
die "Couldn't find cover image."
|
||||
fi
|
||||
|
||||
imageMimeType=$(file -b --mime-type "${imagePath}")
|
||||
|
||||
if [ "${imageMimeType}" != "image/jpeg" -a "${imageMimeType}" != "image/png" ]; then
|
||||
die "Cover image isn't a jpg or png image."
|
||||
fi
|
||||
|
||||
#Insert cover image from file
|
||||
|
||||
#metadata_block_picture format
|
||||
#See: https://xiph.org/flac/format.html#metadata_block_picture
|
||||
imageWithHeader="$(mktemp -t "tmp.XXXXXXXXXX")"
|
||||
description=""
|
||||
|
||||
#Reset cache file
|
||||
echo -n "" > "${imageWithHeader}"
|
||||
|
||||
#Picture type <32>
|
||||
printf "0: %.8x" 3 | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Mime type length <32>
|
||||
printf "0: %.8x" $(echo -n "${imageMimeType}" | wc -c) | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Mime type (n * 8)
|
||||
echo -n "${imageMimeType}" >> "${imageWithHeader}"
|
||||
|
||||
#Description length <32>
|
||||
printf "0: %.8x" $(echo -n "${description}" | wc -c) | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Description (n * 8)
|
||||
echo -n "${description}" >> "${imageWithHeader}"
|
||||
|
||||
#Picture with <32>
|
||||
printf "0: %.8x" 0 | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Picture height <32>
|
||||
printf "0: %.8x" 0 | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Picture color depth <32>
|
||||
printf "0: %.8x" 0 | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Picture color count <32>
|
||||
printf "0: %.8x" 0 | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Image file size <32>
|
||||
printf "0: %.8x" $(wc -c "${imagePath}" | cut --delimiter=' ' --fields=1) | xxd -r -g0 >> "${imageWithHeader}"
|
||||
|
||||
#Image file
|
||||
cat "${imagePath}" >> "${imageWithHeader}"
|
||||
|
||||
echo "metadata_block_picture=$(base64 --wrap=0 < "${imageWithHeader}")"
|
||||
|
||||
#Delete temp files
|
||||
rm "${imageWithHeader}"
|
|
@ -1,15 +0,0 @@
|
|||
# -*- mode: sh -*-
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p ffmpeg
|
||||
|
||||
LINK="${1}"
|
||||
FILE="${2}"
|
||||
BASENAME="$(basename "${FILE}" .ogg)"
|
||||
|
||||
wget "${LINK}" -O "${BASENAME}.jpg" && \
|
||||
ffmpeg -i "${FILE}" -f ffmetadata "${BASENAME}.meta" && \
|
||||
ogg-cover-art "${BASENAME}.jpg" >> "${BASENAME}.meta" && \
|
||||
ffmpeg -i "${BASENAME}.meta" -i "${FILE}" -map_metadata 0 -c:a copy "${BASENAME}-cover.ogg"
|
||||
|
||||
rm "${BASENAME}.meta"
|
||||
rm "${BASENAME}.jpg"
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
pactl load-module module-null-sink sink_name=separate-cable \
|
||||
sink_properties="device.description='Separate'"
|
||||
|
||||
pactl load-module module-loopback rate=44000 adjust_time=0 \
|
||||
source=separate-cable.monitor sink=alsa_output.pci-0000_0a_00.3.analog-stereo \
|
||||
latency_msec=1
|
||||
|
||||
## alsa_output.pci-0000_0a_00.3.analog-stereo.monitor
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# =============================================================================
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2015 Andre Richter
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# =============================================================================
|
||||
#
|
||||
# Author(s):
|
||||
# Andre Richter, <andre.o.richter @t gmail_com>
|
||||
#
|
||||
# =============================================================================
|
||||
#
|
||||
# This script takes one or two parameters in any order:
|
||||
# <Vendor:Device> i.e. vvvv:dddd
|
||||
# <Domain:Bus:Device.Function> i.e. dddd:bb:dd.f
|
||||
# and then:
|
||||
#
|
||||
# (1) If both <Vendor:Device> and <Domain:Bus:Device.Function> were provided,
|
||||
# validate that the requested <Vendor:Device> exists at <Domain:Bus:Device.Function>
|
||||
#
|
||||
# If only <Vendor:Device> was provided, determine the current
|
||||
# <Domain:Bus:Device.Function> for that device.
|
||||
#
|
||||
# If only <Domain:Bus:Device.Function> was provided, use it.
|
||||
#
|
||||
# (2) Unbinds all devices that are in the same iommu group as the supplied
|
||||
# device from their current driver (except PCIe bridges).
|
||||
#
|
||||
# (3) Binds to vfio-pci:
|
||||
# (3.1) The supplied device.
|
||||
# (3.2) All devices that are in the same iommu group.
|
||||
#
|
||||
# (4) Transfers ownership of the respective iommu group inside /dev/vfio
|
||||
# to $SUDO_USER
|
||||
#
|
||||
# Script must be executed via sudo
|
||||
|
||||
BDF_REGEX="^[[:xdigit:]]{2}:[[:xdigit:]]{2}.[[:xdigit:]]$"
|
||||
DBDF_REGEX="^[[:xdigit:]]{4}:[[:xdigit:]]{2}:[[:xdigit:]]{2}.[[:xdigit:]]$"
|
||||
VD_REGEX="^[[:xdigit:]]{4}:[[:xdigit:]]{4}$"
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "Error: This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$@" ]]; then
|
||||
echo "Error: Please provide Domain:Bus:Device.Function (dddd:bb:dd.f) and/or Version:Device (vvvv:dddd)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset VD BDF
|
||||
for arg in "$@"
|
||||
do
|
||||
if [[ $arg =~ $VD_REGEX ]]; then
|
||||
VD=$arg
|
||||
elif [[ $arg =~ $DBDF_REGEX ]]; then
|
||||
BDF=$arg
|
||||
elif [[ $arg =~ $BDF_REGEX ]]; then
|
||||
BDF="0000:${arg}"
|
||||
echo "Warning: You did not supply a PCI domain, assuming ${BDF}" 1>&2
|
||||
else
|
||||
echo "Error: Please provide Version:Device (vvvv:dddd) and/or Domain:Bus:Device.Function (dddd:bb:dd.f)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# BDF not provided, find BDF for Vendor:Device
|
||||
if [[ -z $BDF ]]; then
|
||||
COUNT=$(lspci -n -d ${VD} 2>/dev/null | wc -l)
|
||||
if [[ $COUNT -eq 0 ]]; then
|
||||
echo "Error: Vendor:Device ${VD} not found" 1>&2
|
||||
exit 1
|
||||
elif [[ $COUNT -gt 1 ]]; then
|
||||
echo "Error: Multiple results for Vendor:Device ${VD}, please provide Domain:Bus:Device.Function (dddd:bb:dd.f) as well" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
BDF=$(lspci -n -d ${VD} 2>/dev/null | cut -d " " -f1)
|
||||
if [[ $BDF =~ $BDF_REGEX ]]; then
|
||||
BDF="0000:${BDF}"
|
||||
elif [[ ! $BDF =~ $DBDF_REGEX ]]; then
|
||||
echo "Error: Unable to find Domain:Bus:Device.Function for Vendor:Device ${VD}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
TARGET_DEV_SYSFS_PATH="/sys/bus/pci/devices/$BDF"
|
||||
|
||||
if [[ ! -d $TARGET_DEV_SYSFS_PATH ]]; then
|
||||
echo "Error: Device ${BDF} does not exist, unable to bind device" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$TARGET_DEV_SYSFS_PATH/iommu/" ]]; then
|
||||
echo "Error: No signs of an IOMMU. Check your hardware and/or linux cmdline parameters. Use intel_iommu=on or iommu=pt iommu=1" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# validate that the correct Vendor:Device was found for this BDF
|
||||
if [[ ! -z $VD ]]; then
|
||||
if [[ $(lspci -n -s ${BDF} -d ${VD} 2>/dev/null | wc -l) -eq 0 ]]; then
|
||||
echo "Error: Vendor:Device ${VD} not found at ${BDF}, unable to bind device" 1>&2
|
||||
exit 1
|
||||
else
|
||||
echo "Vendor:Device ${VD} found at ${BDF}"
|
||||
fi
|
||||
else
|
||||
echo "Warning: You did not specify a Vendor:Device (vvvv:dddd), unable to validate ${BDF}" 1>&2
|
||||
fi
|
||||
|
||||
unset dev_sysfs_paths
|
||||
for dsp in $TARGET_DEV_SYSFS_PATH/iommu_group/devices/*
|
||||
do
|
||||
dbdf=${dsp##*/}
|
||||
if [[ $(( 0x$(setpci -s $dbdf 0e.b) & 0x7f )) -eq 0 ]]; then
|
||||
dev_sysfs_paths+=( $dsp )
|
||||
fi
|
||||
done
|
||||
|
||||
printf "\nIOMMU group members (sans bridges):\n"
|
||||
for dsp in ${dev_sysfs_paths[@]}; do echo $dsp; done
|
||||
|
||||
modprobe -i vfio-pci
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: Error probing vfio-pci" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "\nBinding...\n"
|
||||
for dsp in ${dev_sysfs_paths[@]}
|
||||
do
|
||||
dpath="$dsp/driver"
|
||||
dbdf=${dsp##*/}
|
||||
|
||||
echo "vfio-pci" > "$dsp/driver_override"
|
||||
|
||||
if [[ -d $dpath ]]; then
|
||||
curr_driver=$(readlink $dpath)
|
||||
curr_driver=${curr_driver##*/}
|
||||
|
||||
if [[ "$curr_driver" == "vfio-pci" ]]; then
|
||||
echo "$dbdf already bound to vfio-pci"
|
||||
continue
|
||||
else
|
||||
echo $dbdf > "$dpath/unbind"
|
||||
echo "Unbound $dbdf from $curr_driver"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $dbdf > /sys/bus/pci/drivers_probe
|
||||
done
|
||||
|
||||
printf "\n"
|
||||
|
||||
# Adjust group ownership
|
||||
iommu_group=$(readlink $TARGET_DEV_SYSFS_PATH/iommu_group)
|
||||
iommu_group=${iommu_group##*/}
|
||||
chown $SUDO_UID:$SUDO_GID "/dev/vfio/$iommu_group"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: unable to adjust group ownership of /dev/vfio/${iommu_group}" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "success...\n\n"
|
||||
echo "Device ${VD} at ${BDF} bound to vfio-pci"
|
||||
echo 'Devices listed in /sys/bus/pci/drivers/vfio-pci:'
|
||||
ls -l /sys/bus/pci/drivers/vfio-pci | egrep [[:xdigit:]]{4}:
|
||||
printf "\nls -l /dev/vfio/\n"
|
||||
ls -l /dev/vfio/
|
|
@ -1,3 +0,0 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
youtube-dl -f 251 "${1}" --exec 'ffmpeg -i {} -acodec copy "$(basename {} .webm).ogg" && rm "$(basename {})"'
|
Binary file not shown.
|
@ -1,31 +0,0 @@
|
|||
# Maintainer: Dimitris Kiziridis <ragouel at outlook dot com>
|
||||
# Contributor: Konrad Tegtmeier <konrad.tegtmeier+aur@gmail.com>
|
||||
# Contributor: Wojtek Gawroński <afronski@gmail.com>
|
||||
|
||||
pkgname=nomad
|
||||
pkgver=1.0.3
|
||||
pkgrel=1
|
||||
pkgdesc='A distributed, highly available, datacenter-aware scheduler'
|
||||
arch=('x86_64' 'i686' 'armv7h' 'aarch64')
|
||||
url="https://nomadproject.io/"
|
||||
license=('MPL2')
|
||||
optdepends=('docker: Enables docker driver'
|
||||
'java-runtime: Enables java driver'
|
||||
'qemu-headless: Enables qemu driver')
|
||||
provides=('nomad')
|
||||
conflicts=('nomad')
|
||||
depends=('glibc')
|
||||
backup=(etc/nomad.d/{server,client}/nomad.hcl)
|
||||
source_x86_64=("${pkgname}-${pkgver}.zip::https://releases.hashicorp.com/nomad/${pkgver}/nomad_${pkgver}_linux_amd64.zip")
|
||||
source_aarch64=("${pkgname}-${pkgver}.zip::https://releases.hashicorp.com/nomad/${pkgver}/nomad_${pkgver}_linux_arm64.zip")
|
||||
source=('nomad.service')
|
||||
sha256sums=('32c864a9aca5164d05b087b86858c9d6044025a5ce41b8a2c3749bd92f15686b')
|
||||
sha256sums_x86_64=('f384132204e906d653cce0fd6fa2dbe8edf26d50c319d824aa3a5e9184508fe0')
|
||||
sha256sums_aarch64=('f384132204e906d653cce0fd6fa2dbe8edf26d50c319d824aa3a5e9184508fe0')
|
||||
|
||||
package() {
|
||||
install -Dm0755 nomad "${pkgdir}/usr/bin/nomad"
|
||||
install -Ddm750 -o root -g root "${pkgdir}/var/lib/nomad"
|
||||
install -Ddm750 "${pkgdir}/etc/nomad.d/"
|
||||
install -Dm644 "nomad.service" "${pkgdir}/usr/lib/systemd/system/nomad.service"
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
[Unit]
|
||||
Description=Nomad
|
||||
Documentation=https://nomadproject.io/docs/
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
ExecStart=/usr/bin/nomad agent -config /etc/nomad.d
|
||||
KillMode=process
|
||||
KillSignal=SIGINT
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
StartLimitBurst=3
|
||||
StartLimitIntervalSec=10
|
||||
TasksMax=infinity
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in a new issue