a5de24e85f19

Add lisp-talks bot
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 04 Apr 2017 16:20:13 +0200
parents 7dd4cf568944
children 05b19fdfdfb2
branches/tags (none)
files Makefile magitek.asd package.lisp src/main.lisp src/robots/hacker-booze.lisp src/robots/lisp-talks.lisp

Changes

--- a/Makefile	Mon Mar 27 08:46:10 2017 +0200
+++ b/Makefile	Tue Apr 04 16:20:13 2017 +0200
@@ -20,6 +20,6 @@
 	hg -R /home/sjl/cl-losh -v pull -u
 
 deploy: build/magitek
-	rsync --exclude=build/magitek --exclude=.hg --exclude=database.sqlite --exclude=corpora -avz . silt:/home/sjl/magitek
-	ssh silt make -C /home/sjl/magitek update-deps
-	ssh silt make -C /home/sjl/magitek build/magitek
+	rsync --exclude=build/magitek --exclude=.hg --exclude=database.sqlite --exclude=corpora -avz . jam:/home/sjl/magitek
+	ssh jam make -C /home/sjl/magitek update-deps
+	ssh jam make -C /home/sjl/magitek build/magitek
--- a/magitek.asd	Mon Mar 27 08:46:10 2017 +0200
+++ b/magitek.asd	Tue Apr 04 16:20:13 2017 +0200
@@ -15,7 +15,7 @@
                :fare-quasiquote
                :fare-quasiquote-readtable
                :flexi-streams
-               :html-entities
+               ;; :html-entities ; fuck my life
                :iterate
                :jonathan
                :losh
@@ -41,6 +41,7 @@
                              (:file "markov")
                              (:module "robots"
                               :components ((:file "git-commands")
+                                           (:file "lisp-talks")
                                            (:file "hacker-booze")
                                            (:file "frantic-barista")
                                            (:file "rpg-shopkeeper")))
--- a/package.lisp	Mon Mar 27 08:46:10 2017 +0200
+++ b/package.lisp	Tue Apr 04 16:20:13 2017 +0200
@@ -43,6 +43,15 @@
     :magitek.quickutils)
   (:export :random-string))
 
+(defpackage :magitek.robots.lisp-talks
+  (:use
+    :cl
+    :iterate
+    :losh
+    :chancery
+    :magitek.quickutils)
+  (:export :random-string))
+
 (defpackage :magitek.robots.rpg-shopkeeper
   (:use
     :cl
--- a/src/main.lisp	Mon Mar 27 08:46:10 2017 +0200
+++ b/src/main.lisp	Tue Apr 04 16:20:13 2017 +0200
@@ -15,6 +15,11 @@
             #'magitek.robots.git-commands:random-string
             12))
 
+(defparameter *lisp-talks*
+  (make-bot :lisp-talks
+            #'magitek.robots.lisp-talks:random-string
+            12))
+
 (defparameter *rpg-shopkeeper*
   (make-bot :rpg-shopkeeper
             #'magitek.robots.rpg-shopkeeper:random-string 
@@ -60,4 +65,5 @@
   (spinup)
   (run-bot *frantic-barista*)
   (run-bot *git-commands*)
+  (run-bot *lisp-talks*)
   (run-bot *rpg-shopkeeper*))
--- a/src/robots/hacker-booze.lisp	Mon Mar 27 08:46:10 2017 +0200
+++ b/src/robots/hacker-booze.lisp	Tue Apr 04 16:20:13 2017 +0200
@@ -22,10 +22,10 @@
 (defparameter *hn-corpus-path* "corpora/hacker-news.txt")
 
 (defun firebase-get (url)
-  (-> url
+  (-<> url
     drakma:http-request
-    (flex:octets-to-string :external-format :utf-8)
-    (jonathan:parse :as :hash-table)))
+    (flex:octets-to-string <> :external-format :utf-8)
+    (jonathan:parse <> :as :hash-table)))
 
 
 (defun hn-top ()
@@ -45,7 +45,9 @@
 (defun hn-text (comment)
   (-> (gethash "text" comment)
     sanitize:clean
-    html-entities:decode-entities))
+    ;; this is gone from quicklisp because god hates me
+    ;; html-entities:decode-entities
+    ))
 
 
 (defun hn-comments (story-id)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/robots/lisp-talks.lisp	Tue Apr 04 16:20:13 2017 +0200
@@ -0,0 +1,212 @@
+(in-package :magitek.robots.lisp-talks)
+(named-readtables:in-readtable :chancery)
+
+(defun ? (arg)
+  (if (randomp)
+    (format nil "~A " arg)
+    ""))
+
+
+(define-string (dialect :distribution :weighted)
+  (5 "Arc")
+  (5 "Clojurescript")
+  (5 "Picolisp")
+  (1 "Emacs Lisp")
+  (2 "Lisp-Flavored Erlang")
+  (10 "Common Lisp")
+  (10 "Clojure")
+  (10 "Scheme"))
+
+(define-string implementation
+  "Racket"
+  "Guile"
+  "Chicken"
+  "Clasp"
+  "CLISP"
+  "SBCL"
+  "ABCL"
+  "ECL"
+  "CCL")
+
+(define-string language
+  implementation
+  dialect)
+
+(define-string noun
+  "source file"
+  "type"
+  "form"
+  "image"
+  "coffee"
+  "archive"
+  "macro"
+  "number"
+  "float"
+  "class"
+  "struct"
+  "lambda"
+  "compiler macro"
+  "sequence"
+  "HyperSpec"
+  "UltraSpec"
+  "network protocol"
+  "sufficiently-smart compiler"
+  "m-expression"
+  "s-expression")
+
+(define-string editor
+  "Emacs"
+  "Vim"
+  "Neovim"
+  "Sublime Text"
+  "Atom"
+  "Notepad"
+  "Notepad++"
+  "Eclipse"
+  "SLIME"
+  "NREPL"
+  "CIDER"
+  "ed"
+  "acme"
+  "nano"
+  "vi"
+  "IntelliJ")
+
+(define-string editor-or-language
+  editor
+  language)
+
+(define-string people
+  "Lispers"
+  "Schemers"
+  "Clojurists"
+  "Rich Hickey"
+  "the X3J13 committee"
+  "teachers"
+  "programmers"
+  "engineers"
+  "students"
+  "undergrads"
+  "grad students"
+  "PhD students")
+
+(define-string activitying
+  "evaluating"
+  "expanding"
+  "refactoring"
+  "reading"
+  "compiling"
+  "recompiling"
+  "serializing"
+  "typechecking"
+  "parsing")
+
+(define-string activityion
+  "evaluation"
+  "expansion"
+  "compilation"
+  "recompilation"
+  "serialization")
+
+(define-string doer
+  "evaluator"
+  "expander"
+  "reader"
+  "compiler"
+  "recompiler"
+  "serializer"
+  "typechecker"
+  "parser")
+
+(define-string making
+  "writing"
+  "making"
+  "creating")
+
+(define-string adjective
+  "faster"
+  "better"
+  "portable"
+  "easy"
+  "simple"
+  "safer"
+  "complected"
+  "extensible"
+  "strongly-typed"
+  "maintainable"
+  "interactive"
+  "saner"
+  (language :. "-specific"))
+
+(define-string techniques
+  "techniques"
+  "strategies")
+
+
+(define-string talk-demo
+  ("Paredit for" editor-or-language)
+  ("a library for" activitying [noun s] "in" language)
+  ("a portable" noun "library for" dialect)
+  (activitying [noun s] "in" editor))
+
+(define-string talk-parallel
+  (["efficiently" ?] :. "parallelizing" activityion "of" [noun s])
+  (["efficiently" ?] :. "parallelizing" activityion "of" [noun s] "in" language))
+
+(define-string talk-teaching
+  ("teaching" people adjective activitying techniques)
+  ("a masterclass in" making [doer s])
+  ("how to teach" people adjective activityion techniques)
+  ("lessons learned from a class in" [activitying ?] :. [noun s]))
+
+(define-string talk-better
+  (adjective :. "," adjective :. ", and" adjective [noun s])
+  ("writing" adjective :. "," adjective language))
+
+(define-string talk-on
+  ("on" [noun s])
+  ("on" editor-or-language)
+  ("on" people))
+
+(define-string talk-writing
+  ("writing" adjective dialect)
+  ("writing" [adjective a] doer)
+  ("writing" adjective [doer s])
+  ("writing" [adjective a] doer "in" editor-or-language))
+
+(define-string talk-tricks
+  ("stupid" editor "tricks")
+  ("stupid" doer "tricks")
+  ("one weird trick for" adjective activityion "in" editor-or-language))
+
+(define-string talk-x-in-y
+  ("managing" [noun s] "in" language)
+  ("dealing with" [noun s] "in" language)
+  ("dealing with" activityion "in" language)
+  ("DIY" noun :. "-" :. activitying "in" editor-or-language))
+
+(define-string talk-editing
+  ("editing" [adjective ?] :. dialect "faster with" editor))
+
+
+(define-string talk%
+  ("demo:" [talk-demo cap])
+  talk-editing
+  talk-x-in-y
+  talk-writing
+  talk-on
+  talk-teaching
+  talk-parallel
+  talk-better)
+
+(define-string (talk :distribution :weighted)
+  (50 talk%)
+  ( 1 ("reflections on" talk%))
+  ( 1 (talk% "--" !(+ 5 (random 40)) "years later"))
+  ( 1 (talk% :. ", Part" !(format nil "~@R" (+ 1 (random 3))))))
+
+
+;;;; API ----------------------------------------------------------------------
+(defun random-string ()
+  (cap (talk)))
+