From fb5d9c7ec308003dfcc1d9b4a6a522075f23024d Mon Sep 17 00:00:00 2001 From: John Doty Date: Fri, 26 May 2023 06:13:55 -0700 Subject: [PATCH 1/4] Format on save --- .emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ccb7e57..e91a9bf 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -367,6 +367,7 @@ (c++-mode . eglot-ensure) (c-mode . eglot-ensure) (go-mode . eglot-ensure) ;; 2022-07-29 Add eglot for go + (before-save . eglot-format) ;; 2023-05-25 Format buffers on save :bind ("C-c \\" . eglot-code-actions) ;; 2022-07-29 I want to make code actions easier. :config From b132f553ea978e1a535f4047fb7f581ae37db241 Mon Sep 17 00:00:00 2001 From: John Doty Date: Fri, 26 May 2023 06:14:45 -0700 Subject: [PATCH 2/4] custom --- .emacs.d/custom.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/custom.el b/.emacs.d/custom.el index 2a04d2d..4d6ffe8 100644 --- a/.emacs.d/custom.el +++ b/.emacs.d/custom.el @@ -58,7 +58,7 @@ '(org-odd-levels-only t) '(org-todo-keywords '((sequence "TODO" "|" "DONE" "ABANDONED" "DEFERRED"))) '(package-selected-packages - '(earthfile-mode compat adaptive-wrap terraform-mode deadgrep protobuf-mode bazel howm python-mode color-theme-sanityinc-solarized monokai-theme rust-mode tide typescript-mode modus-themes tree-sitter flycheck-rust eglot ink-mode prettier-js zig-mode esup gnu-elpa-keyring-update lsp-hack hack-mode filladapt lsp-ui yaml-mode wgrep fsharp-mode company-lsp cquery mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode tss switch-window paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi elm-mode monky color-theme-sanityinc-tomorrow)) + '(nyan-mode earthfile-mode compat adaptive-wrap terraform-mode deadgrep protobuf-mode bazel howm python-mode color-theme-sanityinc-solarized monokai-theme rust-mode tide typescript-mode modus-themes tree-sitter flycheck-rust eglot ink-mode prettier-js zig-mode esup gnu-elpa-keyring-update lsp-hack hack-mode filladapt lsp-ui yaml-mode wgrep fsharp-mode company-lsp cquery mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode tss switch-window paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi elm-mode monky color-theme-sanityinc-tomorrow)) '(reb-re-syntax 'string) '(rmail-mail-new-frame t) '(safe-local-variable-values From b97c87c6db31e785dc49262d3a3e55deb010ee3b Mon Sep 17 00:00:00 2001 From: John Doty Date: Fri, 26 May 2023 06:14:57 -0700 Subject: [PATCH 3/4] Fixup debug ephemeral --- scripts/debug_ephemeral.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/scripts/debug_ephemeral.py b/scripts/debug_ephemeral.py index bbdc93a..531a4be 100644 --- a/scripts/debug_ephemeral.py +++ b/scripts/debug_ephemeral.py @@ -29,14 +29,17 @@ def slug(): def get_default_target(namespace, pod): - pod = json.loads( - subprocess.run( - ["kubectl", "get", "pod", "--namespace", namespace, pod, "-o", "json"], - check=True, - capture_output=True, - encoding="utf-8", - ).stdout + kubectl = subprocess.run( + ["kubectl", "get", "pod", "--namespace", namespace, pod, "-o", "json"], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + encoding="utf-8", ) + if kubectl.returncode != 0: + print(f"Unable to find job: {kubectl.stdout}") + sys.exit(1) + + pod = json.loads(kubectl.stdout) annotation_default = ( pod.get("metadata", {}) @@ -62,14 +65,14 @@ def get_pod_container_state(namespace, pod, container): statuses = pod.get("status", {}).get("ephemeralContainerStatuses", []) for status in statuses: if status.get("name", None) != container: - state_keys = list(status.get("state", {"waiting": {}}).keys()) + state_keys = list(status.get("state", {}).keys()) if len(state_keys) == 0: - return "waiting" + return "no keys" if len(state_keys) > 1: - return "INTERNAL ERROR" + return "internal error" return state_keys[0] - return None + return f"not found in pod {pod}" def create_debugger_container(namespace, pod, target, image): @@ -83,7 +86,9 @@ def create_debugger_container(namespace, pod, target, image): service_line = proxy.stdout.readline().decode("utf-8").strip() PREFIX = "Starting to serve on 127.0.0.1:" if not service_line.startswith(PREFIX): - raise Exception("Cannot get the port from the kubectl proxy") + print(f"Cannot get the port from the kubectl proxy: {service_line}") + sys.exit(1) + port = service_line[len(PREFIX) :] # Pod must exist, yay! @@ -128,7 +133,8 @@ def create_debugger_container(namespace, pod, target, image): stderr=subprocess.STDOUT, ) if curl.returncode != 0: - raise Exception(f"curl failed with code {curl.returncode}:\n{curl.stdout}") + print(f"curl failed with code {curl.returncode}: {curl.stdout}") + sys.exit(1) return container_name @@ -152,6 +158,7 @@ def attach_debugger(namespace, pod, target, image): # Wait for the dang container to be ready. for i in range(3000): state = get_pod_container_state(namespace, pod, container) + print(f"{container}: {state}") if state == "running": break time.sleep(0.100) # 100ms From 7c093eb3da2f4425fb52bf666bc9c48579f25ef5 Mon Sep 17 00:00:00 2001 From: John Doty Date: Fri, 26 May 2023 06:15:25 -0700 Subject: [PATCH 4/4] vs goad --- vscode/settings.json | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/vscode/settings.json b/vscode/settings.json index 54062b8..6e3b182 100644 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -1,6 +1,8 @@ { "breadcrumbs.enabled": true, - "editor.rulers": [80], + "editor.rulers": [ + 80 + ], "editor.formatOnSave": true, "editor.formatOnPaste": true, "editor.minimap.enabled": false, @@ -47,7 +49,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[cpp]": { - "editor.defaultFormatter": "nuclide.cpp" + "editor.defaultFormatter": "ms-vscode.cpptools" }, "pyls.BuckFormatOnSave": true, "pyls.formatAlreadyFormattedFilesOnSave": true, @@ -88,10 +90,23 @@ "remote.SSH.showLoginTerminal": true, "remote.SSH.remotePlatform": { "coder.doty-dev": "linux", - "coder.doty-dev2": "linux" + "192.168.0.114": "linux", + "coder-vscode--johndoty--doty-dev": "linux" }, "java.import.maven.enabled": false, "remote.autoForwardPortsSource": "process", "go.toolsManagement.autoUpdate": true, - "bazel.queriesShareServer": true -} + "bazel.queriesShareServer": true, + "remote.portsAttributes": { + "443": { + "protocol": "https" + }, + "8443": { + "protocol": "https" + } + }, + "[python]": { + "editor.formatOnType": true + }, + "git.confirmSync": false +} \ No newline at end of file