0370a4bc53be

Merge
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 29 Mar 2021 20:30:15 -0400
parents c815c49ae234 (current diff) abb473227306 (diff)
children 782d9fce020f
branches/tags (none)
files

Changes

--- a/gitconfig	Mon Mar 29 20:30:04 2021 -0400
+++ b/gitconfig	Mon Mar 29 20:30:15 2021 -0400
@@ -61,10 +61,13 @@
     delete-remote-branch = "!sh -c 'git push $1 --delete $2' -"
     delete-branch = "!sh -c 'git delete-local-branch $1; git remotes | cut -f1 | sort | uniq | xargs -n1 -I % git delete-local-reference-to-remote-branch % $1' -"
     delete-current-branch = "!bash -c 'git checkout master && git delete-branch $1' - $(git current-branch)"
+    purge-branch = "!sh -c 'set -x; git delete-local-branch $1; git delete-local-reference-to-remote-branch origin $1 && git delete-remote-branch origin $1' -"
     clean-local-branches = "!sh -c 'git branch --merged master | grep -v master$ | xargs git branch -d' -"
     clean-remote-tracking-branches = "!sh -c 'git branch -r --merged master | grep -v /master$ | xargs git branch -rd' -"
     clean-branches = "!sh -c 'git checkout master && git fetch origin && git merge --ff-only origin/master && git clean-local-branches && git clean-remote-tracking-branches' -"
 
+    branch-activity = "!sh -c 'git log -n1 --pretty=format:\"%aI%d\n\" $1 --' -"
+
     current-branch = rev-parse --abbrev-ref HEAD
 
     fo = fetch origin
--- a/lisp/genpass.lisp	Mon Mar 29 20:30:04 2021 -0400
+++ b/lisp/genpass.lisp	Mon Mar 29 20:30:15 2021 -0400
@@ -12,7 +12,8 @@
 (defparameter *words* nil)
 (defparameter *version* "0.0.1")
 (defparameter *random-path* "/dev/urandom")
-(defparameter *wordlist-path* "/usr/share/dict/words")
+(defparameter *wordlist-path* "/usr/share/dict/scowl/english-words.20")
+(defparameter *wordlist-encoding* :ISO-8859-1)
 
 
 ;;;; Functionality ------------------------------------------------------------
@@ -30,10 +31,11 @@
 (defun word-list ()
   (unless *words*
     (setf *words*
-          (iterate
-            (for line :in-file *wordlist-path* :using #'read-line)
-            (when (every #'safep line)
-              (collect line :result-type vector)))))
+          (with-open-file (s *wordlist-path* :external-format *wordlist-encoding*)
+            (iterate
+              (for line :in-stream s :using #'read-line)
+              (when (every #'safep line)
+                (collect line :result-type vector))))))
   *words*)
 
 (defun random-unsigned-byte-32 ()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/subex.lisp	Mon Mar 29 20:30:15 2021 -0400
@@ -0,0 +1,99 @@
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (ql:quickload '(:adopt) :silent t))
+
+(defpackage :subex
+  (:use :cl)
+  (:export :toplevel *ui*))
+
+(in-package :subex)
+
+;;;; Global Options and UI ----------------------------------------------------
+(defparameter *o/help*
+  (adopt:make-option 'help :long "help" :help "display help and exit" :reduce (constantly t)))
+
+(defparameter *o/version*
+  (adopt:make-option 'version :long "version" :help "display version and exit" :reduce (constantly t)))
+
+(defparameter *ui/main*
+  (adopt:make-interface
+    :name "subex"
+    :usage "[subcommand] [options]"
+    :help "subcommand example program"
+    :summary "an example program that uses subcommands"
+    :contents (list *o/help* *o/version*)))
+
+(defparameter *ui* *ui/main*)
+
+
+;;;; Subcommand Foo -----------------------------------------------------------
+(defparameter *o/foo/a*
+  (adopt:make-option 'a :result-key 'mode :short #\a :help "run foo in mode A" :reduce (constantly :a)))
+
+(defparameter *o/foo/b*
+  (adopt:make-option 'b :result-key 'mode :short #\b :help "run foo in mode B" :reduce (constantly :b)))
+
+(defparameter *ui/foo*
+  (adopt:make-interface
+    :name "subex foo"
+    :usage "foo [-a|-b]"
+    :summary "foo some things"
+    :help "foo some things"
+    :contents (list *o/foo/a* *o/foo/b*)))
+
+(defun run/foo (mode)
+  (format t "Running foo in ~A mode.~%" mode))
+
+
+;;;; Subcommand Bar -----------------------------------------------------------
+(defparameter *o/bar/meow*
+  (adopt:make-option 'meow :long "meow" :help "meow loudly after each step" :reduce (constantly t)))
+
+(defparameter *ui/bar*
+  (adopt:make-interface
+    :name "subex bar"
+    :usage "bar [--meow] FILE..."
+    :summary "bar some files"
+    :help "bar some files"
+    :contents (list *o/bar/meow*)))
+
+(defun run/bar (paths meow?)
+  (dolist (p paths)
+    (format t "Bar-ing ~A.~%" p)
+    (when meow?
+      (write-line "meow."))))
+
+
+;;;; Toplevel -----------------------------------------------------------------
+(defun toplevel/foo (args)
+  (multiple-value-bind (arguments options) (adopt:parse-options-or-exit *ui/foo* args)
+    (unless (null arguments)
+      (error "Foo does not take arguments, got ~S" arguments))
+    (run/foo (gethash 'mode options))))
+
+(defun toplevel/bar (args)
+  (multiple-value-bind (arguments options) (adopt:parse-options-or-exit *ui/bar* args)
+    (when (null arguments)
+      (error "Bar requires arguments, got none."))
+    (run/bar arguments (gethash 'meow options))))
+
+(defun lookup-subcommand (string)
+  (cond
+    ((null string) (values nil *ui/main*))
+    ((string= string "foo") (values #'toplevel/foo *ui/foo*))
+    ((string= string "bar") (values #'toplevel/bar *ui/bar*))
+    (t (error "Unknown subcommand ~S" string))))
+
+(defun toplevel ()
+  (sb-ext:disable-debugger)
+  (multiple-value-bind (arguments global-options)
+      (handler-bind ((adopt:unrecognized-option 'adopt:treat-as-argument))
+        (adopt:parse-options *ui/main*))
+    (when (gethash 'version global-options)
+      (write-line "1.0.0")
+      (adopt:exit))
+    (multiple-value-bind (subtoplevel ui) (lookup-subcommand (first arguments))
+      (when (or (null subtoplevel)
+                (gethash 'help global-options))
+        (adopt:print-help-and-exit ui))
+      (funcall subtoplevel (rest arguments)))))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/userContent.css	Mon Mar 29 20:30:15 2021 -0400
@@ -0,0 +1,4 @@
+@-moz-document domain(sumologic.com) {
+    table#search_query_results_view_table td.message { padding: 0 !important; }
+    table#search_query_results_view_table td.offset  { padding: 0 !important; }
+}