Add sudo-shell-command and reset-dnsresponder

This commit is contained in:
Jeremy Dormitzer 2019-05-13 08:38:04 -04:00
parent b83ab36a21
commit 9bf2fa3a06

View File

@ -309,6 +309,14 @@ The same function but for commands that need to run in a shell:
(buffer-substring-no-properties (point-min) (point-max))))))
#+END_SRC
Running a shell command as sudo:
#+BEGIN_SRC emacs-lisp
(defun sudo-shell-command (command)
(with-temp-buffer
(cd "/sudo::/")
(shell-command command)))
#+END_SRC
* Customization File
I don't want anything to write to my init.el, so save customizations in a separate file:
#+BEGIN_SRC emacs-lisp
@ -2857,6 +2865,12 @@ The aws-mfa command:
(leader-def-key "ao" #'op-copy-password)
#+END_SRC
** Resetting DNSResponder
#+BEGIN_SRC emacs-lisp
(defun reset-dnsresponsder ()
(interactive)
(sudo-shell-command "killall -HUP mDNSResponder"))
#+END_SRC
* StumpWM
A handy keybinding to connect to the StumpWM SBCL process via SLIME:
#+BEGIN_SRC emacs-lisp