Skip to content

Instantly share code, notes, and snippets.

@bhyde
bhyde / example-named-readtable.lisp
Last active December 26, 2016 23:03
Named-Readtables, and example.
;;;; Load some utilities
;;; ... typically this would go in our ASDF system file.
;;; in which case you wouldn't need the eval when
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload "cl-interpol")
(ql:quickload "named-readtables"))
;;;; Define a package and a read table.
@bhyde
bhyde / index.html
Last active December 18, 2015 23:19
D3, a slightly sorted
<head>
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
fill: none;
stroke: #666;
stroke-width: 1.5px;
@bhyde
bhyde / ql-tools.lisp
Last active April 26, 2016 15:08
A few things for playing with quicklisp metadata. Note that this reveals assorted things that make life interesting; so use 'em in a clean discardable session. Probably ccl only.
(in-package #:cl-user)
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload "cl-ppcre")
(ql:quickload "optima")
(ql:quickload "optima.ppcre")
(use-package '#:optima)
(use-package '#:optima.ppcre))
(defun ensure-all-system-are-downloaded ()
@bhyde
bhyde / graph-quicklisp-system
Last active December 21, 2015 11:29
Generate a graphviz of the systems required by a the given system, let dot render that, then have emacs display it. Calls back to emacs via swank::eval-in-emacs.
(in-package #:cl-user)
;; Must do ...
;; (setf slime-enable-evaluate-in-emacs t)
;; ... in emacs first. And, dot must be installed.
(defun graph-quicklisp-system (ql-system-designation)
"Display graph of system requirements."
(let ((dot-file "/tmp/ql-system.dot")
(png-file "/tmp/ql-system.png"))
@bhyde
bhyde / access.log of attack
Last active December 28, 2015 20:19
Two files, the access.log during the attack (only the one IP included). Note that my wp-login.php requires two factor auth. Then the file that was hacked in the install.
211.110.140.155 - - [19/Nov/2013:17:30:37 -0800] "GET /wp-login.php HTTP/1.1" 200 3163 "http://enthusiasm.cozy.org/wp-login.php" "Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; 125LA; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"
211.110.140.155 - - [19/Nov/2013:17:30:38 -0800] "GET /wp-login.php HTTP/1.1" 200 3163 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
211.110.140.155 - - [19/Nov/2013:17:30:39 -0800] "GET /wp-login.php HTTP/1.1" 200 3163 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
211.110.140.155 - - [19/Nov/2013:17:30:40 -0800] "GET /?author=1 HTTP/1.1" 301 353 "http://enthusiasm.cozy.org/?author=1" "Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; 125LA; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"
211.110.140.155 - - [19/Nov/2013:17:30:41 -0800] "GET /?author=1 HTTP/1.1" 301 353 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
211.110.140.155 - - [19/Nov/2013:17:30:43 -0800] "GET /archives/author/admin HTTP/1.1" 200 4
@bhyde
bhyde / foo-nov23.lisp
Created November 23, 2013 16:37
Some one liners in service of making a list of etherpad-lite plugins. See: https://github.com/ether/etherpad-lite/wiki/Plugin,-a-list
(in-package #:cl-user)
;;; run each form in here one at a time by hand.
(ql:quickload '("cl-json" "drakma"))
(defparameter *all* ;; This takes quite a while.
(cl-json:decode-json-from-source
(drakma:http-request "https://registry.npmjs.org/-/all" :want-stream t)))
(defvar *variable-memory* (make-hash-table :test #'equal))
(fare-memoization:define-memo-function (intern-variable :table *variable-memory*) (name variable-specs)
(flet ((field? (n)
(cdr (assoc n variable-specs))))
(make-instance 'variable
:name (json:lisp-to-camel-case (symbol-name name))
:concept? (field? :concept)
:label (field? :label))))
@bhyde
bhyde / google-search.el
Last active August 29, 2015 13:56
Emacs command to google something.
(defvar google-query-history nil)
(defun google (query)
"Search google in the regular web browser, prefix arg for luck."
;; Mac only, due to the use of the unix open command.
(interactive
(list
(read-string "Query: "
(if (use-region-p)
(buffer-substring (region-beginning) (region-end))
[[ $# -gt 0 ]] || error 'Missing Argument(s)'
case $1 in
-h) check_args -h ; do_help ;;
--help) check_args --help ; do_help ;;
help) check_args help ; do_help ;;
add-key) check_args add-key url ; do_add_key $2 ;;
list-keys) check_args list-keys ; do_list_keys ;;
sign) check_args sign key_id file file ; do_sign $2 $3 $4 ;;
get) check_args get url ; do_get $2 ;;
*) check_args url ; do_get $1 ;;
@bhyde
bhyde / bad_ssh_agent_signer.py
Last active August 29, 2015 13:57
Sign some data using ssh_agent's first key. Doesn't work. Angels weep.
#!/usr/bin/python
# Doesnt work ... the can_verify result is probably the hint why not.
# based loosely on http://blog.oddbit.com/2011/05/09/signing-data-with-ssh-agent/
# Script to generate a cryptographic signature over a bit of data
# The signing is done by the current ssh-agent, using the first key stored
# in that agent. Usually that is the current user.