machineconfig 1.7__py3-none-any.whl → 1.9__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 (72) hide show
  1. machineconfig/__init__.py +4 -2
  2. machineconfig/jobs/python/check_installations.py +38 -32
  3. machineconfig/jobs/python/create_bootable_media.py +4 -4
  4. machineconfig/jobs/python/create_zellij_template.py +3 -2
  5. machineconfig/jobs/python/python_cargo_build_share.py +14 -9
  6. machineconfig/jobs/python/python_ve_symlink.py +6 -6
  7. machineconfig/jobs/python_custom_installers/azuredatastudio.py +36 -0
  8. machineconfig/jobs/python_custom_installers/bypass_paywall.py +30 -0
  9. machineconfig/jobs/{python_linux_installers/dev → python_custom_installers}/docker_desktop.py +15 -4
  10. machineconfig/jobs/python_custom_installers/gh.py +53 -0
  11. machineconfig/jobs/python_custom_installers/goes.py +35 -0
  12. machineconfig/jobs/python_custom_installers/helix.py +43 -0
  13. machineconfig/jobs/python_custom_installers/lvim.py +48 -0
  14. machineconfig/jobs/python_custom_installers/ngrok.py +39 -0
  15. machineconfig/jobs/python_custom_installers/nvim.py +48 -0
  16. machineconfig/jobs/python_custom_installers/vscode.py +45 -0
  17. machineconfig/jobs/python_custom_installers/wezterm.py +41 -0
  18. machineconfig/profile/create.py +12 -7
  19. machineconfig/profile/shell.py +15 -13
  20. machineconfig/scripts/python/choose_wezterm_theme.py +96 -0
  21. machineconfig/scripts/python/cloud_copy.py +18 -13
  22. machineconfig/scripts/python/cloud_mount.py +41 -15
  23. machineconfig/scripts/python/cloud_repo_sync.py +57 -31
  24. machineconfig/scripts/python/cloud_sync.py +13 -15
  25. machineconfig/scripts/python/croshell.py +19 -10
  26. machineconfig/scripts/python/devops.py +22 -6
  27. machineconfig/scripts/python/devops_add_identity.py +7 -6
  28. machineconfig/scripts/python/devops_add_ssh_key.py +10 -9
  29. machineconfig/scripts/python/devops_backup_retrieve.py +5 -5
  30. machineconfig/scripts/python/devops_devapps_install.py +24 -19
  31. machineconfig/scripts/python/devops_update_repos.py +5 -4
  32. machineconfig/scripts/python/dotfile.py +8 -4
  33. machineconfig/scripts/python/fire_jobs.py +165 -55
  34. machineconfig/scripts/python/ftpx.py +18 -8
  35. machineconfig/scripts/python/mount_nfs.py +13 -10
  36. machineconfig/scripts/python/mount_nw_drive.py +4 -3
  37. machineconfig/scripts/python/mount_ssh.py +8 -5
  38. machineconfig/scripts/python/repos.py +26 -21
  39. machineconfig/scripts/python/snapshot.py +2 -2
  40. machineconfig/scripts/python/start_slidev.py +104 -0
  41. machineconfig/scripts/python/start_terminals.py +1 -1
  42. machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +20 -34
  43. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +11 -12
  44. machineconfig/utils/installer.py +177 -217
  45. machineconfig/utils/scheduling.py +1 -1
  46. machineconfig/utils/utils.py +107 -54
  47. machineconfig/utils/ve.py +120 -16
  48. machineconfig-1.9.dist-info/LICENSE +201 -0
  49. {machineconfig-1.7.dist-info → machineconfig-1.9.dist-info}/METADATA +155 -140
  50. machineconfig-1.9.dist-info/RECORD +76 -0
  51. {machineconfig-1.7.dist-info → machineconfig-1.9.dist-info}/WHEEL +1 -1
  52. machineconfig/jobs/python_generic_installers/archive/gopass.py +0 -18
  53. machineconfig/jobs/python_generic_installers/archive/nvim.py +0 -20
  54. machineconfig/jobs/python_generic_installers/archive/opencommit.py +0 -25
  55. machineconfig/jobs/python_generic_installers/archive/strongbox.py +0 -33
  56. machineconfig/jobs/python_generic_installers/dev/__init__.py +0 -0
  57. machineconfig/jobs/python_linux_installers/archive/__init__.py +0 -0
  58. machineconfig/jobs/python_linux_installers/archive/bandwhich.py +0 -14
  59. machineconfig/jobs/python_linux_installers/archive/ranger.py +0 -19
  60. machineconfig/jobs/python_linux_installers/dev/azure_data_studio.py +0 -21
  61. machineconfig/jobs/python_linux_installers/dev/bytehound.py +0 -20
  62. machineconfig/jobs/python_linux_installers/dev/nnn.py +0 -22
  63. machineconfig/jobs/python_windows_installers/archive/ntop.py +0 -21
  64. machineconfig/jobs/python_windows_installers/dev/bypass_paywall.py +0 -22
  65. machineconfig/jobs/python_windows_installers/dev/obs_background_removal_plugin.py +0 -22
  66. machineconfig/scripts/python/choose_ohmybash_theme.py +0 -31
  67. machineconfig/scripts/python/choose_ohmyposh_theme.py +0 -57
  68. machineconfig/utils/pandas_type.py +0 -37
  69. machineconfig/utils/to_exe.py +0 -7
  70. machineconfig-1.7.dist-info/RECORD +0 -81
  71. /machineconfig/jobs/{python_generic_installers/archive → python_custom_installers}/__init__.py +0 -0
  72. {machineconfig-1.7.dist-info → machineconfig-1.9.dist-info}/top_level.txt +0 -0
machineconfig/__init__.py CHANGED
@@ -2,7 +2,9 @@
2
2
  """DS
3
3
  """
4
4
 
5
- __version__ = "1.7"
5
+ __version__ = "1.9"
6
6
  release_notes = """
7
- enhanced cli
7
+
8
+ imporoved installer
9
+
8
10
  """
@@ -2,7 +2,7 @@
2
2
  """CI
3
3
  """
4
4
 
5
- import crocodile.toolbox as tb
5
+
6
6
  import time
7
7
  import pandas as pd
8
8
  import platform
@@ -10,18 +10,21 @@ from rich.console import Console
10
10
  # from rich.progress import track
11
11
  from machineconfig.utils.utils import LIBRARY_ROOT, INSTALL_VERSION_ROOT
12
12
  from machineconfig.utils.installer import get_installed_cli_apps
13
+ from crocodile.core import List as L, install_n_import, Struct
14
+ from crocodile.file_management import P
15
+ from crocodile.meta import Terminal
13
16
  from tqdm import tqdm
14
17
  from typing import Optional
15
18
 
16
19
 
17
20
  APP_SUMMARY_PATH = LIBRARY_ROOT.joinpath(f"profile/records/{platform.system().lower()}/apps_summary_report.csv")
18
- CLOUD: str = "gdw" # tb.Read.ini(DEFAULTS_PATH)['general']['rclone_config_name']
21
+ CLOUD: str = "gdw" # Read.ini(DEFAULTS_PATH)['general']['rclone_config_name']
19
22
  # my onedrive doesn't allow sharing.
20
23
 
21
24
 
22
- def scan(path: tb.P, pct: float = 0.0):
23
- vt = tb.install_n_import(library="vt", package="vt-py")
24
- client = vt.Client(tb.P.home().joinpath("dotfiles/creds/tokens/virustotal").read_text().split("\n")[0])
25
+ def scan(path: P, pct: float = 0.0):
26
+ vt = install_n_import(library="vt", package="vt-py")
27
+ client = vt.Client(P.home().joinpath("dotfiles/creds/tokens/virustotal").read_text().split("\n")[0])
25
28
  console = Console()
26
29
  console.rule(f"Scanning {path}. {pct:.2f}% done")
27
30
  if path.is_dir():
@@ -29,12 +32,11 @@ def scan(path: tb.P, pct: float = 0.0):
29
32
  return None
30
33
  with open(str(path), "rb") as f:
31
34
  analysis = client.scan_file(f)
32
- repeat_counter = 0
35
+ repeat_counter: int = 0
33
36
  while True:
34
37
  with console.status(f"waiting for scan of {path} ... "):
35
38
  try:
36
39
  anal = client.get_object("/analyses/{}", analysis.id)
37
- # print(anal.status)
38
40
  if anal.status == "completed": break
39
41
  except Exception as ex: # type: ignore
40
42
  repeat_counter += 1
@@ -42,33 +44,37 @@ def scan(path: tb.P, pct: float = 0.0):
42
44
  raise ValueError(f"Error in scanning {path}") from ex
43
45
  print(f"Error in scanning, trying again.")
44
46
  time.sleep(30)
45
- df = pd.DataFrame(anal.results).T
47
+ df = pd.DataFrame(anal.results.values())
46
48
  malicious = []
47
49
  for _idx, row in df.iterrows():
50
+ # try:
51
+ # print(row.result)
52
+ # except Exception as ex: # type: ignore
53
+ # print(row)
48
54
  if row.result is None and row.category in ["undetected", "type-unsupported", "failure", "timeout", "confirmed-timeout"]: continue
49
55
  else:
50
- tb.Struct(row.to_dict()).print(as_config=True, title=f"Found Category {row.category}")
56
+ Struct(row.to_dict()).print(as_config=True, title=f"Found Category {row.category}")
51
57
  malicious.append(row)
52
- positive_pct = round(len(malicious) / len(df) * 100, 1)
58
+ positive_pct: float = round(number=len(malicious) / len(df) * 100, ndigits=1)
53
59
  print(f"positive_ratio = {positive_pct:.1f} %")
54
60
  return positive_pct, df
55
61
 
56
62
 
57
63
  def main() -> None:
58
- apps_paths_tmp: tb.List[tb.P] = get_installed_cli_apps()
59
- versions_files_paths: tb.L[tb.P] = INSTALL_VERSION_ROOT.search()
64
+ apps_paths_tmp: L[P] = get_installed_cli_apps()
65
+ versions_files_paths: L[P] = INSTALL_VERSION_ROOT.search()
60
66
  app_versions: list[Optional[str]] = []
61
- apps_paths_raw: tb.L[tb.P] = tb.L([])
62
- for an_app in versions_files_paths:
63
- exe_path = apps_paths_tmp.filter(lambda x: x.stem == an_app.stem)
64
- if len(exe_path) == 1:
65
- app_versions.append(an_app.read_text())
66
- apps_paths_raw.append(exe_path.list[0])
67
+ apps_paths_raw: L[P] = L([])
68
+ for an_app in apps_paths_tmp:
69
+ version_path = versions_files_paths.filter(lambda x: x.stem == an_app.stem)
70
+ if len(version_path) == 1:
71
+ app_versions.append(version_path.list[0].read_text())
72
+ apps_paths_raw.append(an_app)
67
73
  # if an_app.stem in versions_files_paths.stem:
68
74
  # app_versions.append(versions_files_paths.filter(lambda x: x.stem == an_app.stem.replace(".exe", "")).list[0].read_text())
69
75
  # else:
70
76
  # print(f"🤔 Cloud not find a documented version for installation of {an_app.stem}, trying to get it from the app itself.")
71
- # tmp = tb.Terminal().run(f"{an_app.stem} --version", shell="powershell").capture().op_if_successfull_or_default(strict_err=False, strict_returcode=False)
77
+ # tmp = Terminal().run(f"{an_app.stem} --version", shell="powershell").capture().op_if_successfull_or_default(strict_err=False, strict_returcode=False)
72
78
  # if tmp is not None: tmp = tmp.split("\n")[0]
73
79
  # print(f"➡️ Found version `{tmp}` for {an_app.stem}.")
74
80
  # app_versions.append(None)
@@ -94,8 +100,8 @@ def main() -> None:
94
100
 
95
101
  app_url: list[Optional[str]] = []
96
102
  for idx, row in tqdm(res_df.iterrows(), total=res_df.shape[0]):
97
- apps_safe_url = upload(tb.P(str(row["app_path"])).expanduser())
98
- app_url.append(apps_safe_url.as_posix() if type(apps_safe_url) is tb.P else apps_safe_url)
103
+ apps_safe_url = upload(P(str(row["app_path"])).expanduser())
104
+ app_url.append(apps_safe_url.as_posix() if type(apps_safe_url) is P else apps_safe_url)
99
105
  res_df["app_url"] = app_url
100
106
  res_df.to_csv(APP_SUMMARY_PATH.with_suffix(".csv").create(parents_only=True), index=False)
101
107
  APP_SUMMARY_PATH.with_suffix(".md").write_text(res_df.to_markdown())
@@ -103,8 +109,8 @@ def main() -> None:
103
109
  print(res_df)
104
110
 
105
111
 
106
- def upload(path: tb.P):
107
- set_time_out = tb.install_n_import("call_function_with_timeout").SetTimeout
112
+ def upload(path: P):
113
+ set_time_out = install_n_import("call_function_with_timeout").SetTimeout
108
114
  func_with_timeout = set_time_out(lambda: path.to_cloud(CLOUD, rel2home=True, share=True, os_specific=True), timeout=180)
109
115
  is_done, _is_timeout, _erro_message, results = func_with_timeout()
110
116
  if is_done: return results
@@ -113,17 +119,17 @@ def upload(path: tb.P):
113
119
 
114
120
  class PrecheckedCloudInstaller:
115
121
  def __init__(self):
116
- tb.install_n_import("gdown")
122
+ install_n_import("gdown")
117
123
  self.df = pd.read_csv(APP_SUMMARY_PATH)
118
124
 
119
125
  @staticmethod
120
126
  def download_google_links(url: str):
121
127
  # if "drive.google.com" in str(url): url = str(url).replace("open?", "uc?")
122
128
  # else: raise NotImplementedError("Only google drive is supported for now.")
123
- # return tb.P(url).download(name=name)
124
- gdrive_id = tb.P(url).parts[-1].split("id=")[1]
125
- gdown = tb.install_n_import("gdown")
126
- result = tb.P(gdown.download(id=gdrive_id)).absolute()
129
+ # return P(url).download(name=name)
130
+ gdrive_id = P(url).parts[-1].split("id=")[1]
131
+ gdown = install_n_import("gdown")
132
+ result = P(gdown.download(id=gdrive_id)).absolute()
127
133
  return result
128
134
 
129
135
  @staticmethod
@@ -134,10 +140,10 @@ class PrecheckedCloudInstaller:
134
140
  print(f"Error in downloading {app_url} {ex}")
135
141
  return None
136
142
  if platform.system().lower() == "linux":
137
- tb.Terminal().run(f"chmod +x {exe}")
138
- tb.Terminal().run(f"mv {exe} /usr/local/bin/")
143
+ Terminal().run(f"chmod +x {exe}")
144
+ Terminal().run(f"mv {exe} /usr/local/bin/")
139
145
  elif platform.system().lower() == "windows":
140
- exe.move(folder=tb.P.home().joinpath("AppData/Local/Microsoft/WindowsApps"), overwrite=True)
146
+ exe.move(folder=P.home().joinpath("AppData/Local/Microsoft/WindowsApps"), overwrite=True)
141
147
  return True
142
148
 
143
149
  def download_safe_apps(self, name: str = "AllEssentials"):
@@ -152,7 +158,7 @@ class PrecheckedCloudInstaller:
152
158
  if name == "AllEssentials":
153
159
  print(f"Downloading {self.df.shape[0]} apps ...")
154
160
  print(self.df)
155
- _res = tb.L(self.df.app_url).apply(PrecheckedCloudInstaller.install_cli_apps, jobs=20)
161
+ _res = L(self.df.app_url).apply(PrecheckedCloudInstaller.install_cli_apps, jobs=20)
156
162
  else:
157
163
  app_url = self.df[self.df.app_name == name].iloc[0].app_url
158
164
  _res = PrecheckedCloudInstaller.install_cli_apps(app_url=app_url)
@@ -1,13 +1,13 @@
1
1
 
2
2
 
3
- # import crocodile.toolbox as tb
3
+ #
4
4
 
5
5
  # # one can either install rufus: https://rufus.ie/en/
6
6
  # # however, to create bootable media with multiple OSs to choose from:
7
7
 
8
- # tb.P(r'https://github.com/ventoy/Ventoy/archive/refs/tags/v1.0.78.zip').download().unzip().search[0]()
9
- # tb.P(r'https://mirrors.layeronline.com/linuxmint/stable/21/linuxmint-21-cinnamon-64bit.iso').download(folder=tb.P.home().joinpath("Downloads/os").create())
10
- # tb.P(r'https://download.manjaro.org/kde/21.3.7/manjaro-kde-21.3.7-minimal-220816-linux515.iso').download(folder=tb.P.home().joinpath("Downloads/os").create())
8
+ # P(r'https://github.com/ventoy/Ventoy/archive/refs/tags/v1.0.78.zip').download().unzip().search[0]()
9
+ # P(r'https://mirrors.layeronline.com/linuxmint/stable/21/linuxmint-21-cinnamon-64bit.iso').download(folder=P.home().joinpath("Downloads/os").create())
10
+ # P(r'https://download.manjaro.org/kde/21.3.7/manjaro-kde-21.3.7-minimal-220816-linux515.iso').download(folder=P.home().joinpath("Downloads/os").create())
11
11
 
12
12
 
13
13
  # if __name__ == '__main__':
@@ -1,9 +1,10 @@
1
1
 
2
2
  """ZT
3
3
  """
4
- import crocodile.toolbox as tb
4
+
5
5
  import socket
6
6
  from machineconfig.utils.utils import choose_ssh_host, write_shell_script
7
+ from crocodile.file_management import P
7
8
 
8
9
  prefix = """
9
10
 
@@ -41,7 +42,7 @@ def build_template(tabs: list[str]):
41
42
  for t in tabs:
42
43
  res += tab.replace("TABNAME", t).replace("TABCOMMAND", f"ssh").replace("TABARGS", t)
43
44
  res += suffix.replace("THISMACHINE", socket.gethostname())
44
- file = tb.P.tmp().joinpath(f"tmp_files/templates/zellij_template.kdl").create(parents_only=True).write_text(res)
45
+ file = P.tmp().joinpath(f"tmp_files/templates/zellij_template.kdl").create(parents_only=True).write_text(res)
45
46
  res = f"zellij --layout {file}"
46
47
  return res
47
48
 
@@ -1,5 +1,10 @@
1
1
 
2
- import crocodile.toolbox as tb
2
+ """
3
+ cargo install
4
+ """
5
+
6
+ from crocodile.meta import Terminal
7
+ from crocodile.file_management import P
3
8
  import platform
4
9
 
5
10
 
@@ -18,22 +23,22 @@ cargo install --path .
18
23
  """
19
24
  print(f"Executing {script}")
20
25
  if platform.system() == "Windows":
21
- tb.Terminal(stdout=None).run(f". {tb.P.tmpfile(suffix='.ps1').write_text(script)}", shell="pwsh").print()
26
+ Terminal(stdout=None).run(f". {P.tmpfile(suffix='.ps1').write_text(script)}", shell="pwsh").print()
22
27
  else:
23
- tb.Terminal(stdout=None).run(script, shell="pwsh")
28
+ Terminal(stdout=None).run(script, shell="pwsh")
24
29
 
25
- exe = tb.P.home().joinpath(f".cargo/bin/{tool_name}" + (".exe" if platform.system() == "Windows" else ""))
30
+ exe = P.home().joinpath(f".cargo/bin/{tool_name}" + (".exe" if platform.system() == "Windows" else ""))
26
31
 
27
32
  try:
28
- tb.P.home().joinpath(tool_name).delete(sure=True)
33
+ P.home().joinpath(tool_name).delete(sure=True)
29
34
  except PermissionError:
30
- print(f"PermissionError, couldn't delete: {tb.P.home().joinpath(tool_name)}")
35
+ print(f"PermissionError, couldn't delete: {P.home().joinpath(tool_name)}")
31
36
 
32
37
  if platform.system() == "Windows":
33
- exe = exe.move(folder=tb.P.get_env().WindowsApps)
38
+ exe = exe.move(folder=P.get_env().WindowsApps)
34
39
  elif platform.system() == "Linux":
35
- tb.Terminal().run(f"sudo mv {exe} /usr/local/bin")
36
- exe = tb.P(r"/usr/local/bin").joinpath(exe.name)
40
+ Terminal().run(f"sudo mv {exe} /usr/local/bin")
41
+ exe = P(r"/usr/local/bin").joinpath(exe.name)
37
42
  else:
38
43
  raise NotImplementedError(f"Platform {platform.system()} not supported.")
39
44
  share_link = exe.to_cloud("gdpo", share=True)
@@ -2,16 +2,16 @@
2
2
  """Symlinks
3
3
  """
4
4
 
5
- import crocodile.toolbox as tb
5
+ from crocodile.file_management import P
6
6
  # from machineconfig.utils.utils import display_options
7
7
 
8
8
 
9
9
  def main():
10
- target = tb.P(input("Symlink to which target? ")).expanduser().absolute()
11
- source = input(f"symlink from which source ? [default to: CWD/{target.name}] ") or tb.P.cwd().joinpath(target.name)
12
- if isinstance(source, str): source = tb.P(source).expanduser().absolute()
13
- # ve_path = display_options(msg="symlin link? ", options=tb.P.home().joinpath("ve").starget.symlink_toimport crocodile.toolbox as tb; tb.P(r'$pwd').joinpath('venv').symlink_to(r'$to'); tb.P('.gitignore').modify_text('venv', 'venv', replace_line=True)"(target.symlink_to(
14
- # tb.P('.gitignore').modify_text('venv', 'venv', replace_line=True)"
10
+ target = P(input("Symlink to which target? ")).expanduser().absolute()
11
+ source = input(f"symlink from which source ? [default to: CWD/{target.name}] ") or P.cwd().joinpath(target.name)
12
+ if isinstance(source, str): source = P(source).expanduser().absolute()
13
+ # ve_path = display_options(msg="symlin link? ", options=P.home().joinpath("ve").starget.symlink_to; P(r'$pwd').joinpath('venv').symlink_to(r'$to'); P('.gitignore').modify_text('venv', 'venv', replace_line=True)"(target.symlink_to(
14
+ # P('.gitignore').modify_text('venv', 'venv', replace_line=True)"
15
15
  source.symlink_to(target, overwrite=True)
16
16
  return "echo '😁 Finished creating symlink.'"
17
17
 
@@ -0,0 +1,36 @@
1
+
2
+ """
3
+ custom installer for azuredatastudio
4
+ """
5
+
6
+ from typing import Optional
7
+ import platform
8
+
9
+ config_dict = {
10
+ "repo_url": "CUSTOM",
11
+ "doc": "Azure Data Studio is a data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.",
12
+ "filename_template_windows_amd_64": "AzureDataStudio-{}.exe",
13
+ "filename_template_linux_amd_64": "azuredatastudio-{}.deb",
14
+ "strip_v": True,
15
+ "exe_name": "azuredatastudio"
16
+ }
17
+
18
+
19
+ def main(version: Optional[str] = None):
20
+ _ = version
21
+ if platform.system() == "Linux": return f"""
22
+
23
+ cd ~/Downloads
24
+ curl https://azuredatastudio-update.azurewebsites.net/latest/linux-x64/stable -o ./azuredatastudio-linux-x64.tar.gz
25
+ tar -xvf ./azuredatastudio-linux-x64.tar.gz
26
+ echo 'export PATH="$PATH:~/azuredatastudio-linux-x64"' >> ~/.bashrc
27
+ source ~/.bashrc
28
+
29
+ """
30
+ elif platform.system() == "Windows": return "winget install -e --id Microsoft.AzureDataStudio"
31
+ else:
32
+ raise NotImplementedError(f"Your platform {platform.system()} is not supported!")
33
+
34
+
35
+ if __name__ == '__main__':
36
+ pass
@@ -0,0 +1,30 @@
1
+
2
+ # import numpy as np
3
+ # import matplotlib.pyplot as plt
4
+
5
+ # from platform import system
6
+ from typing import Optional
7
+ from crocodile.file_management import P
8
+
9
+
10
+ config_dict = {
11
+ "repo_url": "CUSTOM",
12
+ "doc": """Plugin for chrome to bypass paywalls""",
13
+ "filename_template_windows_amd_64": "VSCodeSetup-{}.exe",
14
+ "filename_template_linux_amd_64": "code_{}.deb",
15
+ "strip_v": True,
16
+ "exe_name": "code"
17
+ }
18
+
19
+
20
+ def main(version: Optional[str] = None):
21
+ _ = version
22
+ # see remove paywalls and enhance YT experience by Chris Titus
23
+ folder = r"C:\\"
24
+ P("https://github.com/iamadamdev/bypass-paywalls-chrome/archive/master.zip").download().unzip(folder=folder, content=True)
25
+ P(folder).joinpath("bypass-paywalls-chrome-master")
26
+ return ""
27
+
28
+
29
+ if __name__ == '__main__':
30
+ pass
@@ -1,6 +1,8 @@
1
1
 
2
+ """
3
+ Installer
4
+ """
2
5
  # from machineconfig.utils.installer import get_latest_release
3
- # import crocodile.toolbox as tb
4
6
  # from crocodile.meta import Terminal
5
7
  from typing import Optional
6
8
 
@@ -11,10 +13,19 @@ from typing import Optional
11
13
 
12
14
  # url = r"https://github.com/koute/bytehound"
13
15
  # fname = r"bytehound-x86_64-unknown-linux-gnu.tgz"
14
- __doc__ = """Docker Desltop for Ubuntu as per https://docs.docker.com/desktop/install/ubuntu/"""
15
16
 
16
17
 
17
- def main(version: Optional[str] = None):
18
+ config_dict = {
19
+ "repo_url": "CUSTOM",
20
+ "doc": """Docker Desltop for Ubuntu as per https://docs.docker.com/desktop/install/ubuntu/""",
21
+ "filename_template_windows_amd_64": "gh_{}_windows_amd64.zip",
22
+ "filename_template_linux_amd_64": "gh_{}_linux_amd64.tar.gz",
23
+ "strip_v": True,
24
+ "exe_name": "gh"
25
+ }
26
+
27
+
28
+ def main(version: Optional[str]):
18
29
  _ = version
19
30
  code = """
20
31
  # Add Docker's official GPG key:
@@ -38,4 +49,4 @@ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
38
49
 
39
50
 
40
51
  if __name__ == '__main__':
41
- main()
52
+ pass
@@ -0,0 +1,53 @@
1
+
2
+ """gh-cli installer
3
+ """
4
+
5
+ import platform
6
+ from typing import Optional
7
+ from machineconfig.utils.installer import Installer
8
+ from crocodile.meta import Terminal
9
+
10
+ r"""
11
+ https://github.com/cli/cli
12
+
13
+ # as per https://docs.github.com/en/copilot/github-copilot-in-the-cli/using-github-copilot-in-the-cli
14
+ # gh auth login
15
+ # gh extension install github/gh-copilot
16
+
17
+ # & 'C:\Program Files\GitHub CLI\gh.exe' extension install github/gh-copilot
18
+ # & 'C:\Program Files\GitHub CLI\gh.exe' extension install auth login
19
+
20
+ """
21
+
22
+ config_dict = {
23
+ "repo_url": "https://github.com/cli/cli",
24
+ "doc": "GitHub CLI",
25
+ "filename_template_windows_amd_64": "gh_{}_windows_amd64.zip",
26
+ "filename_template_linux_amd_64": "gh_{}_linux_amd64.tar.gz",
27
+ "strip_v": True,
28
+ "exe_name": "gh"
29
+ }
30
+
31
+
32
+ def main(version: Optional[str]):
33
+ _ = version
34
+ inst = Installer.from_dict(d=config_dict, name="gh")
35
+ inst.install(version=version)
36
+ if platform.system() == "Windows":
37
+ program = "gh extension install github/gh-copilot"
38
+ elif platform.system() == "Linux":
39
+ program = """
40
+ gh extension install github/gh-copilot
41
+ """
42
+ else:
43
+ raise NotImplementedError("unsupported platform")
44
+
45
+ program += """
46
+ gh auth login --with-token $HOME/dotfiles/creds/git/gh_token.txt
47
+ """
48
+ Terminal().run(program, shell="default").print(desc="installing gh-copilot extension", capture=True)
49
+ return program
50
+
51
+
52
+ if __name__ == "__main__":
53
+ pass
@@ -0,0 +1,35 @@
1
+
2
+ """
3
+ natural language to API
4
+ https://github.com/ShishirPatil/gorilla
5
+ """
6
+
7
+ from machineconfig.utils.ve import get_ve_install_script
8
+ # import subprocess
9
+
10
+ config_dict = {
11
+ "repo_url": "CUSTOM",
12
+ "doc": "natural language to API",
13
+ "filename_template_windows_amd_64": "ngrok-stable-windows-amd64.zip",
14
+ "filename_template_linux_amd_64": "ngrok-stable-linux-amd64.zip",
15
+ "strip_v": False,
16
+ "exe_name": "ngrok"
17
+ }
18
+
19
+ ve_name = "goex"
20
+
21
+
22
+ def main():
23
+ install_script = get_ve_install_script(ve_name=ve_name, py_version="3.11", install_crocodile_and_machineconfig=False,
24
+ delete_if_exists=True, system=None)
25
+
26
+
27
+ install_script += f"""
28
+
29
+ . activate_ve {ve_name}
30
+ cd ~/code/foreign
31
+ git clone https://github.com/ShishirPatil/gorilla --depth 1
32
+ cd gorilla/goex
33
+ pip install -e .
34
+
35
+ """
@@ -0,0 +1,43 @@
1
+
2
+ """
3
+ Installers do not add runtime files to the machine, hence this script.
4
+ """
5
+
6
+ # from pathlib import Path
7
+ from machineconfig.utils.installer import Installer, LINUX_INSTALL_PATH, WINDOWS_INSTALL_PATH
8
+ from typing import Optional
9
+ import platform
10
+
11
+
12
+ config_dict = {
13
+ "repo_url": "https://github.com/helix-editor/helix",
14
+ "doc": "Helix is a post-modern modal text editor.",
15
+ "filename_template_windows_amd_64": "helix-{}-x86_64-windows.zip",
16
+ "filename_template_linux_amd_64": "helix-{}-x86_64-linux.tar.xz",
17
+ "strip_v": False,
18
+ "exe_name": "hx"
19
+ }
20
+
21
+
22
+ def main(version: Optional[str]):
23
+ inst = Installer.from_dict(d=config_dict, name="hx")
24
+ downloaded, _version_to_be_installed = inst.download(version=version)
25
+ hx_file_search = downloaded.search("hx", folders=False, files=True, r=True)
26
+ assert len(hx_file_search) == 1
27
+ hx_file = hx_file_search.list[0]
28
+ contrib = hx_file.parent / "contrib"
29
+ runtime = contrib.parent / "runtime"
30
+ assert runtime.exists()
31
+ assert contrib.exists()
32
+ if platform.system() == "Linux":
33
+ hx_file.move(folder=LINUX_INSTALL_PATH)
34
+ contrib.move(folder="~/.config/helix")
35
+ runtime.move(folder="~/.config/helix")
36
+ elif platform.system() == "Windows":
37
+ hx_file.move(folder=WINDOWS_INSTALL_PATH)
38
+ contrib.move(folder="~/.config/helix")
39
+ runtime.move(folder="~/.config/helix")
40
+
41
+
42
+ if __name__ == "__main__":
43
+ main(version=None)
@@ -0,0 +1,48 @@
1
+
2
+ """lvim
3
+ """
4
+
5
+ from crocodile.meta import Terminal
6
+ import subprocess
7
+ import platform
8
+ from typing import Optional
9
+
10
+
11
+ _ = Terminal, subprocess
12
+ # as per https://www.lunarvim.org/docs/installation
13
+
14
+
15
+ config_dict = {
16
+ "repo_url": "CUSTOM",
17
+ "doc": "Terminal text editor based on neovim.",
18
+ "filename_template_windows_amd_64": "",
19
+ "filename_template_linux_amd_64": "",
20
+ "strip_v": False,
21
+ "exe_name": "lvim"
22
+ }
23
+
24
+
25
+ def main(version: Optional[str]):
26
+ _ = version
27
+ if platform.system() == "Windows":
28
+ program = """
29
+
30
+ pwsh -c "`$LV_BRANCH='release-1.4/neovim-0.9'; iwr https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.ps1 -UseBasicParsing | iex"
31
+
32
+ """
33
+ elif platform.system() == "Linux":
34
+ program = """
35
+
36
+ LV_BRANCH='release-1.4/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh)
37
+
38
+ """
39
+ else:
40
+ raise NotImplementedError("unsupported platform")
41
+ # _res = Terminal(stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE).run_script(script=program, shell="default").print(desc="Running custom installer", capture=True)
42
+ # run script here as it requires user input
43
+ _ = program
44
+ return ""
45
+
46
+
47
+ if __name__ == "__main__":
48
+ pass
@@ -0,0 +1,39 @@
1
+
2
+ """ngrok
3
+ """
4
+
5
+ import platform
6
+ from typing import Optional
7
+
8
+
9
+ config_dict = {
10
+ "repo_url": "CUSTOM",
11
+ "doc": "ngrok secure introspectable tunnels to localhost",
12
+ "filename_template_windows_amd_64": "ngrok-stable-windows-amd64.zip",
13
+ "filename_template_linux_amd_64": "ngrok-stable-linux-amd64.zip",
14
+ "strip_v": False,
15
+ "exe_name": "ngrok"
16
+ }
17
+
18
+
19
+ def main(version: Optional[str]):
20
+ _ = version
21
+ if platform.system() == "Windows":
22
+ program = "winget install ngrok.ngrok --source winget"
23
+ elif platform.system() == "Linux":
24
+ # as per https://ngrok.com/docs/getting-started/?os=linux
25
+ program = """
26
+
27
+ curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
28
+ sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \
29
+ echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \
30
+ sudo tee /etc/apt/sources.list.d/ngrok.list && \
31
+ sudo apt update && sudo apt install ngrok
32
+ """
33
+ else:
34
+ raise NotImplementedError("unsupported platform")
35
+ return program
36
+
37
+
38
+ if __name__ == "__main__":
39
+ pass
@@ -0,0 +1,48 @@
1
+
2
+
3
+
4
+ """nvim
5
+ """
6
+
7
+
8
+ import platform
9
+ from typing import Optional
10
+
11
+
12
+ config_dict = {
13
+ "repo_url": "CUSTOM",
14
+ "doc": "Neovim",
15
+ "filename_template_windows_amd_64": "nvim-win64.zip",
16
+ "filename_template_linux_amd_64": "nvim-linux64.tar.gz",
17
+ "strip_v": False,
18
+ "exe_name": "nvim"
19
+ }
20
+
21
+
22
+ def main(version: Optional[str]):
23
+ _ = version
24
+ if platform.system() == "Windows":
25
+ program = """
26
+ winget install --no-upgrade --name "Neovim" --Id Neovim.Neovim --source winget --accept-package-agreements --accept-source-agreements
27
+ """
28
+ elif platform.system() == "Linux":
29
+ program = """
30
+ # mkdir $HOME/tmp_install -p || true
31
+ # mkdir $HOME/.local/share -p || true
32
+ # cd $HOME/tmp_install || true
33
+ # wget https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz || true
34
+ # tar -xvf nvim-linux64.tar.gz -C $HOME/.local/share/ || true
35
+ # sudo cp ~/.local/share/nvim-linux64/bin/nvim /usr/local/bin/nvim || true
36
+ brew install neovim
37
+ # nix-env -iA nixpkgs.neovim
38
+ """
39
+ _ = program
40
+ program = ""
41
+ else:
42
+ raise NotImplementedError("unsupported platform")
43
+ return program
44
+
45
+
46
+ if __name__ == "__main__":
47
+ print("Executed!")
48
+ pass