Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Maxattax97/miscellaneous
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxattax97 committed Sep 29, 2024
2 parents c73c22a + 8eb812e commit b0883bf
Show file tree
Hide file tree
Showing 11 changed files with 387 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .Xdefaults
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ st*selectToClipboard: true
st*disallowedWindowOps: 20,21,SetXprop
! st.termname: st-256color
st.borderpx: 0
st.font: Hack Nerd Font Mono:size=9:antialias=true:autohint=true
st.font: Hack Nerd Font Mono:pixelsize=12:antialias=true:autohint=true
st.alpha: 0.9
st.alphaOffset: 0.0
st.alphaUnfocus: 0.0
Expand All @@ -132,6 +132,7 @@ Xft.antialias: 1
Xft.hinting: true
!Xft.hintstyle: hintslight
Xft.hintstyle: hintfull
/* This is the default DPI and unfortunately does not scale according to Gnome: */
Xft.dpi: 96
!Xft.rgba: rgb
Xft.rgba: none
Expand Down
2 changes: 1 addition & 1 deletion .tmuxp/maxocull.com.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ windows:
automatic-rename: false
panes:
- shell_command: ctop
focus: true
environment:
DISABLE_AUTO_TITLE: "true"
optionsa:
allow-rename: false
automatic-rename: false
- shell_command: docker-compose -f /opt/flotilla/docker-compose.yml logs -f
focus: true
environment:
DISABLE_AUTO_TITLE: "true"
options:
Expand Down
97 changes: 96 additions & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -1369,12 +1369,84 @@ zshrc_load_library() {
image-optimize $@
}
scale() {
image-scale() {
scale=$1
shift
mogrify -scale $scale $@
}
audio-normalize() {
for file in "$@"; do
ffmpeg -i "$file" -filter:a loudnorm=I=-23:TP=-1.5:LRA=11 "normalized_${file}"
mv "normalized_${file}" "$file"
done
}
# Adds reverb, slows down, and boosts the bass.
audio-boost() {
for file in "$@"; do
base="${file%.*}"
# SoX has limited output support, so we have to convert between FLAC and MP4.
ffmpeg -i "$file" "${base}.flac"
rm "$file"
sox "${base}.flac" "boosted_${base}.flac" speed 0.85 reverb 50 equalizer 60 1q +6
rm "${base}.flac"
audio-optimize "boosted_${base}.flac"
mv "boosted_${base}.mp4" "${base}.mp4"
done
}
audio-optimize() {
for file in "$@"; do
noextension="${file%.*}"
ffmpeg -i "$file" -c:a aac -b:a 192k -filter:a "volume=replaygain=track" "${noextension}.mp4"
rm "$file"
done
}
audio-clip() {
file="$1"
start_secs="$2"
end_secs="$3"
ffmpeg -ss "$start_secs" -to "$end_secs" -i "$file" "clip_${start_secs}_${end_secs}_${file}"
}
audio-enhance() {
audio-normalize $@
audio-optimize $@
}
audio-remote-play() {
ssh "$1" "cat $2" | mpv -
}
video-enhance() {
# TODO: auto-pick threads
# TODO: crf to 20?
#
for file in "$@"; do
ffmpeg -i "$file" \
-vf "
yadif,
format=yuv420p,
" \
-c:v libvpx-vp9 -crf 32 -b:v 0 -threads 0 -speed 1 -tile-columns 4 -frame-parallel 1 \
-an \
-c:a libopus -b:a 128k -ar 48000 -ac 2 -af loudnorm \
-y "enhanced_${file%.*}.webm"
done
}
iperf-host() {
iperf3 -s
}
iperf-client() {
iperf3 -c "$1" -P 8 -t 10
}
poor_mans_scp_upload() {
local source_file="$1"
local target_user_at_host="$2"
Expand Down Expand Up @@ -1572,6 +1644,8 @@ zshrc_load_library() {
# Reset to default
echo -e "\033[0mDefault Text"
echo "Example: \\\\033[1;34mBold Blue Text\\\\033[0m (Reset)"
echo "To type an ANSI color code in Vim, use \`Ctrl+v Esc\`, then enter the digits"
# :help i_CTRL-V_digit
}
random_string() {
Expand All @@ -1587,9 +1661,30 @@ zshrc_load_library() {
ssh "$userAtHost" "/file add name=${key_filename} contents=\"$(cat ~/.ssh/id_rsa.pub)\"; /user ssh-keys import user=${user} public-key-file=${key_filename}; /file remove ${key_filename};"
}
mtik-exec() {
local mtik_host="${1:-rb3011}"
local script_path="${2}"
local script_name="$(basename "$script_path")"
# Create a temporary file to store our scripts.
ssh "$mtik_host" "/file/add type=directory name=scripts" > /dev/null
# Upload the script to the MikroTik router, under the scripts folder.
scp "$script_path" "$mtik_host:/scripts/$script_name"
# Connect to the MikroTik router and execute the script
ssh "$mtik_host" "/import scripts/$script_name"
}
rf-link() {
iw dev "$(iw dev | grep Interface | awk '{ print $2 }' | head -n1)" link
}
screen-rescale() {
local factor="$(zcalc -f -e "1 / ${1:-1}")"
local monitor="$(xrandr --listmonitors | awk '{ print $4}' | tail -n 1)"
xrandr --output "${monitor}" --scale "${factor}x${factor}"
}
}
zshrc_set_aliases() {
Expand Down
4 changes: 4 additions & 0 deletions config/ssh/config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Host entourage maxocull.com
ForwardX11 yes
ForwardX11Trusted yes

Host git.alanocull.com pi.alanocull.com git.maxocull.com
HostName git.alanocull.com
Port 2212

Host leviathan
HostName 192.168.1.11
#ProxyJump maxocull.com
Expand Down
16 changes: 12 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ case "$response" in
# AWS CLI Team
gpg --keyserver keyserver.ubuntu.com --receive-keys FB5DB77FD5C118B80511ADA8A6310ACC4672475C

# Github CLI: [email protected]
## You may need this:
## https://github.com/cli/cli/issues/9569
gpg --receive-keys 2C6106201985B60E6C7AC87323F3D4EA75716059

if [ -s /bin/zsh ]; then
if [[ ! "$SHELL" =~ "zsh" ]]; then
chsh -s /bin/zsh "${USER}"
Expand Down Expand Up @@ -842,8 +847,7 @@ case "$response" in
p7zip \
qalculate-gtk \
qemu \
rar \
yt-dlp
rar

brew install --cask \
brave-browser \
Expand Down Expand Up @@ -914,7 +918,6 @@ case "$response" in
if [[ -x "$(command -v yay)" ]]; then
yay -Syu "$AUTOMATED_PACMAN_FLAGS" \
brave-bin \
yt-dlp \
--needed
fi
elif [[ -x "$(command -v pkg)" ]]; then
Expand All @@ -931,7 +934,6 @@ case "$response" in
touchegg \
unrar \
veracrypt \
yt-dlp \
zathura \
zathura-pdf-mupdf
fi
Expand Down Expand Up @@ -966,6 +968,12 @@ case "$response" in
esac
fi

# Install yt-dlp, to nightly edition
if [[ ! -x "$(command -v yt-dlp)" ]]; then
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o ~/.local/bin/yt-dlp
chmod a+rx ~/.local/bin/yt-dlp
yt-dlp --update-to nightly
fi
;;
*)
echo "Skipping workstation utility installation"
Expand Down
20 changes: 20 additions & 0 deletions scripts/check-dns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

check_dns() {
domain=$1
authority=$2
nameserver=$3

printf "%s" "${authority}"
dig "$domain" "@${nameserver}" +tries=1
}

domain="www.maxocull.com"

check_dns "$domain" "Namecheap Free DNS" "dns1.registrar-servers.com"
check_dns "$domain" "Namecheap Premium DNS" "pdns1.registrar-servers.com"
check_dns "$domain" "Google" "8.8.8.8"
check_dns "$domain" "Quad9" "9.9.9.9"
check_dns "$domain" "Cloudflare" "1.1.1.1"
check_dns "$domain" "DuckDNS" "ns1.duckdns.org"
check_dns "$domain" "Local DNS" "192.168.1.1"
3 changes: 3 additions & 0 deletions scripts/mikrotik/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Mikrotik

- [Packet Flow Diagrams](https://help.mikrotik.com/docs/display/ROS/Packet+Flow+in+RouterOS)
Loading

0 comments on commit b0883bf

Please sign in to comment.