Scripts
Useful scripts, which make daily routine easy

Morning script (for MacOS)
Hereby I publish part of my morning script, which perform needed actions. The nature of this script, that it is all-time adjustable. 
 location 
 vi /Users/anton/dox-pvt/tech/scripts/start_general_env_on_mac.sh
 
 #!/bin/sh

#
# this is a morning script of Anton to launch morning environment on mac
#
# 2023-11-26 * migrated from start_general_env_on_mac.sh for general usage /A
# 2024-02-15 * small optimizations /A
# + workspace within MS Code /A
# + sync (mirror) Cloud KP DB to local storage /A
# 2024-02-17 + seasonal links /A
# 2024-02-22 + import media from pCloud/Automatic /A
# 2024-03-02 + profile backup to external drive /A
# 2024-04-04 + location section /A
# 2024-05-06 + pull_repos.sh /A
# 2024-10-29 * sync with -w profile /A
# 2024-11-30 - cleaning
# 2024-12-02 + Yubico Auth /A
# 2025-09-04 + Yandex Disk /A
# 2025-12-12 - trimmed before publishing /A
# 2026-03-17 * reviewed /A
#
#

# restart DNS service
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

echo "----------------------------------------[Location]-------------"
echo "External IP and location are:"
curl myip.2dz.fi
curl ifconfig.co
curl ifconfig.co/country
curl ifconfig.co/city
echo "----------------------------------------[Timezone]-------------"
sudo systemsetup -gettimezone
echo "---------------------------------------------------------------"

echo "Launching Yubico Authenticator for OTPs .."
open -a "Yubico Authenticator"

echo "Fix permissions on /Users/Shared, provide sudo pass"
sudo /Users/Shared/tech/scripts/fixperm.sh

echo "Connecting to Cloud Drives."
open -a Nextcloud
open -a "pCloud Drive"
open -a "Yandex.Disk.2.app"
read

# open token and password manager
open -a "Yubico Authenticator"
open -a KeePassXC "/Users/(path to kp)/pvt.kdbx"
echo "Open pCloud Crypto and open ALL password databases, which required. Press any key to continue ..."
read

# launch mail client
# open -a Mail
open -a Thunderbird

# open libraries
open -a Kindle
open -a Firefox https://mybook.ru
open -a Firefox https://books.yandex.ru/books

# other utilities
open -a Calendar
open -a BusyCal
# open -a Spotify
open -a "Яндекс Музыка"
open -a "Double Commander"
open -a "Visual Studio Code" "/Users/anton-pvt/dox-pvt/tech/workspaces/anton-pvt.code-workspace"

# open monitoring
open -a Firefox https://10.77.81.1/ui/diagnostics/systemhealth
open -a Firefox https://ici

# Start messengers
open -a Telegram
open -a Signal
open -a Slack

# repositories
# open -a GitAhead
# open -a sourcetree

# other seasonal links
open -a Firefox https://lcwo.net/callsigns/

# mirror KPxc DB from cloud to local storage
open -a FreeFileSync "/Users/(path to sync)/pCloud--ant1mbp3---kp-pvt.ffs_gui"

# import media from pCloud/Automatic and hub/pix2import
echo "\n\nImporting media from automatic uploades"
/Users/anton-pvt/dox-pvt/tech/scripts/import_media_from_pCloud_Automatic_Upload.sh
/Users/anton-pvt/dox-pvt/tech/scripts/import_media_from_hub.2dz.fi_pix-uploaded.sh

# pulling repos
echo "\n\nPulling repos"
/Users/anton-pvt/dox-pvt/tech/scripts/pull_repos.sh

# other tools

echo "Restoring permissions on backup drive before sync ..."
sudo /Volumes/00067-1T/fixperm.sh

echo "Backing up private profile to 000067-1T ..."
open -a FreeFileSync "/Volumes/00067-1T/ant1mbp3-anton-pvt--00067.ffs_gui"

echo "\n\nHave an excellent day!"
~
 
 final touch 
 chmod +x /Users/anton/dox-pvt/tech/scripts/start_general_env_on_mac.sh
/Users/anton/dox-pvt/tech/scripts/start_general_env_on_mac.sh

fixperm.sh for /Users/Shared
Usage of resources from several profiles: 
 /Users/Shared/tech/scripts/fixperm.sh
 
 #!/bin/bash

#
# This script will restore permissions on shared directories
#

#
# 2023-05-24 + init /A
# 2023-06-06 * changed to use 'find' /A
# 2023-10-22 + set executables to bash/python scripts /A
#

dir="/Users/Shared"

# for MacOS v13.3.1 (Ventura)
chgrp -R -v staff ${dir}

find ${dir} -type d -exec chmod 0770 {} \+
find ${dir} -type f -exec chmod 0660 {} \+
find ${dir} -name '*.sh' -type f -exec chmod 0770 {} \+
find ${dir} -name '*.py*' -type f -exec chmod 0770 {} \+