Skip to content

Instantly share code, notes, and snippets.

@offby1
Created August 11, 2009 03:35
Show Gist options
  • Select an option

  • Save offby1/165608 to your computer and use it in GitHub Desktop.

Select an option

Save offby1/165608 to your computer and use it in GitHub Desktop.
Nick channels in common with offby1
----------------------------------
fsbot 3 (##cinema #emacs #erc)
a-s 3 (##cinema #emacs #scheme)
brx 3 (##cinema #emacs #scheme)
Sketch 3 (##cinema #emacs #erc)
tarbo_ 3 (#emacs #git #scheme)
Guest59650 3 (#emacs #git #scheme)
Leonidas 3 (#emacs #git #scheme)
r0bby 3 (#emacs #git #scheme)
stepnem 3 (#emacs #git #scheme)
nothingHappens_ 3 (#emacs #git #scheme)
;; modified from something from bpt
(defun erc-rank-stalkers ()
"See who is in the same IRC channels as me."
(interactive)
(let ((tbl (make-hash-table :test 'equal)))
(dolist (buf (erc-channel-list nil))
(message "%s..." (buffer-name buf))
(dolist (nick (mapcar (lambda (thing) (aref (car thing) 1))
(with-current-buffer buf (erc-get-channel-user-list))))
(when (not (equal nick erc-nick))
(puthash nick (cons (buffer-name buf)
(gethash nick tbl '()))
tbl))))
(with-output-to-temp-buffer
"*IRC stalkers*"
(let ((list '()))
(maphash (lambda (k v) (push (cons k v) list)) tbl)
(setq list (sort* list '> :key (lambda (thing)
(length (cdr thing)))))
(princ (format "%-15s %s %s\n" "Nick" "channels in common with" erc-nick))
(princ "----------------------------------\n")
(let ((count 1))
(while (and (not (null list)) (< count 11))
(princ (let ((x (pop list)))
(format "%-15s %d %s\n"
(car x)
(length (cdr x))
(sort (cdr x) 'string-lessp))))
(incf count)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment