Skip to content

Instantly share code, notes, and snippets.

@sorenmacbeth
Forked from ieure/ercstuff.el
Created May 25, 2012 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorenmacbeth/2785206 to your computer and use it in GitHub Desktop.
Save sorenmacbeth/2785206 to your computer and use it in GitHub Desktop.
(defvar upside-down-alist
'((?a . ?ɐ)
(?b . ?q)
(?c . ?ɔ)
(?d . ?p)
(?e . ?ǝ)
(?f . ?ɟ)
(?g . ?ƃ)
(?h . ?ɥ)
(?i . ?ı)
(?j . ?ɾ)
(?k . ?ʞ)
(?l . ?l)
(?m . ?ɯ)
(?n . ?u)
(?o . ?o)
(?p . ?d)
(?q . ?b)
(?r . ?ɹ)
(?s . ?s)
(?t . ?ʇ)
(?u . ?n)
(?v . ?ʌ)
(?w . ?ʍ)
(?x . ?x)
(?y . ?ʎ)
(?z . ?z)
(?A . ?∀)
(?B . ?B)
(?C . ?Ɔ)
(?D . ?D)
(?E . ?Ǝ)
(?F . ?Ⅎ)
(?G . ?פ)
(?H . ?H)
(?I . ?I)
(?J . ?ſ)
(?K . ?K)
(?L . ?˥)
(?M . ?W)
(?N . ?N)
(?O . ?O)
(?P . ?Ԁ)
(?Q . ?Q)
(?R . ?R)
(?S . ?S)
(?T . ?┴)
(?U . ?∩)
(?V . ?Λ)
(?W . ?M)
(?X . ?X)
(?Y . ?⅄)
(?Z . ?Z)
(?0 . ?0)
(?1 . ?Ɩ)
(?2 . ?ᄅ)
(?3 . ?Ɛ)
(?4 . ?ㄣ)
(?5 . ?ϛ)
(?6 . ?9)
(?7 . ?ㄥ)
(?8 . ?8)
(?9 . ?6)
(?, . ?')
(?. . ?˙)
(?? . ?¿)
(?! . ?¡)
(?\" . ?,)
(?' . ?,)
(?` . ?,)
(?( . ?))
(?) . ?()
(?[ . ?])
(?] . ?[)
(?{ . ?})
(?} . ?{)
(?< . ?>)
(?< . ?<)
(?& . ?⅋)
(?_ . ?‾)))
(defvar upside-down-table (make-translation-table upside-down-alist))
(defun flip-text (text)
(with-temp-buffer
(insert (apply 'string (reverse (string-to-list text))))
(translate-region (point-min) (point-max) upside-down-table)
(buffer-substring (point-min) (point-max))))
(eval-after-load 'erc
'(progn
(define-key erc-mode-map "\C-c\C-c" nil)
(defadvice erc-send-current-line (before expand-input activate)
"Expand input before sending"
(expand-abbrev))))
(eval-after-load 'erc-button
'(progn
(defadvice erc-button-press-button (after end-on-press last nil activate)
(end-of-buffer))
(defun erc-next-link (arg)
"Move point to the ARGth URL, or the end of the buffer if none."
(interactive "p")
(or (re-search-forward erc-button-url-regexp (point-max) t arg)
(goto-char (point-max))))
(defun erc-previous-link (arg)
"Move point to the ARGth most recent URL."
(interactive "p")
(when (looking-at erc-button-url-regexp)
(re-search-backward "\\\s"))
(re-search-backward erc-button-url-regexp 0 t))
(define-key erc-mode-map "\C-cp" 'erc-previous-link)
(define-key erc-mode-map "\C-cn" 'erc-next-link)))
(defun erc-freenode ()
(interactive)
(erc-select :server "irc.freenode.net" :nick "sorenmacbeth"))
(defun erc-cmd-PUNCH (&rest nick)
(let ((places '("arm" "leg" "face" "gut" "neck" "head" "coccyx")))
(erc-send-action (erc-default-target)
(concat "punches " (car nick)
" in the "
(nth (random (length places)) places)))))
(defun erc-cmd-CRICKETS ()
(erc-send-message "http://instantcrickets.com/"))
(defun erc-cmd-RIMSHOT ()
(erc-send-message "http://instantrimshot.com/"))
(defun erc-cmd-SADTROMBONE ()
(erc-send-message "http://sadtrombone.com/"))
(defun erc-cmd-FORTUNE ()
(erc-send-message
(save-window-excursion
(with-temp-buffer
(fortune)
(trim
(replace-regexp-in-string
"\n+" " " (buffer-substring (point-min) (point-max))))))))
(defun erc-cmd-EXCUSE ()
(erc-send-message
(save-window-excursion
(with-temp-buffer
(fortune "~/.fortune/bofh-excuses")
(trim
(replace-regexp-in-string
"\n+" " " (buffer-substring (point-min) (point-max))))))))
(defun erc-cmd-FLIP (&rest words)
(let ((subj (if words (flip-text (mapconcat 'identity words " "))
"┻━┻")))
(erc-send-message
(mapconcat 'identity (list "(╯°□°)╯︵ " subj) ""))))
(defun erc-cmd-CALM ()
(erc-send-message "┬─┬ノ(º_ºノ)"))
(defun erc-cmd-THROW (&rest words)
(let ((subj (if words (flip-text (mapconcat 'identity words " ")) "┻━┻")))
(erc-send-message (mapconcat 'identity (list "(ノಠ益ಠ)ノ彡" subj) ""))))
(defun erc-cmd-DUNNO ()
(erc-send-message "¯\(°_o)/¯"))
(defun erc-cmd-WAVE ()
(erc-send-message "http://i.imgur.com/jNFqw.gif"))
(defun erc-cmd-PIZZA ()
(erc-send-message "http://www.youtube.com/watch?v=FsJhfwbfMvU"))
(defun erc-browse-twitter-user (user)
(browse-url (format "https://twitter.com/#!/%s" user)))
(defun erc-cmd-LMGTFY (what)
(require 'url)
(erc-send-message
(format "http://lmgtfy.com/?q=%s" (url-hexify-string what))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment