Merge branch 'master' into laptop

This commit is contained in:
Thomas Avé 2024-03-16 00:32:38 +01:00
commit ff4f169779
6 changed files with 95 additions and 11 deletions

View File

@ -37,7 +37,7 @@ fi
################################################# #################################################
if $NVIM; then if $NVIM; then
dependencies="neovim git unzip fzf cmake gcc make curl wget ripgrep npm" dependencies="neovim git unzip fzf cmake gcc make curl wget ripgrep"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
$SUDO pacman -Sy --needed --noconfirm $dependencies npm go fd dotnet-sdk $SUDO pacman -Sy --needed --noconfirm $dependencies npm go fd dotnet-sdk
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
@ -45,14 +45,18 @@ if $NVIM; then
$SUDO apt install -y software-properties-common $SUDO apt install -y software-properties-common
$SUDO add-apt-repository ppa:neovim-ppa/unstable -y $SUDO add-apt-repository ppa:neovim-ppa/unstable -y
$SUDO curl -sL https://deb.nodesource.com/setup_21.x | $SUDO bash - $SUDO curl -sL https://deb.nodesource.com/setup_21.x | $SUDO bash -
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$SUDO dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
$SUDO apt update $SUDO apt update
$SUDO apt install -y $dependencies python3-venv nodejs golang fd-find $SUDO apt install -y $dependencies python3-venv python3-pip nodejs golang fd-find cargo dotnet-sdk-8.0
fi fi
ln -s "$PWD"/nvim "$XDG_CONFIG_HOME"/nvim ln -s "$PWD"/nvim "$XDG_CONFIG_HOME"/nvim
ln -s "$PWD"/clang/.clang-tidy "$HOME"/.clang-tidy ln -s "$PWD"/clang/.clang-tidy "$HOME"/.clang-tidy
nvim --headless "+Lazy! sync" +qa nvim --headless "+Lazy! sync" +qa
nvim --headless "+MasonInstall bash-language-server pyright typescript-language-server rust-analyzer clangd cmake-language-server css-lsp dockerfile-language-server emmet-ls gopls html-lsp jdtls json-lsp ltex-ls lua-language-server ruff-lsp rustfmt rustywind texlab vetur-vls vim-language-server yaml-language-server" +qa nvim --headless "+MasonInstall bash-language-server pyright typescript-language-server rust-analyzer clangd cmake-language-server css-lsp dockerfile-language-server emmet-ls gopls html-lsp jdtls json-lsp ltex-ls lua-language-server ruff-lsp rustfmt rustywind texlab vetur-vls vim-language-server yaml-language-server csharp-language-server typst-lsp" +qa
fi fi

View File

@ -250,6 +250,7 @@ return {
}, },
} }
local filetypes = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst", "mail" }
require('lspconfig').ltex.setup { require('lspconfig').ltex.setup {
capabilities = capabilities, capabilities = capabilities,
on_attach = function(_, _) on_attach = function(_, _)
@ -260,11 +261,11 @@ return {
end, end,
settings = { settings = {
ltex = { ltex = {
enabled = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst" }, enabled = filetypes,
language = "en-GB" language = "en-GB"
}, },
}, },
filetypes = { "bib", "gitcommit", "markdown", "org", "plaintex", "rst", "rnoweb", "tex", "pandoc", "quarto", "rmd", "context", "html", "xhtml" , "typst"} filetypes = filetypes
} }
vim.diagnostic.config({ vim.diagnostic.config({

View File

@ -19,6 +19,9 @@ return {
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
config = function(_, opts) config = function(_, opts)
local notes_path = (os.getenv "HOME") .. "/Workspace/Notes" local notes_path = (os.getenv "HOME") .. "/Workspace/Notes"
if vim.fn.isdirectory(notes_path) == 0 then
return
end
local scan = require("plenary.scandir").scan_dir(notes_path, {add_dirs = true, depth = 1 }) local scan = require("plenary.scandir").scan_dir(notes_path, {add_dirs = true, depth = 1 })
local found = false local found = false
for _, v in ipairs(scan) do for _, v in ipairs(scan) do

47
scripts/cronic Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
# Cronic v3 - cron job report wrapper
# Copyright 2007-2016 Chuck Houpt. No rights reserved, whatsoever.
# Public Domain CC0: http://creativecommons.org/publicdomain/zero/1.0/
set -eu
TMP=$(mktemp -d)
OUT=$TMP/cronic.out
ERR=$TMP/cronic.err
TRACE=$TMP/cronic.trace
set +e
"$@" >$OUT 2>$TRACE
RESULT=$?
set -e
PATTERN="^${PS4:0:1}\\+${PS4:1}"
if grep -aq "$PATTERN" $TRACE
then
! grep -av "$PATTERN" $TRACE > $ERR
else
ERR=$TRACE
fi
if [ $RESULT -ne 0 ]
then
echo "Cronic detected failure or error output for the command:"
echo "$@"
echo
echo "RESULT CODE: $RESULT"
echo
echo "ERROR OUTPUT:"
cat "$ERR"
echo
echo "STANDARD OUTPUT:"
cat "$OUT"
if [ $TRACE != $ERR ]
then
echo
echo "TRACE-ERROR OUTPUT:"
cat "$TRACE"
fi
fi
rm -rf "$TMP"

15
scripts/disk_check.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
REPORT_EMAIL=email@thomasave.be
ZPOOL_STATUS=`zpool status -x`
if [ "$ZPOOL_STATUS" = "all pools are healthy" -o "$ZPOOL_STATUS" = "no pools available" ]
then
echo -n 0 > /var/db/zpool.status
else
if [ `cat /var/db/zpool.status` -eq 0 ]
then
zpool status | mail -s "ZPOOL NOT HEALTHY" $REPORT_EMAIL
echo -n 1 > /var/db/zpool.status
fi
fi

View File

@ -90,12 +90,19 @@ function zvm_after_init() {
# Use FZY instead of FZF for ctrl-t # Use FZY instead of FZF for ctrl-t
function find_files() { function find_files() {
zle -I zle -I
# Check if ~/Containers exists PATHS=$(fd -H . /home/server/Workspace -t d -d 5)
if [ -d ~/Containers ]; then if [ -d ~/Containers ]; then
BUFFER=cd "$(fd -H . ~/Workspace ~/Containers -t d | fzy -l 20)" PATHS="$PATHS\n$(fd -H . ~/Containers -t d -d 2)"
else
BUFFER=cd "$(fd -H . ~/Workspace -t d | fzy -l 20)"
fi fi
if [ -d /RAID/10/Shared\ Storage/ ]; then
PATHS="$PATHS\n/RAID/10/Shared Storage/Thomas"
PATHS="$PATHS\n$(fd -H . /RAID/10/Shared\ Storage -t d -d 2)"
fi
if [ -d /RAID/10/Private\ Storage/Thomas ]; then
PATHS="$PATHS\n/RAID/10/Private Storage/Thomas"
PATHS="$PATHS\n$(fd -H . /RAID/10/Private\ Storage/Thomas -t d -d 1)"
fi
BUFFER=cd "$(echo $PATHS | fzy -l 20)"
zle accept-line zle accept-line
clear clear
} }
@ -169,6 +176,10 @@ function o () {
xdg-open "$1" &! xdg-open "$1" &!
} }
function s() {
ssh server@mallorea -t "cd \"$(pwd)\" ; zsh --login"
}
if [ "$SSH_CLIENT" ] if [ "$SSH_CLIENT" ]
then then
source_port=$(echo $SSH_CLIENT | awk '{ print $2 }') source_port=$(echo $SSH_CLIENT | awk '{ print $2 }')
@ -181,6 +192,9 @@ if [[ "$TERM" == (Eterm*|alacritty*|aterm*|gnome*|konsole*|kterm*|putty*|rxvt*|s
fi fi
# Aliases # Aliases
if command -v fdfind &> /dev/null; then
alias fd="fdfind"
fi
alias ls="ls --color=auto" alias ls="ls --color=auto"
alias gdb='gdb -q' alias gdb='gdb -q'
alias ll='ls -lhat' alias ll='ls -lhat'
@ -192,8 +206,8 @@ alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts"
alias xbindkeys="xbindkeys -f $XDG_CONFIG_HOME/xbindkeys/config" alias xbindkeys="xbindkeys -f $XDG_CONFIG_HOME/xbindkeys/config"
alias python=python3 alias python=python3
alias r=". ranger" alias r=". ranger"
alias cpr=rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 alias cpr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1"
alias mvr=rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files alias mvr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files"
alias rg="rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'" alias rg="rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'"
alias ag="rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'" alias ag="rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'"
alias push="git add -A && git commit -m '`date`' && git push" alias push="git add -A && git commit -m '`date`' && git push"