machineconfig 1.94__py3-none-any.whl → 1.95__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of machineconfig might be problematic. Click here for more details.

Files changed (120) hide show
  1. machineconfig/cluster/data_transfer.py +2 -1
  2. machineconfig/cluster/job_params.py +1 -1
  3. machineconfig/cluster/script_execution.py +1 -1
  4. machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
  5. machineconfig/jobs/linux/msc/lid.sh +2 -4
  6. machineconfig/jobs/linux/msc/network.sh +3 -6
  7. machineconfig/jobs/python/check_installations.py +6 -6
  8. machineconfig/jobs/python/checkout_version.py +4 -4
  9. machineconfig/jobs/python/python_cargo_build_share.py +2 -2
  10. machineconfig/jobs/python/python_ve_symlink.py +4 -4
  11. machineconfig/jobs/python/vscode/api.py +2 -2
  12. machineconfig/jobs/python/vscode/link_ve.py +4 -4
  13. machineconfig/jobs/python/vscode/select_interpreter.py +4 -4
  14. machineconfig/jobs/python/vscode/sync_code.py +6 -6
  15. machineconfig/jobs/python_custom_installers/archive/ngrok.py +4 -4
  16. machineconfig/jobs/python_custom_installers/dev/aider.py +4 -4
  17. machineconfig/jobs/python_custom_installers/dev/alacritty.py +4 -4
  18. machineconfig/jobs/python_custom_installers/dev/brave.py +4 -4
  19. machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +4 -4
  20. machineconfig/jobs/python_custom_installers/dev/code.py +4 -4
  21. machineconfig/jobs/python_custom_installers/dev/docker.py +4 -4
  22. machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +4 -4
  23. machineconfig/jobs/python_custom_installers/dev/espanso.py +8 -8
  24. machineconfig/jobs/python_custom_installers/dev/goes.py +4 -4
  25. machineconfig/jobs/python_custom_installers/dev/lvim.py +4 -4
  26. machineconfig/jobs/python_custom_installers/dev/nerdfont.py +4 -4
  27. machineconfig/jobs/python_custom_installers/dev/redis.py +4 -4
  28. machineconfig/jobs/python_custom_installers/dev/warp-cli.py +4 -4
  29. machineconfig/jobs/python_custom_installers/dev/wezterm.py +4 -4
  30. machineconfig/jobs/python_custom_installers/gh.py +6 -6
  31. machineconfig/jobs/python_custom_installers/hx.py +28 -58
  32. machineconfig/jobs/python_custom_installers/scripts/linux/brave.sh +4 -8
  33. machineconfig/jobs/python_custom_installers/scripts/linux/docker.sh +5 -10
  34. machineconfig/jobs/python_custom_installers/scripts/linux/docker_start.sh +3 -6
  35. machineconfig/jobs/python_custom_installers/scripts/linux/edge.sh +3 -6
  36. machineconfig/jobs/python_custom_installers/scripts/linux/nerdfont.sh +5 -10
  37. machineconfig/jobs/python_custom_installers/scripts/linux/pgsql.sh +4 -8
  38. machineconfig/jobs/python_custom_installers/scripts/linux/redis.sh +5 -10
  39. machineconfig/jobs/python_custom_installers/scripts/linux/timescaledb.sh +6 -12
  40. machineconfig/jobs/python_custom_installers/scripts/linux/vscode.sh +9 -8
  41. machineconfig/jobs/python_custom_installers/scripts/linux/warp-cli.sh +5 -10
  42. machineconfig/jobs/python_custom_installers/scripts/linux/wezterm.sh +3 -6
  43. machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  44. machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
  45. machineconfig/profile/shell.py +26 -47
  46. machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
  47. machineconfig/scripts/cloud/init.sh +9 -18
  48. machineconfig/scripts/linux/fire +5 -24
  49. machineconfig/scripts/linux/share_cloud.sh +6 -12
  50. machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
  51. machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
  52. machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
  53. machineconfig/scripts/python/__pycache__/cloud_repo_sync.cpython-311.pyc +0 -0
  54. machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
  55. machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
  56. machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
  57. machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
  58. machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
  59. machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
  60. machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
  61. machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
  62. machineconfig/scripts/python/archive/im2text.py +30 -30
  63. machineconfig/scripts/python/archive/tmate_conn.py +10 -13
  64. machineconfig/scripts/python/archive/tmate_start.py +12 -16
  65. machineconfig/scripts/python/choose_wezterm_theme.py +9 -18
  66. machineconfig/scripts/python/cloud_copy.py +38 -93
  67. machineconfig/scripts/python/cloud_manager.py +61 -53
  68. machineconfig/scripts/python/cloud_mount.py +23 -34
  69. machineconfig/scripts/python/cloud_repo_sync.py +20 -69
  70. machineconfig/scripts/python/cloud_sync.py +35 -45
  71. machineconfig/scripts/python/croshell.py +48 -73
  72. machineconfig/scripts/python/devops.py +50 -104
  73. machineconfig/scripts/python/devops_add_identity.py +41 -101
  74. machineconfig/scripts/python/devops_add_ssh_key.py +33 -140
  75. machineconfig/scripts/python/devops_backup_retrieve.py +23 -112
  76. machineconfig/scripts/python/devops_devapps_install.py +0 -4
  77. machineconfig/scripts/python/devops_update_repos.py +1 -1
  78. machineconfig/scripts/python/fire_jobs.py +73 -25
  79. machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
  80. machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
  81. machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
  82. machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
  83. machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
  84. machineconfig/scripts/python/helpers/cloud_helpers.py +37 -34
  85. machineconfig/scripts/python/helpers/helpers2.py +17 -31
  86. machineconfig/scripts/python/helpers/repo_sync_helpers.py +19 -54
  87. machineconfig/scripts/python/pomodoro.py +1 -1
  88. machineconfig/scripts/python/repos.py +49 -34
  89. machineconfig/scripts/python/wifi_conn.py +5 -3
  90. machineconfig/scripts/windows/fire.ps1 +27 -15
  91. machineconfig/settings/__pycache__/__init__.cpython-311.pyc +0 -0
  92. machineconfig/settings/shells/ipy/profiles/default/__pycache__/__init__.cpython-311.pyc +0 -0
  93. machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/__init__.cpython-311.pyc +0 -0
  94. machineconfig/settings/shells/ipy/profiles/default/startup/__pycache__/playext.cpython-311.pyc +0 -0
  95. machineconfig/setup_linux/nix/cli_installation.sh +9 -18
  96. machineconfig/setup_linux/others/openssh-server_add_pub_key.sh +3 -6
  97. machineconfig/setup_linux/web_shortcuts/all.sh +5 -10
  98. machineconfig/setup_linux/web_shortcuts/ascii_art.sh +7 -14
  99. machineconfig/setup_linux/web_shortcuts/croshell.sh +6 -12
  100. machineconfig/setup_linux/web_shortcuts/interactive.sh +34 -68
  101. machineconfig/setup_linux/web_shortcuts/ssh.sh +8 -16
  102. machineconfig/setup_linux/web_shortcuts/update_system.sh +7 -14
  103. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +16 -12
  104. machineconfig/utils/ai/browser_user_wrapper.py +60 -45
  105. machineconfig/utils/ai/generate_file_checklist.py +4 -7
  106. machineconfig/utils/ai/url2md.py +13 -5
  107. machineconfig/utils/{utils_code.py → code.py} +4 -10
  108. machineconfig/utils/installer.py +4 -10
  109. machineconfig/utils/{utils_links.py → links.py} +9 -20
  110. machineconfig/utils/{utils_options.py → options.py} +10 -20
  111. machineconfig/utils/{utils_path.py → path.py} +28 -80
  112. machineconfig/utils/procs.py +26 -30
  113. machineconfig/utils/scheduling.py +11 -11
  114. machineconfig/utils/utils.py +12 -19
  115. machineconfig/utils/ve.py +5 -21
  116. machineconfig/utils/ve_utils/ve2.py +15 -2
  117. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/METADATA +4 -2
  118. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/RECORD +120 -118
  119. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/WHEEL +1 -1
  120. {machineconfig-1.94.dist-info → machineconfig-1.95.dist-info}/top_level.txt +0 -0
@@ -5,8 +5,12 @@
5
5
  # This script installs Visual Studio Code on Ubuntu/Debian-based Linux distributions
6
6
  # Reference: https://code.visualstudio.com/docs/setup/linux
7
7
 
8
- echo """
9
- #=======================================================================
8
+ # sudo rm /etc/apt/sources.list.d/vscode.sources
9
+ # sudo apt-get update
10
+
11
+
12
+
13
+ echo """#=======================================================================
10
14
  🔑 ADDING REPOSITORY KEYS | Setting up Microsoft repository
11
15
  #=======================================================================
12
16
  """
@@ -29,8 +33,7 @@ else
29
33
  echo "✅ VS Code repository already configured"
30
34
  fi
31
35
 
32
- echo """
33
- #=======================================================================
36
+ echo """#=======================================================================
34
37
  📦 INSTALLING VS CODE | Updating and installing packages
35
38
  #=======================================================================
36
39
  """
@@ -43,8 +46,7 @@ sudo nala update -o Dir::Etc::sourcelist="sources.list.d/vscode.list" -o Dir::Et
43
46
  echo "📥 Installing Visual Studio Code..."
44
47
  sudo nala install code -y
45
48
 
46
- echo """
47
- #=======================================================================
49
+ echo """#=======================================================================
48
50
  🔄 CHECKING FOR VS CODE INSIDERS | Updating if installed
49
51
  #=======================================================================
50
52
  """
@@ -57,8 +59,7 @@ else
57
59
  echo "ℹ️ VS Code Insiders not installed, skipping"
58
60
  fi
59
61
 
60
- echo """
61
- #=======================================================================
62
+ echo """#=======================================================================
62
63
  ✅ INSTALLATION COMPLETE | VS Code has been installed successfully
63
64
  #=======================================================================
64
65
  """
@@ -5,8 +5,7 @@
5
5
  # This script installs Cloudflare WARP client on Ubuntu/Debian-based Linux distributions
6
6
  # Reference: https://pkg.cloudflareclient.com/
7
7
 
8
- echo """
9
- #=======================================================================
8
+ echo """#=======================================================================
10
9
  🔍 DETECTING SYSTEM | Identifying OS distribution version
11
10
  #=======================================================================
12
11
  """
@@ -28,8 +27,7 @@ get_ubuntu_base_version() {
28
27
  ubuntu_version=$(get_ubuntu_base_version)
29
28
  echo "📋 Detected distribution: $ubuntu_version"
30
29
 
31
- echo """
32
- #=======================================================================
30
+ echo """#=======================================================================
33
31
  🔑 ADDING REPOSITORY KEYS | Setting up Cloudflare repository
34
32
  #=======================================================================
35
33
  """
@@ -42,8 +40,7 @@ curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmo
42
40
  echo "📝 Adding Cloudflare WARP repository to sources list..."
43
41
  echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $ubuntu_version main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
44
42
 
45
- echo """
46
- #=======================================================================
43
+ echo """#=======================================================================
47
44
  📦 INSTALLING CLOUDFLARE WARP | Updating and installing packages
48
45
  #=======================================================================
49
46
  """
@@ -56,8 +53,7 @@ sudo nala update
56
53
  echo "📥 Installing Cloudflare WARP..."
57
54
  sudo nala install cloudflare-warp -y
58
55
 
59
- echo """
60
- #=======================================================================
56
+ echo """#=======================================================================
61
57
  🔧 REGISTERING WARP CLIENT | Setting up new registration
62
58
  #=======================================================================
63
59
  """
@@ -66,8 +62,7 @@ echo """
66
62
  echo "📡 Registering WARP client..."
67
63
  warp-cli registration new
68
64
 
69
- echo """
70
- #=======================================================================
65
+ echo """#=======================================================================
71
66
  ✅ INSTALLATION COMPLETE | Cloudflare WARP has been installed successfully
72
67
  #=======================================================================
73
68
  """
@@ -5,8 +5,7 @@
5
5
  # This script installs WezTerm terminal emulator on Ubuntu/Debian-based Linux distributions
6
6
  # Reference: https://wezfurlong.org/wezterm/install/linux.html
7
7
 
8
- echo """
9
- #=======================================================================
8
+ echo """#=======================================================================
10
9
  🔑 ADDING REPOSITORY KEYS | Setting up WezTerm repository
11
10
  #=======================================================================
12
11
  """
@@ -19,8 +18,7 @@ curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/sh
19
18
  echo "📝 Adding WezTerm repository to sources list..."
20
19
  echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
21
20
 
22
- echo """
23
- #=======================================================================
21
+ echo """#=======================================================================
24
22
  📦 INSTALLING WEZTERM | Updating and installing packages
25
23
  #=======================================================================
26
24
  """
@@ -33,8 +31,7 @@ sudo nala update
33
31
  echo "📥 Installing WezTerm terminal emulator..."
34
32
  sudo nala install wezterm -y
35
33
 
36
- echo """
37
- #=======================================================================
34
+ echo """#=======================================================================
38
35
  ✅ INSTALLATION COMPLETE | WezTerm has been installed successfully
39
36
  #=======================================================================
40
37
  """
@@ -8,10 +8,15 @@ from crocodile.meta import Terminal
8
8
  from machineconfig.utils.utils import LIBRARY_ROOT, REPO_ROOT, display_options
9
9
  import platform
10
10
  from typing import Optional
11
+ from rich.console import Console
12
+ from rich.panel import Panel
11
13
 
12
14
 
13
15
  system = platform.system()
14
16
 
17
+ console = Console()
18
+ BOX_WIDTH = 100 # Define BOX_WIDTH or get it from a config
19
+
15
20
  # --------------------------------------- SHELL PROFILE --------------------------------------------------------
16
21
  # modification of shell profile by additing dirs to PATH
17
22
  # Shell profile is either in dotfiles and is synced (as in Windows), hence no need for update, or is updated on the fly (for Linux)
@@ -25,25 +30,17 @@ def create_default_shell_profile():
25
30
  else: source = f"source {LIBRARY_ROOT.joinpath('settings/shells/bash/init.sh').collapseuser().to_str().replace('~', '$HOME')}"
26
31
 
27
32
  if source in profile:
28
- print(f"""
29
- ╭{'─' * 78}╮
30
- │ 🔄 PROFILE | Skipping init script sourcing - already present in profile │
31
- ╰{'─' * 78}╯
32
- """)
33
+ console.print(Panel("🔄 PROFILE | Skipping init script sourcing - already present in profile", title="[bold blue]Profile[/bold blue]", border_style="blue"))
33
34
  else:
34
- print(f"""
35
- ╭{'─' * 78}╮
36
- │ 📝 PROFILE | Adding init script sourcing to profile │
37
- ╰{'─' * 78}╯
38
- """)
35
+ console.print(Panel("📝 PROFILE | Adding init script sourcing to profile", title="[bold blue]Profile[/bold blue]", border_style="blue"))
39
36
  profile += "\n" + source + "\n"
40
37
  if system == "Linux":
41
38
  res = Terminal().run("cat /proc/version").op
42
39
  if "microsoft" in res.lower() or "wsl" in res.lower():
43
40
  profile += "\ncd ~" # this is to make sure that the current dir is not in the windows file system, which is terribly slow and its a bad idea to be there anyway.
44
- print("📌 WSL detected - adding 'cd ~' to profile to avoid Windows filesystem")
41
+ console.print("📌 WSL detected - adding 'cd ~' to profile to avoid Windows filesystem")
45
42
  profile_path.create(parents_only=True).write_text(profile)
46
- print("✅ Profile updated successfully")
43
+ console.print(Panel("✅ Profile updated successfully", title="[bold blue]Profile[/bold blue]", border_style="blue"))
47
44
 
48
45
 
49
46
  def get_shell_profile_path():
@@ -56,12 +53,7 @@ def get_shell_profile_path():
56
53
  raise ValueError(f"Could not get profile path for Windows. Got {res}")
57
54
  elif system == "Linux": profile_path = P("~/.bashrc").expanduser()
58
55
  else: raise ValueError(f"Not implemented for this system {system}")
59
-
60
- print(f"""
61
- ╔{'═' * 78}╗
62
- ║ 🐚 SHELL PROFILE | Working with path: `{profile_path}`
63
- ╚{'═' * 78}╝
64
- """)
56
+ console.print(Panel(f"🐚 SHELL PROFILE | Working with path: `{profile_path}`", title="[bold blue]Shell Profile[/bold blue]", border_style="blue"))
65
57
  return profile_path
66
58
 
67
59
 
@@ -69,12 +61,7 @@ def main_env_path(choice: Optional[str] = None, profile_path: Optional[str] = No
69
61
  env_path = LIBRARY_ROOT.joinpath("profile/env_path.toml").readit()
70
62
  dirs = env_path[f'path_{system.lower()}']['extension']
71
63
 
72
- print(f"""
73
- ╔{'═' * 78}╗
74
- ║ 🔍 ENVIRONMENT | Current PATH variables:
75
- ╚{'═' * 78}╝
76
- """)
77
- P.get_env().PATH.print()
64
+ console.print(Panel("🔍 ENVIRONMENT | Current PATH variables:", title="[bold blue]Environment[/bold blue]", border_style="blue"))
78
65
 
79
66
  if choice is None:
80
67
  tmp = display_options(msg="Which directory to add?", options=dirs + ["all", "none(EXIT)"], default="none(EXIT)")
@@ -83,23 +70,19 @@ def main_env_path(choice: Optional[str] = None, profile_path: Optional[str] = No
83
70
  if str(choice) != "all": dirs = [choice]
84
71
  if choice == "none(EXIT)": return
85
72
 
86
- print(f"\n📌 Adding directories to PATH: {dirs}")
73
+ console.print(f"\n📌 Adding directories to PATH: {dirs}")
87
74
  addition = PathVar.append_temporarily(dirs=dirs)
88
75
  profile_path_obj = P(profile_path) if isinstance(profile_path, str) else get_shell_profile_path()
89
76
  profile_path_obj.copy(name=profile_path_obj.name + ".orig_" + randstr())
90
- print(f"💾 Created backup of profile: {profile_path_obj.name}.orig_*")
77
+ console.print(f"💾 Created backup of profile: {profile_path_obj.name}.orig_*")
91
78
  profile_path_obj.modify_text(addition, addition, replace_line=False, notfound_append=True)
92
- print("✅ PATH variables added to profile successfully")
79
+ console.print(Panel("✅ PATH variables added to profile successfully", title="[bold blue]Environment[/bold blue]", border_style="blue"))
93
80
 
94
81
 
95
82
  def main_add_sources_to_shell_profile(profile_path: Optional[str] = None, choice: Optional[str] = None):
96
83
  sources: list[str] = LIBRARY_ROOT.joinpath("profile/sources.toml").readit()[system.lower()]['files']
97
84
 
98
- print(f"""
99
- ╭{'─' * 78}╮
100
- │ 🔄 Adding sources to shell profile │
101
- ╰{'─' * 78}╯
102
- """)
85
+ console.print(Panel("🔄 Adding sources to shell profile", title="[bold blue]Sources[/bold blue]", border_style="blue"))
103
86
 
104
87
  if choice is None:
105
88
  choice_obj = display_options(msg="Which patch to add?", options=sources + ["all", "none(EXIT)"], default="none(EXIT)", multi=True)
@@ -123,26 +106,22 @@ def main_add_sources_to_shell_profile(profile_path: Optional[str] = None, choice
123
106
  if file not in profile:
124
107
  if system == "Windows":
125
108
  profile += f"\n. {file}"
126
- print(f"➕ Added PowerShell source: {file}")
109
+ console.print(f"➕ Added PowerShell source: {file}")
127
110
  elif system == "Linux":
128
111
  profile += f"\nsource {file}"
129
- print(f"➕ Added Bash source: {file}")
112
+ console.print(f"➕ Added Bash source: {file}")
130
113
  else: raise ValueError(f"Not implemented for this system {system}")
131
114
  else:
132
- print(f"⏭️ Source already present: {file}")
115
+ console.print(f"⏭️ Source already present: {file}")
133
116
 
134
117
  profile_path_obj.write_text(profile)
135
- print("✅ Shell profile updated with sources")
118
+ console.print(Panel("✅ Shell profile updated with sources", title="[bold blue]Sources[/bold blue]", border_style="blue"))
136
119
 
137
120
 
138
121
  def main_add_patches_to_shell_profile(profile_path: Optional[str] = None, choice: Optional[str] = None):
139
122
  patches: list[str] = list(LIBRARY_ROOT.joinpath(f"profile/patches/{system.lower()}").search().apply(lambda x: x.as_posix()))
140
123
 
141
- print(f"""
142
- ╭{'─' * 78}╮
143
- │ 🩹 Adding patches to shell profile │
144
- ╰{'─' * 78}╯
145
- """)
124
+ console.print(Panel("🩹 Adding patches to shell profile", title="[bold blue]Patches[/bold blue]", border_style="blue"))
146
125
 
147
126
  if choice is None:
148
127
  choice_chosen = display_options(msg="Which patch to add?", options=list(patches) + ["all", "none(EXIT)"], default="none(EXIT)", multi=False)
@@ -150,10 +129,10 @@ def main_add_patches_to_shell_profile(profile_path: Optional[str] = None, choice
150
129
  choice = choice_chosen
151
130
  if choice == "none(EXIT)": return None
152
131
  elif str(choice) == "all":
153
- print("📌 Adding all patches to profile")
132
+ console.print("📌 Adding all patches to profile")
154
133
  else:
155
134
  patches = [choice]
156
- print(f"📌 Adding selected patch: {choice}")
135
+ console.print(f"📌 Adding selected patch: {choice}")
157
136
 
158
137
  profile_path_obj = P(profile_path) if isinstance(profile_path, str) else get_shell_profile_path()
159
138
  profile = profile_path_obj.read_text()
@@ -162,19 +141,19 @@ def main_add_patches_to_shell_profile(profile_path: Optional[str] = None, choice
162
141
  patch_path_obj = P(patch_path)
163
142
  patch = patch_path_obj.read_text()
164
143
  if patch in profile:
165
- print(f"⏭️ Patch already present: {patch_path_obj.name}")
144
+ console.print(f"⏭️ Patch already present: {patch_path_obj.name}")
166
145
  else:
167
146
  profile += "\n" + patch
168
- print(f"➕ Added patch: {patch_path_obj.name}")
147
+ console.print(f"➕ Added patch: {patch_path_obj.name}")
169
148
 
170
149
  if system == "Linux":
171
150
  res = Terminal().run("cat /proc/version").op
172
151
  if "microsoft" in res.lower() or "wsl" in res.lower():
173
152
  profile += "\ncd ~" # this is to make sure that the current dir is not in the windows file system, which is terribly slow and its a bad idea to be there anyway.
174
- print("📌 WSL detected - adding 'cd ~' to profile to avoid Windows filesystem")
153
+ console.print("📌 WSL detected - adding 'cd ~' to profile to avoid Windows filesystem")
175
154
 
176
155
  profile_path_obj.write_text(profile)
177
- print("✅ Shell profile updated with patches")
156
+ console.print(Panel("✅ Shell profile updated with patches", title="[bold blue]Patches[/bold blue]", border_style="blue"))
178
157
 
179
158
 
180
159
  if __name__ == '__main__':
@@ -4,16 +4,14 @@
4
4
  #=======================================================================
5
5
  # This script initializes cloud configuration settings and sets up the environment
6
6
 
7
- echo """
8
- #=======================================================================
7
+ echo """#=======================================================================
9
8
  🔑 COLLECTING CONFIGURATION PARAMETERS | Setting up cloud environment
10
9
  #=======================================================================
11
10
  """
12
11
 
13
12
  # Check for required environment variables and prompt if not set
14
13
  if [ -z "$CLOUD_CONFIG_NAME" ]; then
15
- echo """
16
- #-----------------------------------------------------------------------
14
+ echo """ #-----------------------------------------------------------------------
17
15
  📋 CONFIG NAME | Specify cloud configuration to run
18
16
  #-----------------------------------------------------------------------
19
17
  """
@@ -23,8 +21,7 @@ if [ -z "$CLOUD_CONFIG_NAME" ]; then
23
21
  fi
24
22
 
25
23
  if [ -z "$SHARE_URL" ]; then
26
- echo """
27
- #-----------------------------------------------------------------------
24
+ echo """ #-----------------------------------------------------------------------
28
25
  🔗 SHARE URL | Provide cloud share URL for configuration files
29
26
  #-----------------------------------------------------------------------
30
27
  ℹ️ To get share_url, go to dotfiles and run: cloud_copy . :^ --config ss
@@ -35,8 +32,7 @@ if [ -z "$SHARE_URL" ]; then
35
32
  fi
36
33
 
37
34
  if [ -z "$DECRYPTION_PASSWORD" ]; then
38
- echo """
39
- #-----------------------------------------------------------------------
35
+ echo """ #-----------------------------------------------------------------------
40
36
  🔒 SECURITY | Enter decryption password
41
37
  #-----------------------------------------------------------------------
42
38
  """
@@ -45,8 +41,7 @@ if [ -z "$DECRYPTION_PASSWORD" ]; then
45
41
  echo ""
46
42
  fi
47
43
 
48
- echo """
49
- #=======================================================================
44
+ echo """#=======================================================================
50
45
  📦 INSTALLING ESSENTIALS | Setting up core dependencies
51
46
  #=======================================================================
52
47
  """
@@ -70,8 +65,7 @@ echo "🚀 Activating Python virtual environment..."
70
65
  echo "📋 Setting up code repositories..."
71
66
  curl bit.ly/cfgreposlinux -L | bash
72
67
 
73
- echo """
74
- #=======================================================================
68
+ echo """#=======================================================================
75
69
  ⚙️ CONFIGURING ENVIRONMENT | Setting up dotfiles
76
70
  #=======================================================================
77
71
  """
@@ -93,8 +87,7 @@ source ~/code/machineconfig/src/machineconfig/setup_linux/symlinks.sh
93
87
  echo "🔄 Reloading shell configuration..."
94
88
  . ~/.bashrc
95
89
 
96
- echo """
97
- #=======================================================================
90
+ echo """#=======================================================================
98
91
  📦 INSTALLING DEVELOPMENT TOOLS | Setting up development environment
99
92
  #=======================================================================
100
93
  """
@@ -111,8 +104,7 @@ python -m fire machineconfig.scripts.python.devops_devapps_install main --which=
111
104
  echo "🔄 Reloading shell configuration..."
112
105
  . ~/.bashrc
113
106
 
114
- echo """
115
- #=======================================================================
107
+ echo """#=======================================================================
116
108
  ✅ FINALIZING CONFIGURATION | Running cloud-specific initialization
117
109
  #=======================================================================
118
110
  """
@@ -121,8 +113,7 @@ echo """
121
113
  echo "⚙️ Running cloud-specific configuration: $CLOUD_CONFIG_NAME"
122
114
  . $HOME/dotfiles/config/cloud/$CLOUD_CONFIG_NAME/init.sh
123
115
 
124
- echo """
125
- #=======================================================================
116
+ echo """#=======================================================================
126
117
  ✅ INITIALIZATION COMPLETE | Cloud environment has been set up successfully
127
118
  #=======================================================================
128
119
  """
@@ -2,38 +2,20 @@
2
2
 
3
3
  . $HOME/scripts/activate_ve 've'
4
4
 
5
- op_script=$HOME/tmp_results/shells/python_return_command.sh
6
-
7
- # echo "May be removing $op_script"
8
- # sleep 1
5
+ # Generate random string of length 5
6
+ random_str=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1)
7
+ export op_script=$HOME/tmp_results/shells/$random_str/python_return_command.sh
8
+ # op_script=$HOME/tmp_results/shells/$random_str/python_return_command.sh
9
9
 
10
10
  if [ -f "$op_script" ]; then
11
11
  rm $op_script
12
12
  fi
13
13
 
14
14
 
15
- # if [ "$TERM" = "xterm-256color" ] || [ "$TERM" = "alacritty" ]; then
16
- # {
17
- # chafa "$HOME/code/machineconfig/assets/aafire.webp" --speed 1 --duration 1 --symbols ascii
18
- # } || {
19
- # echo "An error occurred while executing the script."
20
- # }
21
- # fi
22
-
23
- # timeout 0.5s aafire # -driver slang
24
- # clear
25
-
26
- # python $(dirname $(dirname $0))/python/fire_jobs.py "$@"
27
- # echo "Firing script preprocessor"
28
- # sleep 1
29
-
30
15
  python -m machineconfig.scripts.python.fire_jobs "$@"
31
- # ~/venvs/ve/bin/python -m machineconfig.scripts.python.fire_jobs "$@"
32
16
 
33
17
  if [ -f "$op_script" ]; then
34
- # echo "Executing $op_script"
35
- # sleep 1
36
-
18
+ echo "Running $op_script"
37
19
  chmod +x $op_script
38
20
  set -- # clear all positional parameters
39
21
  source $op_script # sourcing the script means the args passed to the this script are passed to the sourced script which cofuses the sources script as it contains activate_ve and it doesn't understand first.sh arguments.
@@ -42,5 +24,4 @@ fi
42
24
 
43
25
  if [ -n "$VIRTUAL_ENV" ]; then
44
26
  deactivate || true
45
-
46
27
  fi
@@ -7,8 +7,7 @@
7
7
 
8
8
  # Check if arguments are provided
9
9
  if [ $# -eq 0 ]; then
10
- echo """
11
- #=======================================================================
10
+ echo """ #=======================================================================
12
11
  ❌ ERROR | No arguments specified
13
12
  #=======================================================================
14
13
 
@@ -27,8 +26,7 @@ if tty -s; then
27
26
 
28
27
  # Check if the file exists
29
28
  if [ ! -e "$file" ]; then
30
- echo """
31
- #=======================================================================
29
+ echo """ #=======================================================================
32
30
  ❌ ERROR | File not found
33
31
  #=======================================================================
34
32
 
@@ -37,8 +35,7 @@ if tty -s; then
37
35
  return 1
38
36
  fi
39
37
 
40
- echo """
41
- #=======================================================================
38
+ echo """ #=======================================================================
42
39
  📤 UPLOADING | Sharing file to transfer.sh
43
40
  #=======================================================================
44
41
  """
@@ -56,8 +53,7 @@ if tty -s; then
56
53
  else
57
54
  # Pipe mode - reading from stdin
58
55
  file_name=$1
59
- echo """
60
- #=======================================================================
56
+ echo """ #=======================================================================
61
57
  📤 UPLOADING | Sharing from stdin to transfer.sh
62
58
  #=======================================================================
63
59
  """
@@ -65,16 +61,14 @@ else
65
61
  curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null
66
62
 
67
63
  # Display QR code for the URL
68
- echo """
69
- #=======================================================================
64
+ echo """ #=======================================================================
70
65
  📱 QR CODE | Scan with mobile device to access file
71
66
  #=======================================================================
72
67
  """
73
68
  qr "https://transfer.sh/$file_name"
74
69
  fi
75
70
 
76
- echo """
77
- #=======================================================================
71
+ echo """#=======================================================================
78
72
  ✅ UPLOAD COMPLETE | File is available at the URL above
79
73
  #=======================================================================
80
74
  """
@@ -1,36 +1,36 @@
1
- """Convert image to text.
2
- """
1
+ # """Convert image to text.
2
+ # """
3
3
 
4
4
 
5
- # import sys
6
- from crocodile.msc.odds import capture_from_webcam
7
- from crocodile.meta import Terminal
5
+ # # import sys
6
+ # from crocodile.msc.odds import capture_from_webcam
7
+ # from crocodile.meta import Terminal
8
+ # from rich.console import Console
9
+ # from rich.panel import Panel
10
+ # import pytesseract
11
+ # from PIL import Image
8
12
 
9
- print(f"""
10
- ╔{'═' * 60}╗
11
- ║ 📸 Image to Text Converter
12
- ╚{'═' * 60}╝
13
- """)
13
+ # console = Console()
14
14
 
15
- print("📷 Capturing image from webcam...")
16
- img_path = capture_from_webcam(show=False, wait=False, save=True)
17
- print(f"✅ Image captured and saved to: {img_path}")
15
+ # console.print(Panel("📸 Image to Text Converter", title="Status", expand=False))
18
16
 
19
- # img_rgb = cv2.cvtColor(img_cv, cv2.COLOR_BGR2RGB)
20
- # import cv2
21
- # img_cv = cv2.imread(r'C:\Users\alex\Downloads\name.jpg')
17
+ # print("📷 Capturing image from webcam...")
18
+ # img_path = capture_from_webcam(show=False, wait=False, save=True)
19
+ # print(f"✅ Image captured and saved to: {img_path}")
22
20
 
23
- # sys.path.insert(0, P.home().joinpath("AppData/Local/Tesseract-OCR").str)
24
- # import pytesseract
25
- # print(pytesseract.image_to_string(img_cv))
26
-
27
- print("\n🔍 Processing image with Tesseract OCR...")
28
- q = Terminal().run(f"cd ~/AppData/Local/Tesseract-OCR; pytesseract '{img_path}'", shell="pwsh").capture().op
29
-
30
- print(f"""
31
- ╔{'═' * 60}╗
32
- 📄 Extracted Text Result:
33
- ╠{'═' * 60}╣
34
- {q}
35
- ╚{'═' * 60}╝
36
- """)
21
+ # # img_rgb = cv2.cvtColor(img_cv, cv2.COLOR_BGR2RGB)
22
+ # # import cv2
23
+ # # img_cv = cv2.imread(r'C:\Users\alex\Downloads\name.jpg')
24
+
25
+ # # sys.path.insert(0, P.home().joinpath("AppData/Local/Tesseract-OCR").str)
26
+ # # import pytesseract
27
+ # # print(pytesseract.image_to_string(img_cv))
28
+
29
+ # print("\n🔍 Processing image with Tesseract OCR...")
30
+ # q = Terminal().run(f"cd ~/AppData/Local/Tesseract-OCR; pytesseract '{img_path}'", shell="pwsh").capture().op
31
+
32
+ # try:
33
+ # text = pytesseract.image_to_string(Image.open(img_path))
34
+ # console.print(Panel(text, title="📄 Extracted Text Result:", title_align="left", expand=False))
35
+ # except FileNotFoundError:
36
+ # print(f"Error: Image file not found at {img_path}")
@@ -4,6 +4,11 @@ from pathlib import Path
4
4
  import random
5
5
  import string
6
6
  import os
7
+ from rich.console import Console
8
+ from rich.panel import Panel
9
+
10
+
11
+ console = Console()
7
12
 
8
13
 
9
14
  def get_conn_string(sess_name: str) -> str:
@@ -15,29 +20,21 @@ def get_conn_string(sess_name: str) -> str:
15
20
 
16
21
 
17
22
  def main():
18
- print(f"""
19
- ╔{'═' * 60}╗
20
- ║ 🔌 Tmate Connection Manager
21
- ╚{'═' * 60}╝
22
- """)
23
+ console.print(Panel("🔌 Tmate Connection Manager", title="[bold]Welcome[/bold]"))
23
24
 
24
25
  parser = argparse.ArgumentParser(description='Tmate launcher')
25
26
  parser.add_argument("sess_name", help="session name", default=random.choices(list(string.digits + string.ascii_letters), k=20))
26
27
  args = parser.parse_args()
27
28
 
28
- print(f"🔍 Looking up session: {args.sess_name}")
29
+ console.print(f"🔍 Looking up session: {args.sess_name}")
29
30
  conn_string = get_conn_string(args.sess_name)
30
31
 
31
- print(f"""
32
- ╭{'─' * 60}╮
33
- │ 🔗 Connection String: ssh {conn_string}
34
- ╰{'─' * 60}╯
35
- """)
32
+ console.print(Panel(f"SSH Connection String: ssh {conn_string}", title="[bold green]SSH Connection[/bold green]"))
36
33
 
37
- print("🚀 Connecting to tmate session...")
34
+ console.print("🚀 Connecting to tmate session...")
38
35
  os.system(f"ssh {conn_string}")
39
36
 
40
- print("✅ Connection closed")
37
+ console.print("✅ Connection closed")
41
38
 
42
39
 
43
40
  if __name__ == '__main__':