init-honorscollege.el 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. (defun purdue-view-this-file-in-dev-server ()
  2. "View the current file in your browser. Since anything under community is now wordpress, then if the user wants to
  3. view the community page, show him the qa server."
  4. (interactive)
  5. (require 's)
  6. (let (url dev-string qa-string)
  7. (setq dev-string "https://dev.honors.purdue.edu/")
  8. (setq qa-string "https://qa.honors.purdue.edu/")
  9. (if (s-match "community" buffer-file-name)
  10. (setq url (concat qa-string (s-chop-prefix "/srv/http/honorscollege/" buffer-file-name)))
  11. (setq url (concat dev-string (s-chop-prefix "/srv/http/honorscollege/" buffer-file-name))))
  12. (browse-url url)))
  13. (defun purdue-view-this-file-locally ()
  14. "View the current file in your browser. Since anything under community is now wordpress, then if the user wants to
  15. view o community page, show him the qa server."
  16. (interactive)
  17. (require 's)
  18. (let (url local-string wd prefix) ;; wd == working directory
  19. (setq wd (pwd))
  20. (setq local-string "localhost/honorscollege/")
  21. (if (s-contains? "/srv" buffer-file-name)
  22. (setq prefix "/srv/http/honorscollege/")
  23. (setq prefix "/home/joshua/honorscollege/"))
  24. (setq url (concat local-string
  25. (s-chop-prefix prefix buffer-file-name)))
  26. (browse-url url)))
  27. (defun my-rsync-honors-purdue-edu-function ()
  28. "Minifying my css files."
  29. (interactive)
  30. (async-shell-command (concat (format "yuicompressor --type css %s -o "
  31. (buffer-file-name))
  32. (s-replace ".css" ".min.css" buffer-file-name)) "*css minifying*"))
  33. ;; (start-process "my-process" "foo" "ls" "-l" "/home/joshua/")
  34. ;; (get-process "foo")
  35. ;; (get-process "my-process")
  36. ;; (list-processes)
  37. ;; (process-status "my-process")
  38. ;; (process-status (get-buffer "my-honors-purdue-edu-rysnc-buffer"))
  39. ;; rsync -vrn /home/joshua/honorscollege/ jbranso@dev.www.purdue.edu:/home/users/jbranso/HTML/honorscollege/
  40. ;; (start-process "my-honors-purdue-edu-rsync" "my-honors-purdue-edu-rsync-buffer"
  41. ;; "rsync" "-vr" "--exclude=*gitignore" "--exclude=*git" "--exclude=*assets" "/home/joshua/honorscollege/" "jbranso@dev.www.purdue.edu:/home/users/jbranso/HTML/honorscollege/" )
  42. ;; (auth-source-search :host "dev.www.purdue.edu"
  43. ;; ;;:type 'netrc :max 1
  44. ;; ;;:P "pppp" :Q "qqqq"
  45. ;; :require '(:secret)
  46. ;; )
  47. (setq auth-source-debug t)
  48. ;;(setq auth-sources '("~/.authinfo"))
  49. (defun get-secret-password ()
  50. (interactive)
  51. (let ((found
  52. (if (fboundp 'auth-source-search)
  53. (auth-source-search
  54. ;;:max 1
  55. :host "dev.www.purdue.edu"
  56. ;;:require '(:secret)
  57. )
  58. )))
  59. (if found
  60. (let ((secret (plist-get found :secret)))
  61. (if (functionp secret)
  62. (funcall secret)
  63. secret))
  64. ;; (let ((prompt (format "Jabber password for %s: " bare-jid)))
  65. ;; (if (require 'password-cache nil t)
  66. ;; ;; Need to copy the password, as sasl.el wants to erase it.
  67. ;; (copy-sequence
  68. ;; (password-read prompt (jabber-password-key bare-jid)))
  69. ;; (read-passwd prompt)))
  70. )
  71. ))
  72. ;;(add-hook 'css-mode-hook '(lambda ()
  73. ;;(add-hook 'after-save-hook 'my-rsync-honors-purdue-edu-function nil t)))
  74. (provide 'init-honorscollege)