From 1e392aa7a7a4054cff694a6d553fa4b0206f8650 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 15 Oct 2021 10:40:32 -0400 Subject: [PATCH] Add COF changes --- emacs/.emacs.d/config/init-cof.el | 30 +++++++++++++++++++++++++ emacs/.emacs.d/config/init-dashboard.el | 4 ++-- emacs/.emacs.d/config/init-epub.el | 1 + emacs/.emacs.d/config/init-ui.el | 2 ++ emacs/.emacs.d/init.el | 1 + zsh/.zshrc | 17 ++++++++++++++ 6 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 emacs/.emacs.d/config/init-cof.el diff --git a/emacs/.emacs.d/config/init-cof.el b/emacs/.emacs.d/config/init-cof.el new file mode 100644 index 0000000..7bfa915 --- /dev/null +++ b/emacs/.emacs.d/config/init-cof.el @@ -0,0 +1,30 @@ +;; -*- lexical-binding: t; -*- +(defun set-proxy (proxy) + (setq url-proxy-services + `(("https" . ,proxy) + ("http" . ,proxy) + ("no_proxy" . "^\\(127\\.0\\.0\\.1\\|localhost\\|.*local\\|169\\.254\\.169\\.254\\|.*kdc\\.capitalone\\.com\\|.*cloud\\.capitalone\\.com\\|.*clouddqt\\.capitalone.com\\)"))) + (setenv "https_proxy" proxy) + (setenv "http_proxy" proxy) + (setenv "no_proxy" "127.0.0.1,localhost,.local,.internal,169.254.169.254,.kdc.capitalone.com,.cloud.capitalone.com,.clouddqt.capitalone.com,.cloud.uk.capitalone.com,.clouddqt.uk.capitalone.com")) + +(defun cofproxy () + (interactive) + (request "http://127.0.0.1:44444/proxy.pac" + :sync t + :success (cl-function + (lambda (&key data &allow-other-keys) + (let ((line)) + (with-temp-buffer + (insert data) + (search-backward "return \"PROXY") + (setq line (string-trim (thing-at-point 'line t)))) + (setq line (string-trim-right + (string-trim-left line "return \"PROXY ") "\";")) + (setq line (concat "http://" line)) + (set-proxy line) + (message "Proxy Set: %s" line)))))) + +(add-hook 'after-init-hook #'cofproxy) + +(provide 'init-cof) diff --git a/emacs/.emacs.d/config/init-dashboard.el b/emacs/.emacs.d/config/init-dashboard.el index 0e8ad55..e5912b0 100644 --- a/emacs/.emacs.d/config/init-dashboard.el +++ b/emacs/.emacs.d/config/init-dashboard.el @@ -4,8 +4,8 @@ (use-package dashboard :demand t :config - (when (file-exists-p (expand-file-name "~/Sync/pictures/hallows.png")) - (setq dashboard-startup-banner (expand-file-name "~/Sync/pictures/hallows.png"))) + (when (file-exists-p (expand-file-name "~/Pictures/hallows.png")) + (setq dashboard-startup-banner (expand-file-name "~/Pictures/hallows.png"))) (dashboard-setup-startup-hook) (evil-collection-dashboard-setup) :custom diff --git a/emacs/.emacs.d/config/init-epub.el b/emacs/.emacs.d/config/init-epub.el index 158166f..253ff35 100644 --- a/emacs/.emacs.d/config/init-epub.el +++ b/emacs/.emacs.d/config/init-epub.el @@ -1,6 +1,7 @@ ;; -*- lexical-binding: t; -*- (use-package nov + :straight (:host github :repo "wasamasa/nov.el") :mode (("\\.epub\\'" . nov-mode)) :config (evil-collection-nov-setup)) diff --git a/emacs/.emacs.d/config/init-ui.el b/emacs/.emacs.d/config/init-ui.el index 38657cb..0a3b728 100644 --- a/emacs/.emacs.d/config/init-ui.el +++ b/emacs/.emacs.d/config/init-ui.el @@ -13,6 +13,8 @@ ;; Doom themes are the best themes! (use-package doom-themes) +(use-package shrink-path + :straight (:host github :repo "zbelial/shrink-path.el")) (use-package doom-modeline :config (doom-modeline-mode 1)) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 655b465..7d435a2 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -117,6 +117,7 @@ (require 'init-elfeed) (require 'init-1pass) (require 'init-wallabag) +(require 'init-cof) (require 'init-lola) (require 'handwriting) diff --git a/zsh/.zshrc b/zsh/.zshrc index 807998d..70cd856 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -162,3 +162,20 @@ vterm_prompt_end() { } setopt PROMPT_SUBST PROMPT=$PROMPT'%{$(vterm_prompt_end)%}' + +# Workaround for COF VPN issues +function nukevpn() { + for x in `ps aux | grep svpn | grep -v grep | awk '{ print $2 }'` + do + printf "\n Killing... \n `ps ${x}` \n" + kill -15 $x + done + printf "\n Checking for running processes...(grep is expected) \n" + sleep 3 + printf "\n `ps aux | grep svpn` \n" +} + +if [ -f /usr/local/cof/bin/cofproxy ] #source_cofproxy +then + cofproxy dev +fi #source_cofproxy