machineconfig 1.5__py3-none-any.whl → 1.8__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 (155) hide show
  1. machineconfig/__init__.py +8 -5
  2. machineconfig/jobs/python/check_installations.py +173 -163
  3. machineconfig/jobs/python/checkout_version.py +117 -0
  4. machineconfig/jobs/python/create_bootable_media.py +14 -14
  5. machineconfig/jobs/python/create_zellij_template.py +59 -56
  6. machineconfig/jobs/python/python_cargo_build_share.py +50 -45
  7. machineconfig/jobs/python/python_ve_symlink.py +20 -18
  8. machineconfig/jobs/python/tasks.py +4 -0
  9. machineconfig/jobs/script_installer/azure_data_studio.py +22 -0
  10. machineconfig/jobs/script_installer/bypass_paywall.py +23 -0
  11. machineconfig/jobs/script_installer/code.py +34 -0
  12. machineconfig/jobs/script_installer/docker_desktop.py +41 -0
  13. machineconfig/jobs/script_installer/ngrok.py +29 -0
  14. machineconfig/jobs/{python_linux_installers → script_installer}/skim.py +21 -19
  15. machineconfig/jobs/script_installer/wezterm.py +34 -0
  16. machineconfig/profile/create.py +107 -200
  17. machineconfig/profile/shell.py +127 -0
  18. machineconfig/scripts/__init__.py +6 -6
  19. machineconfig/scripts/python/cloud_copy.py +93 -0
  20. machineconfig/scripts/python/cloud_manager.py +38 -0
  21. machineconfig/scripts/python/cloud_mount.py +115 -52
  22. machineconfig/scripts/python/cloud_repo_sync.py +154 -114
  23. machineconfig/scripts/python/cloud_sync.py +261 -79
  24. machineconfig/scripts/python/croshell.py +151 -0
  25. machineconfig/scripts/python/devops.py +119 -87
  26. machineconfig/scripts/python/devops_add_identity.py +27 -23
  27. machineconfig/scripts/python/devops_add_ssh_key.py +70 -55
  28. machineconfig/scripts/python/devops_backup_retrieve.py +52 -46
  29. machineconfig/scripts/python/devops_devapps_install.py +120 -91
  30. machineconfig/scripts/python/devops_update_repos.py +82 -68
  31. machineconfig/scripts/python/dotfile.py +42 -38
  32. machineconfig/scripts/python/fire_jobs.py +351 -98
  33. machineconfig/scripts/python/ftpx.py +82 -0
  34. machineconfig/scripts/python/mount_nfs.py +54 -3
  35. machineconfig/scripts/python/mount_nw_drive.py +31 -0
  36. machineconfig/scripts/python/mount_ssh.py +44 -20
  37. machineconfig/scripts/python/onetimeshare.py +60 -51
  38. machineconfig/scripts/python/pomodoro.py +41 -37
  39. machineconfig/scripts/python/repos.py +195 -128
  40. machineconfig/scripts/python/scheduler.py +52 -0
  41. machineconfig/scripts/python/snapshot.py +21 -21
  42. machineconfig/scripts/python/start_slidev.py +104 -0
  43. machineconfig/scripts/python/start_terminals.py +97 -0
  44. machineconfig/scripts/python/wifi_conn.py +90 -71
  45. machineconfig/scripts/python/{transfer_wsl_win.py → wsl_windows_transfer.py} +47 -39
  46. machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +44 -48
  47. machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +136 -130
  48. machineconfig/utils/installer.py +251 -0
  49. machineconfig/utils/procs.py +114 -64
  50. machineconfig/utils/scheduling.py +188 -0
  51. machineconfig/utils/utils.py +353 -249
  52. machineconfig/utils/ve.py +222 -0
  53. {machineconfig-1.5.dist-info → machineconfig-1.8.dist-info}/METADATA +140 -110
  54. machineconfig-1.8.dist-info/RECORD +70 -0
  55. {machineconfig-1.5.dist-info → machineconfig-1.8.dist-info}/WHEEL +1 -1
  56. machineconfig/jobs/python/python_linux_installers_all.py +0 -73
  57. machineconfig/jobs/python/python_ve_installer.py +0 -73
  58. machineconfig/jobs/python/python_windows_installers_all.py +0 -23
  59. machineconfig/jobs/python_generic_installers/archive/nvim.py +0 -15
  60. machineconfig/jobs/python_generic_installers/archive/strongbox.py +0 -32
  61. machineconfig/jobs/python_generic_installers/archive/vtm.py +0 -25
  62. machineconfig/jobs/python_generic_installers/broot.py +0 -39
  63. machineconfig/jobs/python_generic_installers/browsh.py +0 -25
  64. machineconfig/jobs/python_generic_installers/bw.py +0 -26
  65. machineconfig/jobs/python_generic_installers/chatgpt.py +0 -24
  66. machineconfig/jobs/python_generic_installers/cpufetch.py +0 -23
  67. machineconfig/jobs/python_generic_installers/delta.py +0 -59
  68. machineconfig/jobs/python_generic_installers/dev/__init__.py +0 -0
  69. machineconfig/jobs/python_generic_installers/dev/autogpt.py +0 -28
  70. machineconfig/jobs/python_generic_installers/dev/bw.py +0 -29
  71. machineconfig/jobs/python_generic_installers/dev/evcxr.py +0 -22
  72. machineconfig/jobs/python_generic_installers/dev/kondo.py +0 -21
  73. machineconfig/jobs/python_generic_installers/dev/lvim.py +0 -60
  74. machineconfig/jobs/python_generic_installers/dev/ngrok.py +0 -35
  75. machineconfig/jobs/python_generic_installers/dev/opencommit.py +0 -21
  76. machineconfig/jobs/python_generic_installers/dev/qrcp.py +0 -25
  77. machineconfig/jobs/python_generic_installers/dev/qrscan.py +0 -16
  78. machineconfig/jobs/python_generic_installers/dev/rust-analyzer.py +0 -24
  79. machineconfig/jobs/python_generic_installers/dev/termscp.py +0 -23
  80. machineconfig/jobs/python_generic_installers/dev/tldr.py +0 -25
  81. machineconfig/jobs/python_generic_installers/dev/tokei.py +0 -24
  82. machineconfig/jobs/python_generic_installers/diskonaut.py +0 -26
  83. machineconfig/jobs/python_generic_installers/dua.py +0 -21
  84. machineconfig/jobs/python_generic_installers/evcxr.py +0 -21
  85. machineconfig/jobs/python_generic_installers/gitui.py +0 -23
  86. machineconfig/jobs/python_generic_installers/gopass.py +0 -19
  87. machineconfig/jobs/python_generic_installers/helix.py +0 -45
  88. machineconfig/jobs/python_generic_installers/kondo.py +0 -20
  89. machineconfig/jobs/python_generic_installers/lf.py +0 -25
  90. machineconfig/jobs/python_generic_installers/lvim.py +0 -34
  91. machineconfig/jobs/python_generic_installers/mprocs.py +0 -20
  92. machineconfig/jobs/python_generic_installers/navi.py +0 -20
  93. machineconfig/jobs/python_generic_installers/ots.py +0 -26
  94. machineconfig/jobs/python_generic_installers/ouch.py +0 -25
  95. machineconfig/jobs/python_generic_installers/pomodoro.py +0 -19
  96. machineconfig/jobs/python_generic_installers/procs.py +0 -20
  97. machineconfig/jobs/python_generic_installers/qrcp.py +0 -22
  98. machineconfig/jobs/python_generic_installers/qrscan.py +0 -14
  99. machineconfig/jobs/python_generic_installers/rclone.py +0 -21
  100. machineconfig/jobs/python_generic_installers/rust-analyzer.py +0 -24
  101. machineconfig/jobs/python_generic_installers/tere.py +0 -26
  102. machineconfig/jobs/python_generic_installers/termscp.py +0 -23
  103. machineconfig/jobs/python_generic_installers/tldr.py +0 -24
  104. machineconfig/jobs/python_generic_installers/tokei.py +0 -21
  105. machineconfig/jobs/python_generic_installers/vtm.py +0 -26
  106. machineconfig/jobs/python_generic_installers/watchexec.py +0 -21
  107. machineconfig/jobs/python_linux_installers/archive/__init__.py +0 -0
  108. machineconfig/jobs/python_linux_installers/archive/ranger.py +0 -18
  109. machineconfig/jobs/python_linux_installers/bandwhich.py +0 -11
  110. machineconfig/jobs/python_linux_installers/bottom.py +0 -17
  111. machineconfig/jobs/python_linux_installers/btop.py +0 -17
  112. machineconfig/jobs/python_linux_installers/dev/bandwhich.py +0 -13
  113. machineconfig/jobs/python_linux_installers/dev/bytehound.py +0 -20
  114. machineconfig/jobs/python_linux_installers/dev/nnn.py +0 -21
  115. machineconfig/jobs/python_linux_installers/gotty.py +0 -16
  116. machineconfig/jobs/python_linux_installers/joshuto.py +0 -28
  117. machineconfig/jobs/python_linux_installers/mcfly.py +0 -12
  118. machineconfig/jobs/python_linux_installers/nnn.py +0 -18
  119. machineconfig/jobs/python_linux_installers/topgrade.py +0 -15
  120. machineconfig/jobs/python_linux_installers/viu.py +0 -19
  121. machineconfig/jobs/python_linux_installers/xplr.py +0 -22
  122. machineconfig/jobs/python_linux_installers/zellij.py +0 -31
  123. machineconfig/jobs/python_windows_installers/archive/ntop.py +0 -20
  124. machineconfig/jobs/python_windows_installers/bat.py +0 -16
  125. machineconfig/jobs/python_windows_installers/boxes.py +0 -19
  126. machineconfig/jobs/python_windows_installers/bypass_paywall.py +0 -18
  127. machineconfig/jobs/python_windows_installers/dev/bypass_paywall.py +0 -21
  128. machineconfig/jobs/python_windows_installers/dev/obs_background_removal_plugin.py +0 -20
  129. machineconfig/jobs/python_windows_installers/fd.py +0 -17
  130. machineconfig/jobs/python_windows_installers/fzf.py +0 -19
  131. machineconfig/jobs/python_windows_installers/obs_background_removal_plugin.py +0 -19
  132. machineconfig/jobs/python_windows_installers/rg.py +0 -15
  133. machineconfig/jobs/python_windows_installers/ugrep.py +0 -14
  134. machineconfig/jobs/python_windows_installers/zoomit.py +0 -20
  135. machineconfig/jobs/python_windows_installers/zoxide.py +0 -20
  136. machineconfig/profile/fix_shell_profiles.py +0 -8
  137. machineconfig/scripts/python/archive/__init__.py +0 -0
  138. machineconfig/scripts/python/archive/bu_gdrive_rx.py +0 -41
  139. machineconfig/scripts/python/archive/bu_gdrive_sx.py +0 -40
  140. machineconfig/scripts/python/archive/bu_onedrive_rx.py +0 -59
  141. machineconfig/scripts/python/archive/bu_onedrive_sx.py +0 -45
  142. machineconfig/scripts/python/chatgpt.py +0 -28
  143. machineconfig/scripts/python/choose_ohmybash_theme.py +0 -25
  144. machineconfig/scripts/python/choose_ohmyposh_theme.py +0 -40
  145. machineconfig/scripts/python/cloud_rx.py +0 -42
  146. machineconfig/scripts/python/cloud_sx.py +0 -40
  147. machineconfig/scripts/python/ftprx.py +0 -37
  148. machineconfig/scripts/python/ftpsx.py +0 -36
  149. machineconfig/scripts/python/im2text.py +0 -15
  150. machineconfig/scripts/python/tmate_conn.py +0 -28
  151. machineconfig/scripts/python/tmate_start.py +0 -31
  152. machineconfig/utils/to_exe.py +0 -7
  153. machineconfig-1.5.dist-info/RECORD +0 -147
  154. /machineconfig/jobs/{python_generic_installers/archive → script_installer}/__init__.py +0 -0
  155. {machineconfig-1.5.dist-info → machineconfig-1.8.dist-info}/top_level.txt +0 -0
@@ -1,41 +0,0 @@
1
-
2
-
3
- from crocodile.comms.gdrive import GDriveAPI
4
- # from crocodile.file_management import P
5
- import argparse
6
-
7
-
8
- def main(google_account, project, file, unzip, relative_to_home, decrypt, key, pwd, local_dir):
9
- api = GDriveAPI(account=google_account, project=project)
10
-
11
- if "http" in file: path = api.download(furl=file, local_dir=local_dir, rel2home=relative_to_home) # , recursive, zipFirst)
12
- else:
13
- file = file
14
- path = api.download(fpath=file, local_dir=local_dir, rel2home=relative_to_home, decrypt=decrypt, unzip=unzip, key=key, pwd=pwd) # , recursive, zipFirst)
15
- print(path)
16
-
17
-
18
- def arg_parser():
19
- parser = argparse.ArgumentParser(description='FTP client')
20
-
21
- # positional argument
22
- parser.add_argument("file", help="file/folder path.", default="")
23
- # FLAGS
24
- # parser.add_argument("--recursive", "-r", help="Send recursively.", action="store_true") # default is False
25
- parser.add_argument("--relative_to_home", "-R", help="Download to a directory to make it relative to home.", action="store_true") # default is False
26
- parser.add_argument("--decrypt", "-e", help="decrypt file.", action="store_true") # default is False
27
- parser.add_argument("--unzip", "-z", help="unzip file.", action="store_true") # default is False
28
- # optional argument
29
- parser.add_argument("--local_dir", "-d", help="Local directory to put the file in.", default="")
30
- parser.add_argument("--google_account", "-a", help="Google Account.", default=None)
31
- parser.add_argument("--project", "-P", help="Project Name", default=None)
32
- parser.add_argument("--key", "-k", help="Key for decryption", default=None)
33
- parser.add_argument("--pwd", "-p", help="Password for decryption", default=None)
34
-
35
- args = parser.parse_args()
36
- main(google_account=args.google_account, project=args.project, file=args.file,
37
- unzip=args.unzip, relative_to_home=args.relative_to_home, decrypt=args.decrypt, key=args.key, pwd=args.pwd, local_dir=args.local_dir)
38
-
39
-
40
- if __name__ == "__main__":
41
- arg_parser()
@@ -1,40 +0,0 @@
1
-
2
- from crocodile.comms.gdrive import GDriveAPI
3
- # from crocodile.file_management import P
4
- import argparse
5
-
6
-
7
- def main(google_account, project, file, encrypt_first, z, relative_to_home, remote_dir, share, key, pwd):
8
- api = GDriveAPI(account=google_account, project=project)
9
-
10
- if share: res = api.upload_and_share(local_path=file, rel2home=relative_to_home,
11
- zip_first=z, encrypt_first=encrypt_first, key=key, pwd=pwd)
12
- else: res = api.upload(local_path=file, remote_dir=remote_dir, rel2home=relative_to_home,
13
- zip_first=z, encrypt_first=encrypt_first, key=key, pwd=pwd) # , recursive, zipFirst)
14
- print(res)
15
-
16
-
17
- def args_parser():
18
- parser = argparse.ArgumentParser(description='FTP client')
19
-
20
- # positional argument
21
- parser.add_argument("file", help="file/folder path.", default="")
22
- # FLAGS
23
- # parser.add_argument("--recursive", "-r", help="Send recursively.", action="store_true") # default is False
24
- parser.add_argument("--zip_first", "-z", help="Zip before sending.", action="store_true") # default is False
25
- parser.add_argument("--encrypt_first", "-e", help="Encrypt before sending.", action="store_true") # default is False
26
- parser.add_argument("--relative_to_home", "-R", help="Zip before sending.", action="store_true") # default is False
27
- parser.add_argument("--share", "-s", help="Share file.", action="store_true")
28
- # optional argument
29
- parser.add_argument("--remote_dir", "-d", help="Remote directory to send to.", default="")
30
- parser.add_argument("--google_account", "-a", help="Google Account.", default=None)
31
- parser.add_argument("--project", "-P", help="Project Name", default=None)
32
- parser.add_argument("--key", "-k", help="Key for encryption", default=None)
33
- parser.add_argument("--pwd", "-p", help="Password for encryption", default=None)
34
-
35
- args = parser.parse_args()
36
- main(google_account=args.google_account, project=args.project, file=args.file, z=args.zip_first, relative_to_home=args.relative_to_home, remote_dir=args.remote_dir, share=args.share, key=args.key, pwd=args.pwd, encrypt_first=args.encrypt_first)
37
-
38
-
39
- if __name__ == "__main__":
40
- args_parser()
@@ -1,59 +0,0 @@
1
-
2
- # from crocodile.environment import OneDriveConsumer, OneDriveCommercial
3
- from crocodile.environment import OneDriveExe
4
- import crocodile.toolbox as tb
5
- import argparse
6
- from crocodile.comms.helper_funcs import process_retrieved_file
7
- import os
8
- import time
9
-
10
-
11
- def main(file, unzip, decrypt, which, overwrite, key, pwd):
12
- if (onedrive_settings_path := tb.P.home().joinpath("dotfiles/settings/paths.toml")).exists():
13
- onedrive = onedrive_settings_path.readit()['onedrive']
14
- onedrive = tb.P.home().joinpath(onedrive[onedrive[which]])
15
- else:
16
- onedrive = tb.P.home().joinpath(os.environ["OneDrive"])
17
-
18
- target_file = tb.P(file).expanduser().absolute()
19
- source_file = onedrive.joinpath(tb.get_env().myhome, target_file.rel2home())
20
- if unzip and decrypt: source_file = source_file + ".zip.enc"
21
-
22
- print(f"Retriveing `{source_file}` \nTo `{target_file.parent}` folder.")
23
- if source_file.exists(): pass
24
- else:
25
- OneDriveExe()
26
- trials = 5
27
- while trials > 0 and not source_file.exists():
28
- trials -= 1
29
- print(f"Source file doesn't exist, waiting for OneDrive to sync ...")
30
- time.sleep(3)
31
- if not source_file.exists(): raise FileNotFoundError(f"Could not read the file on the could.")
32
-
33
- tmp_file = source_file.copy(folder=target_file.parent, overwrite=overwrite) # make sure to avoid doing decryption in the storage site.
34
- process_retrieved_file(tmp_file, decrypt=decrypt, unzip=unzip, key=key, pwd=pwd)
35
-
36
-
37
- def arg_parser():
38
- parser = argparse.ArgumentParser(description='OneDrive Backup')
39
-
40
- # positional argument
41
- parser.add_argument("file", help="file/folder path to be received.", default="")
42
- # FLAGS
43
- parser.add_argument("--recursive", "-r", help="Send recursively.", action="store_true") # default is False
44
- parser.add_argument("--decrypt", "-e", help="Decrypt after receiving.", action="store_true") # default is False
45
- parser.add_argument("--unzip", "-z", help="unzip after receiving.", action="store_true") # default is False
46
- parser.add_argument("--overwrite", "-o", help="Overwrite existing file.", action="store_true") # default is False
47
- # optional argument
48
- parser.add_argument("--which", "-w", help="Which onedrive to use? see: cat: ~/dotfiles/settings/paths.toml", default="default")
49
- parser.add_argument("--remote_dir", "-d", help="Remote directory to send to.", default="")
50
- parser.add_argument("--relative_to_home", "-R", help="Relative to `myhome` folder", action="store_true") # default is False
51
- parser.add_argument("--key", "-k", help="Key for encryption", default=None)
52
- parser.add_argument("--pwd", "-p", help="Password for encryption", default=None)
53
-
54
- args = parser.parse_args()
55
- main(file=args.file, unzip=args.unzip, decrypt=args.decrypt, which=args.which, overwrite=args.overwrite, pwd=args.pwd, key=args.key)
56
-
57
-
58
- if __name__ == "__main__":
59
- arg_parser()
@@ -1,45 +0,0 @@
1
-
2
- from crocodile.environment import OneDriveExe, myhome
3
- from crocodile.file_management import P
4
- import argparse
5
- import os
6
-
7
-
8
- def main(which, file, z, encrypt_first, key, pwd, overwrite):
9
- if (onedrive_settings_path := P.home().joinpath("dotfiles/settings/paths.toml")).exists():
10
- onedrive = onedrive_settings_path.readit()['onedrive']
11
- onedrive = P.home().joinpath(onedrive[onedrive[which]])
12
- else:
13
- onedrive = P.home().joinpath(os.environ["OneDrive"])
14
-
15
- file = process_sent_file(file=file, zip_first=z, encrypt_first=encrypt_first, key=key, pwd=pwd)
16
- remote_dir = onedrive.joinpath(myhome, file.rel2home().parent)
17
- path = file.copy(folder=remote_dir, overwrite=overwrite)
18
- if z or encrypt_first: P(file).delete(sure=True)
19
- OneDriveExe() # push to OneDrive
20
-
21
-
22
- def arg_parser():
23
- parser = argparse.ArgumentParser(description='OneDrive Backup')
24
-
25
- # positional argument
26
- parser.add_argument("file", help="file/folder path to be backed up", default="")
27
- # FLAGS
28
- parser.add_argument("--recursive", "-r", help="Send recursively.", action="store_true") # default is False
29
- parser.add_argument("--zip_first", "-z", help="Zip before backing up.", action="store_true") # default is False
30
- parser.add_argument("--encrypt_first", "-e", help="Encrypt before backing up.", action="store_true") # default is False
31
- parser.add_argument("--overwrite", "-o", help="Overwrite existing file.", action="store_true") # default is False
32
-
33
- # optional argument
34
- parser.add_argument("--which", "-w", help="Which onedrive to use? see: cat: ~/dotfiles/settings/paths.toml", default="default")
35
- parser.add_argument("--remote_dir", "-d", help="Remote directory to send to.", default="")
36
- parser.add_argument("--relative_to_home", "-R", help="Relative to `myhome` folder", action="store_true") # default is False
37
- parser.add_argument("--key", "-k", help="Key for encryption", default=None)
38
- parser.add_argument("--pwd", "-p", help="Password for encryption", default=None)
39
-
40
- args = parser.parse_args()
41
- main(which=args.which, file=args.file, z=args.zip_first, encrypt_first=args.encrypt_first, pwd=args.pwd, key=args.key, overwrite=True)
42
-
43
-
44
- if __name__ == "__main__":
45
- arg_parser()
@@ -1,28 +0,0 @@
1
-
2
- from crocodile.file_management import Path as P
3
- from machineconfig.utils.utils import PROGRAM_PATH
4
- import argparse
5
-
6
- base_dir = P.home().joinpath("dotfiles/gpt/prompts")
7
-
8
-
9
- def main():
10
- api_key = P.home().joinpath("dotfiles/creds/tokens/openai_api.txt").read_text().lstrip().rstrip()
11
- parser = argparse.ArgumentParser()
12
- parser.add_argument("--base", "-b", default=None, type=str)
13
- args = parser.parse_args()
14
- if args.base is not None:
15
- base_txt = base_dir.joinpath(args.base)
16
- print(base_txt)
17
- cmd = f"""
18
- $base = $(cat {base_txt})
19
- chatgpt --base_prompt $base
20
- """
21
- else:
22
- cmd = f"""
23
- """
24
- PROGRAM_PATH.write_text(cmd)
25
-
26
-
27
- if __name__ == '__main__':
28
- main()
@@ -1,25 +0,0 @@
1
-
2
- import crocodile.toolbox as tb
3
- from machineconfig.utils.utils import display_options
4
-
5
-
6
- descriptive_themes = ["cupcake", "doubletime", "zork", "slick", "powerline-multiline", "font"]
7
-
8
-
9
- def main(new_theme=None):
10
- profile = tb.P.home().joinpath(".bashrc")
11
- current_theme = tb.L(profile.read_text().splitlines()).filter(lambda x: "OSH_THEME=" in x)[0].split("=")[1]
12
- themes = tb.P.home().joinpath(".oh-my-bash/themes").search("*", not_in=["THEMES.md"]).apply(lambda x: x.trunk)
13
- themes.list.sort()
14
- if new_theme is None:
15
- tail = "Recomm: "
16
- new_theme = display_options(msg=f"Choose a theme number from the list above: ", options=list(themes) + ["slick", "surprise me"], default="surprise me", tail=tail,
17
- prompt=f"Recommended descriptive ones are {descriptive_themes}")
18
- if new_theme == "surprise me": new_theme = themes.sample()[0]
19
- print("Current Theme:", current_theme)
20
- print("New theme: ", f'"{new_theme}"') #
21
- profile.modify_text(txt_search=current_theme, txt_alt=f'"{new_theme}"', replace_line=False)
22
-
23
-
24
- if __name__ == '__main__':
25
- pass
@@ -1,40 +0,0 @@
1
-
2
-
3
- import crocodile.toolbox as tb
4
- from machineconfig.utils.utils import display_options
5
-
6
-
7
- descriptive_themes = ["markbull", "peru", "mojada", "festivetech", "sorin", "agnosterplus", "blueish",
8
- "thecyberden", "plague", "kali", "fish", "ys", "slim", "paradox", "aliens", "atomicBit"]
9
-
10
-
11
- def main(new_theme=None):
12
- """This is a helper for a powershell script.
13
- run this function to interactively choose a style. Optionally, inpsect the themes of oh my posh and select one:
14
- """
15
- import os
16
- themes_path = tb.P(os.environ["POSH_THEMES_PATH"])
17
- # current_theme = tb.P(os.environ["POSH_THEME"]).trunk
18
- profile = tb.Terminal().run("$profile", shell="pwsh").op2path()
19
- current_theme = tb.P(tb.L(profile.read_text().split(" ")).filter(lambda x: ".omp.json" in x)[0]).expanduser().absolute().trunk
20
-
21
- if new_theme == "manual":
22
- tb.P("https://ohmyposh.dev/docs/themes").start() # replace ~/jan... with full path to theme. use: start $profile
23
- new_theme = input(f"A chrome tab with styles is opened, choose one and put its name here: [jandedobbeleer] ")
24
- if new_theme == "show":
25
- __import__("os").system("Write-Host Get-PoshThemes")
26
- return ""
27
- if new_theme is None:
28
- themes = themes_path.search().apply(lambda x: x.trunk)
29
- themes.list.sort()
30
- tail = ""
31
- new_theme = display_options(msg=f"Choose a theme number from the list above: ", tail=tail, options=list(themes) + ["suprise me"], default="suprise me",
32
- prompt=f"Recommended descriptive ones are {descriptive_themes}")
33
- if new_theme == "suprise me": new_theme = themes.sample()[0]
34
- print("Current Theme:", current_theme)
35
- print("New theme: ", new_theme)
36
- profile.modify_text(txt_search=current_theme, txt_alt=new_theme, replace_line=False)
37
-
38
-
39
- if __name__ == '__main__':
40
- pass
@@ -1,42 +0,0 @@
1
-
2
- import crocodile.toolbox as tb
3
- import argparse
4
-
5
-
6
- def arg_parser():
7
- parser = argparse.ArgumentParser(description='Cloud Download CLI.')
8
-
9
- # positional argument
10
- parser.add_argument("file", help="file/folder path to be received.")
11
- # FLAGS
12
- # parser.add_argument("--recursive", "-r", help="Send recursively.", action="store_true") # default is False
13
- parser.add_argument("--decrypt", "-e", help="Decrypt after receiving.", action="store_true") # default is False
14
- parser.add_argument("--unzip", "-z", help="unzip after receiving.", action="store_true") # default is False
15
- parser.add_argument("--overwrite", "-w", help="Overwrite existing file.", action="store_true") # default is False
16
- # optional argument
17
- parser.add_argument("--cloud", "-c", help="rclone cloud profile name.", default=None)
18
- parser.add_argument("--localpath", "-l", help="Local path to save to.", default=None)
19
- parser.add_argument("--remote_dir", "-d", help="Remote directory to send to.", default="")
20
- parser.add_argument("--relative_to_home", "-r", help="Relative to `myhome` folder", action="store_true") # default is False
21
- parser.add_argument("--os_specific", "-o", help="OS specific path (relevant only when relative flag is raised as well.", action="store_true")
22
- parser.add_argument("--key", "-k", help="Key for encryption", default=None)
23
- parser.add_argument("--pwd", "-p", help="Password for encryption", default=None)
24
-
25
- args = parser.parse_args()
26
-
27
- if args.cloud is None:
28
- _path = tb.P.home().joinpath("dotfiles/config/setup/rclone_remote")
29
- try: cloud = _path.read_text().replace("\n", "")
30
- except FileNotFoundError:
31
- print(f"No cloud profile found @ {_path}, please set one up or provide one via the --cloud flag.")
32
- return ""
33
- else: cloud = args.cloud
34
-
35
- tb.P(args.file).from_cloud(cloud=cloud, localpath=args.localpath,
36
- unzip=args.unzip, decrypt=args.decrypt, overwrite=args.overwrite,
37
- pwd=args.pwd, key=args.key,
38
- rel2home=args.relative_to_home, os_specific=args.os_specific,)
39
-
40
-
41
- if __name__ == "__main__":
42
- arg_parser()
@@ -1,40 +0,0 @@
1
-
2
- import crocodile.toolbox as tb
3
- import argparse
4
- # import subprocess
5
-
6
-
7
- def args_parser():
8
- parser = argparse.ArgumentParser(description='Cloud Management CLI.')
9
-
10
- # positional argument
11
- parser.add_argument("file", help="file/folder path.")
12
- # FLAGS
13
- parser.add_argument("--zip", "-z", help="Zip before sending.", action="store_true") # default is False
14
- parser.add_argument("--encrypt", "-e", help="Encrypt before sending.", action="store_true") # default is False
15
- parser.add_argument("--relative_to_home", "-r", help="set remote path as home relative local path.", action="store_true") # default is False
16
- parser.add_argument("--os_specific", "-o", help="OS specific path (relevant only when relative flag is raised as well.", action="store_true")
17
- parser.add_argument("--share", "-s", help="Share file.", action="store_true")
18
- # optional argument
19
- parser.add_argument("--cloud", "-c", help="rclone cloud profile name.", default=None)
20
- parser.add_argument("--remote_dir", "-d", help="Remote directory to send to.", default="")
21
- parser.add_argument("--key", "-k", help="Key for encryption", default=None)
22
- parser.add_argument("--pwd", "-p", help="Password for encryption", default=None)
23
-
24
- args = parser.parse_args()
25
-
26
- if args.cloud is None:
27
- _path = tb.P.home().joinpath("dotfiles/config/setup/rclone_remote")
28
- try: cloud = _path.read_text().replace("\n", "")
29
- except FileNotFoundError:
30
- print(f"No cloud profile found @ {_path}, please set one up or provide one via the --cloud flag.")
31
- return ""
32
- else: cloud = args.cloud
33
-
34
- res = tb.P(args.file).to_cloud(cloud=cloud, zip=args.zip, rel2home=args.relative_to_home,
35
- share=args.share, key=args.key, pwd=args.pwd, encrypt=args.encrypt, os_specific=args.os_specific,)
36
- if args.share: print(res.as_url_str())
37
-
38
-
39
- if __name__ == "__main__":
40
- args_parser()
@@ -1,37 +0,0 @@
1
-
2
- import argparse
3
- from crocodile.toolbox import SSH
4
- import crocodile.toolbox as tb
5
-
6
-
7
- def main():
8
- parser = argparse.ArgumentParser(description='FTP client')
9
-
10
- parser.add_argument("machine", help=f"machine ssh address", default="")
11
- parser.add_argument("file", help="file/folder path.", default="")
12
- # FLAGS
13
- parser.add_argument("--recursive", "-r", help="Send recursively.", action="store_true") # default is False
14
- parser.add_argument("--zipFirst", "-z", help="Zip before sending.", action="store_true") # default is False
15
-
16
- parser.add_argument("-d", "--destination", help=f"destination folder", default=None)
17
-
18
- args = parser.parse_args()
19
- import paramiko
20
- try:
21
- ssh = SSH(rf'{args.machine}')
22
- except paramiko.ssh_exception.AuthenticationException:
23
- print("Authentication failed, trying manually:")
24
- print(f"Caution: Ensure that username is passed appropriately as this exception only handles password.")
25
- import getpass
26
- pwd = getpass.getpass()
27
- ssh = SSH(rf'{args.machine}', pwd=pwd)
28
-
29
- received_file = ssh.copy_to_here(source=args.file, target=args.destination, z=args.zipFirst, r=args.recursive)
30
- # ssh.print_summary()
31
-
32
- if tb.P(args.file).is_dir(): print(f"Use: cd {repr(tb.P(args.file).expanduser())}")
33
- elif received_file is not None: print(f"Received: {repr(received_file.parent), repr(received_file)}")
34
-
35
-
36
- if __name__ == '__main__':
37
- main()
@@ -1,36 +0,0 @@
1
-
2
- import argparse
3
- from crocodile.toolbox import SSH
4
-
5
-
6
- def main():
7
- parser = argparse.ArgumentParser(description='FTP client')
8
-
9
- parser.add_argument("machine", help=f"machine ssh address", default="")
10
- parser.add_argument("file", help="file/folder path.", default="")
11
-
12
- # FLAGS
13
- parser.add_argument("--recursive", "-r", help="Send recursively.", action="store_true") # default is False
14
- parser.add_argument("--zipFirst", "-z", help="Zip before sending.", action="store_true") # default is False
15
-
16
- # optional
17
- parser.add_argument("-d", "--destination", help=f"destination folder", default=None)
18
- # parser.add_argument("-d", "--destination", help=f"destination folder", default=None)
19
-
20
- args = parser.parse_args()
21
- import paramiko
22
- try:
23
- ssh = SSH(rf'{args.machine}')
24
- except paramiko.ssh_exception.AuthenticationException:
25
- print("Authentication failed, trying manually:")
26
- print(f"Caution: Ensure that username is passed appropriately as this exception only handles password.")
27
- import getpass
28
- pwd = getpass.getpass()
29
- ssh = SSH(rf'{args.machine}', pwd=pwd)
30
-
31
- ssh.copy_from_here(source=args.file, target=args.destination, z=args.zipFirst, r=args.recursive)
32
- # ssh.print_summary()
33
-
34
-
35
- if __name__ == '__main__':
36
- main()
@@ -1,15 +0,0 @@
1
-
2
- import crocodile.toolbox as tb
3
- import sys
4
- from crocodile.msc.odds import capture_from_webcam
5
-
6
- img_path = capture_from_webcam(show=False, wait=False, save=True)
7
- # img_rgb = cv2.cvtColor(img_cv, cv2.COLOR_BGR2RGB)
8
- # import cv2
9
- # img_cv = cv2.imread(r'C:\Users\alex\Downloads\name.jpg')
10
-
11
- # sys.path.insert(0, tb.P.home().joinpath("AppData/Local/Tesseract-OCR").str)
12
- # import pytesseract
13
- # print(pytesseract.image_to_string(img_cv))
14
-
15
- q = tb.Terminal().run(f"cd ~/AppData/Local/Tesseract-OCR; pytesseract '{img_path}'", shell="pwsh").capture().op
@@ -1,28 +0,0 @@
1
-
2
- import argparse
3
- import configparser
4
- from pathlib import Path
5
- import random
6
- import string
7
- import os
8
-
9
-
10
- def get_conn_string(sess_name):
11
- creds = configparser.ConfigParser()
12
- creds.read(Path.home().joinpath('dotfiles/creds/tmate/creds.ini'))
13
- sess_name = creds['sessions_names'][sess_name]
14
- user_name = creds['keys']['username']
15
- return f"{user_name}/{sess_name}@sgp1.tmate.io"
16
-
17
-
18
- def main():
19
- parser = argparse.ArgumentParser(description='Tmate launcher')
20
- parser.add_argument("sess_name", help=f"session name", default=random.choices(list(string.digits + string.ascii_letters), k=20))
21
- args = parser.parse_args()
22
- conn_string = get_conn_string(args.sess_name)
23
- print(f"ssh {conn_string}")
24
- os.system(f"ssh {conn_string}")
25
-
26
-
27
- if __name__ == '__main__':
28
- main()
@@ -1,31 +0,0 @@
1
-
2
- import argparse
3
- import configparser
4
- from pathlib import Path
5
- import random
6
- import string
7
- import os
8
-
9
-
10
- # TODO make it automatically start a zellij session and pick appropraite tmate session matching machine name
11
-
12
-
13
- def main():
14
- creds = configparser.ConfigParser()
15
- creds.read(Path.home().joinpath('dotfiles/creds/tmate/creds.ini'))
16
-
17
- parser = argparse.ArgumentParser(description='Tmate launcher')
18
- random_sess = random.choices(list(string.digits + string.ascii_letters), k=20)
19
- _ = random_sess
20
- parser.add_argument("sess_name", help=f"session name (new only with random string will be chosen if not passed)", default=None)
21
-
22
- args = parser.parse_args()
23
-
24
- sess_name = creds['sessions_names'][args.sess_name]
25
- api_key = creds['keys']['api_key']
26
- res = f"tmate -a ~/.ssh/authorized_keys -k {api_key} -n {sess_name} -F"
27
- os.system(res)
28
-
29
-
30
- if __name__ == '__main__':
31
- main()
@@ -1,7 +0,0 @@
1
-
2
- import crocodile.toolbox as tb
3
-
4
- pi = tb.install_n_import("pyinstaller")
5
- target = tb.P.tmpdir()
6
-
7
- tb.Terminal().run(f"pyinstaller --onefile {tb.P(__file__).abspath()} --distpath {target.abspath()}")