admin.lisp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. (in-package :stumpwm)
  2. (defcommand suspend () ()
  3. (if (y-or-n-p "Suspend the system? ")
  4. (run-shell-command "sudo loginctl suspend")))
  5. (defcommand halt () ()
  6. (if (y-or-n-p "Halt the system? ")
  7. (run-shell-command "sudo halt")))
  8. (defcommand neofetch () ()
  9. (term-shell-command "sh -c 'neofetch; read'"))
  10. ;;;
  11. ;;; Monitoring
  12. ;;;
  13. (defcommand glances () ()
  14. (term-shell-command "glances"))
  15. (defcommand sampler () ()
  16. (term-shell-command "sampler -c ~/.config/sampler/config.yaml"
  17. :color "dark"
  18. :font '("-fa" "Monospace" "-fs" "10")))
  19. (defcommand htop () ()
  20. (term-shell-command "htop"))
  21. (defcommand monitoring () ()
  22. (term-shell-command "tmuxifier load-session monitoring"))
  23. (defcommand top () ()
  24. (term-shell-command "top"))
  25. (defcommand xpanes-top () ()
  26. (term-shell-command "xpanes -t -C 1 -c 'autossh -M0 -t {} -- top -d 10' localhost spb workstation.intr ci.intr kvm15.intr oracle"
  27. :terminal 'st
  28. :title "xpanes-top"
  29. :font "Monospace:size=6"))
  30. ;;;
  31. ;;; SSH
  32. ;;;
  33. (defcommand insert-ssh-key () ()
  34. (window-send-string
  35. (format nil "mkdir ~~/.ssh; cat >> ~~/.ssh/authorized_keys <<'EOF'~%~aEOF"
  36. (file-get-contents
  37. (first
  38. (select-from-menu
  39. (current-screen)
  40. (mapcar (lambda (path)
  41. (format nil "~f" path))
  42. (uiop/filesystem:directory-files (concat (getenv "HOME") "/.ssh") "*.pub"))))))))
  43. (defcommand xpanes-guix () ()
  44. (term-shell-command "xpanes -t -C 1 -c 'ssh -t {}' guixsd workstation.intr spb"
  45. :color 'dark))