Initialize

This commit is contained in:
2025-04-27 03:50:20 +02:00
commit 50539b56ef
51 changed files with 2241 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
function _read_confirm
# Parse arguments
argparse --name _read_confirm 'p/prompt=' 'y/defaultyes' -- $argv or return
# If prompt not set, do a default
if test -z "$_flag_p"
set _flag_p "Continue?"
end
while true
# declare variable
set confirm ''
if test "$_flag_y"
read -p 'set_color green; echo -n "$_flag_p [Y/n]: "; set_color normal' -l temp_conf
# write to $confirm
set confirm "$temp_conf"
else
read -p 'set_color green; echo -n "$_flag_p [y/N]: "; set_color normal' -l temp_conf
set confirm "$temp_conf"
end
switch $confirm
case Y y
return 0
case N n
return 1
case ''
if test "$_flag_y"
return 0
else
return 1
end
end
end
end

View File

@@ -0,0 +1,18 @@
function update_mirrorlist
if not _read_confirm -p 'Are you sure you want to update your mirrorlist?' -d
return
end
sudo -v
echo "Backing up old mirrorlist"
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist_(date +%Y-%m-%d_%H-%M-%S).bak
echo "Generating new mirrorlist"
sudo reflector -c DE --protocol https --sort rate --latest 50 --download-timeout 5 --threads 5 --save /etc/pacman.d/mirrorlist
echo "Updating mirrors"
sudo pacman -Sy
echo Done
end

View File

@@ -0,0 +1,11 @@
function whoseturn
set start_date (date -d "2025-01-01" +%s)
set current_date (date +%s)
set days_passed (math floor\((math $current_date - $start_date) / 86400\))
if test (math $days_passed % 2) -eq 0
echo "Alex's turn"
else
echo "My turn"
end
end