c5124aa20cbd

A bunch more
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 11 Mar 2022 12:36:18 -0500
parents d7650a70ef26
children 031a18772407
branches/tags (none)
files bin/cacl gitconfig gnuplot lisp/when.lisp weechat/alias.conf weechat/autosort.conf weechat/buflist.conf weechat/charset.conf weechat/exec.conf weechat/fifo.conf weechat/fset.conf weechat/logger.conf weechat/python.conf weechat/relay.conf weechat/script.conf weechat/trigger.conf weechat/urlgrab.conf weechat/xfer.conf

Changes

--- a/bin/cacl	Tue Feb 01 10:52:56 2022 -0500
+++ b/bin/cacl	Fri Mar 11 12:36:18 2022 -0500
@@ -2,8 +2,7 @@
 
 set -e
 
-LISPS=("sbcl" "ccl" "abcl" "ecl")
+# LISPS=("sbcl" "ccl" "abcl")
 LISPS=("sbcl" "ccl")
-LISPS=("sbcl")
 rlwrap ~/src/cacl/build/cacl-$(shuf -n1 -e "${LISPS[@]}") "$@"
 
--- a/gitconfig	Tue Feb 01 10:52:56 2022 -0500
+++ b/gitconfig	Fri Mar 11 12:36:18 2022 -0500
@@ -100,6 +100,8 @@
     purge = "!sh -c 'git untracked && confirm && git actually-purge'"
     actually-purge = "!sh -c 'git untracked | xargs rm'"
 
+    bazel-log = log --pretty=bazel --date=raw --all --graph --topo-order 
+
 [push]
     default = current
 
@@ -131,3 +133,6 @@
 
 [sendemail]
     smtpserver = "/home/sjl/src/dotfiles/bin/msmtp-stevelosh"
+
+[pretty]
+    bazel = %C(auto)%H %Cgreen%cd %C(auto)%s %Cred%al %C(auto)%d
--- a/gnuplot	Tue Feb 01 10:52:56 2022 -0500
+++ b/gnuplot	Fri Mar 11 12:36:18 2022 -0500
@@ -81,6 +81,16 @@
 png = "eval export_png('graph')"
 
 # }}}
+# Histograms -------------------------------------------------------------- {{{
+
+histogram_bin_width=1024*256
+histogram_bin(x,width)=width*floor(x/width) + width/2.0
+set boxwidth histogram_bin_width*0.9
+set style fill solid 0.5 
+
+plot 'sizes' using (histogram_bin($1,histogram_bin_width)):(1.0) smooth freq with boxes
+
+# }}}
 # Other ------------------------------------------------------------------- {{{
 
 kdens(file, column, bandwidth) = sprintf( \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/when.lisp	Fri Mar 11 12:36:18 2022 -0500
@@ -0,0 +1,211 @@
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (ql:quickload '(:adopt :iterate :chronicity :local-time :losh)
+                :silent t))
+
+(defpackage :when
+  (:use :cl :iterate :losh)
+  (:export :toplevel :*ui*))
+
+(in-package :when)
+
+;;;; Configuration ------------------------------------------------------------
+(defparameter +iso-8601-seconds-format+
+  '((:year 4) #\- (:month 2) #\- (:day 2)
+    #\T
+    (:hour 2) #\: (:min 2) #\: (:sec 2)
+    :gmt-offset-or-z))
+
+
+(defparameter *time-formats*
+  `((:rfc-3339 . ,local-time:+rfc3339-format+)
+    (:iso-8601 . ,local-time:+iso-8601-format+)
+    (:iso-8601-seconds . ,+iso-8601-seconds-format+)
+    (:gnuplot . ((:day 2) #\/ (:month 2) #\/ (:year 4) #\, (:hour 2) #\: (:min 2)))))
+
+
+;;;; Errors -------------------------------------------------------------------
+(define-condition user-error (error) ())
+
+(define-condition need-one-time-string (user-error) ()
+  (:report "Exactly one time string is required."))
+
+
+
+;;;; Functionality ------------------------------------------------------------
+(defun jitter-ns (seconds)
+  (if (zerop seconds)
+    0
+    (_ (coerce seconds 'double-float)
+      random
+      (* 1000000000 _)
+      floor)))
+
+(defun run (time-string &key (output-format :iso-8601) (jitter 0) timezone)
+  (local-time:format-timestring
+    *standard-output*
+    (local-time:timestamp+ (chronicity:parse time-string :endian-preference :middle)
+                           (jitter-ns jitter)
+                           :nsec)
+    :format (or (assocdr output-format *time-formats*)
+                (error "Unknown time format ~S." output-format))
+    :timezone (or timezone local-time:*default-timezone*)))
+
+
+;;;; User Interface -----------------------------------------------------------
+(defparameter *examples*
+  '(("Print the current time in RFC 3339 format:" . "when now --rfc-3339")
+    ("Print a randomish time from a while ago:" . "when '12 hours ago' --jitter-hours 4")
+    ("Print a randomish time next year in UTC:" . "when '1 year from now' --jitter-days 30 --utc")))
+
+
+(defparameter *option/help*
+  (adopt:make-option 'help
+    :help "Display help and exit."
+    :long "help"
+    :short #\h
+    :reduce (constantly t)))
+
+
+(defparameter *option/output-format/iso-8601*
+  (adopt:make-option 'output-format/iso-8601
+    :result-key 'output-format
+    :help "Output results as ISO-8601 (default)."
+    :long "iso-8601"
+    :short #\i
+    :initial-value :iso-8601
+    :reduce (constantly :iso-8601)))
+
+(defparameter *option/output-format/iso-8601-seconds*
+  (adopt:make-option 'output-format/iso-8601-seconds
+    :result-key 'output-format
+    :help "Output results as ISO-8601 with a precision of seconds (no nanoseconds)."
+    :long "iso-8601-seconds"
+    :short #\I
+    :reduce (constantly :iso-8601-seconds)))
+
+(defparameter *option/output-format/rfc-3339*
+  (adopt:make-option 'output-format/rfc-3339
+    :result-key 'output-format
+    :help "Output results as RFC 3339."
+    :long "rfc-3339"
+    :short #\r
+    :reduce (constantly :rfc-3339)))
+
+(defparameter *option/output-format/gnuplot*
+  (adopt:make-option 'output-format/gnuplot
+    :result-key 'output-format
+    :help "Output results as Gnuplot timestamps."
+    :long "gnuplot"
+    :short #\g
+    :reduce (constantly :gnuplot)))
+
+
+(defparameter *option/jitter/seconds*
+  (adopt:make-option 'jitter/seconds
+    :result-key 'jitter
+    :parameter "N"
+    :help "Jitter result by up to N seconds."
+    :long "jitter-seconds"
+    :short #\S
+    :initial-value 0
+    :key #'parse-integer
+    :reduce (lambda (old n) (declare (ignore old)) n)))
+
+(defparameter *option/jitter/minutes*
+  (adopt:make-option 'jitter/minutes
+    :result-key 'jitter
+    :parameter "N"
+    :help "Jitter result by up to N minutes."
+    :long "jitter-minutes"
+    :short #\M
+    :key #'parse-integer
+    :reduce (lambda (old n) (declare (ignore old)) (* 60 n))))
+
+(defparameter *option/jitter/hours*
+  (adopt:make-option 'jitter/hours
+    :result-key 'jitter
+    :parameter "N"
+    :help "Jitter result by up to N hours."
+    :long "jitter-hours"
+    :short #\H
+    :key #'parse-integer
+    :reduce (lambda (old n) (declare (ignore old)) (* 60 60 n))))
+
+(defparameter *option/jitter/days*
+  (adopt:make-option 'jitter/days
+    :result-key 'jitter
+    :parameter "N"
+    :help "Jitter result by up to N days."
+    :long "jitter-days"
+    :short #\D
+    :key #'parse-integer
+    :reduce (lambda (old n) (declare (ignore old)) (* 24 60 60 n))))
+
+
+(defparameter *option/timezone/local*
+  (adopt:make-option 'jitter/timezone/local
+    :result-key 'timezone
+    :help "Print result in current local computer timezone (default)."
+    :long "local-timezone"
+    :short #\l
+    :initial-value nil
+    :reduce (constantly nil)))
+
+(defparameter *option/timezone/utc*
+  (adopt:make-option 'jitter/timezone/utc*
+    :result-key 'timezone
+    :help "Print the result in UTC."
+    :long "utc"
+    :short #\u
+    :reduce (constantly local-time:+utc-zone+)))
+
+
+(adopt:define-string *help-text*
+  "when takes a human-readable time like '2 hours ago' and prints it as a ~
+  computer-readable time.  It can also jitter the time by a random amount if ~
+  you want to produce randomish data.")
+
+
+(defparameter *ui*
+  (adopt:make-interface
+    :name "when"
+    :usage "[OPTIONS] TIME-STRING"
+    :summary "convert human time to computer time"
+    :help *help-text*
+    :examples *examples*
+    :contents (list *option/help*
+                    (adopt:make-group
+                      'output-options
+                      :title "Output Options"
+                      :options (list *option/output-format/iso-8601*
+                                     *option/output-format/iso-8601-seconds*
+                                     *option/output-format/rfc-3339*
+                                     *option/output-format/gnuplot*))
+                    (adopt:make-group
+                      'timezone-options
+                      :title "Timezone Options"
+                      :options (list *option/timezone/local*
+                                     *option/timezone/utc*))
+                    (adopt:make-group
+                      'jitter-options
+                      :title "Jitter Options"
+                      :options (list *option/jitter/seconds*
+                                     *option/jitter/minutes*
+                                     *option/jitter/hours*
+                                     *option/jitter/days*)))))
+
+
+(defun toplevel ()
+  (sb-ext:disable-debugger)
+  (setf *random-state* (make-random-state t))
+  (multiple-value-bind (arguments options) (adopt:parse-options-or-exit *ui*)
+    (handler-case
+        (adopt::quit-on-ctrl-c ()
+          (cond
+            ((gethash 'help options) (adopt:print-help-and-exit *ui*))
+            ((/= (length arguments) 1) (error 'need-one-time-string))
+            (t (run (first arguments)
+                    :output-format (gethash 'output-format options)
+                    :jitter (gethash 'jitter options)
+                    :timezone (gethash 'timezone options)))))
+      (user-error (e) (adopt:print-error-and-exit e)))))
--- a/weechat/alias.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/alias.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
--- a/weechat/autosort.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/autosort.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
--- a/weechat/buflist.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/buflist.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
@@ -21,6 +21,7 @@
 nick_prefix_empty = on
 signals_refresh = ""
 sort = "number,-active"
+use_items = 1
 
 [format]
 buffer = "${format_number}${indent}${format_nick_prefix}${color_hotlist}${format_name}"
@@ -37,3 +38,4 @@
 name = "${name}"
 nick_prefix = "${color_nick_prefix}${nick_prefix}"
 number = "${color:green}${number}${if:${number_displayed}?.: }"
+tls_version = " ${color:default}(${if:${tls_version}==TLS1.3?${color:green}:${if:${tls_version}==TLS1.2?${color:yellow}:${color:red}}}${translate:${tls_version}}${color:default})"
--- a/weechat/charset.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/charset.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
--- a/weechat/exec.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/exec.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
@@ -12,6 +12,7 @@
 [command]
 default_options = ""
 purge_delay = 0
+shell = "${env:SHELL}"
 
 [color]
 flag_finished = lightred
--- a/weechat/fifo.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/fifo.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
--- a/weechat/fset.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/fset.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,12 +4,13 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
 
 [look]
+auto_refresh = "*"
 auto_unmark = off
 condition_catch_set = "${count} >= 1"
 export_help_default = on
--- a/weechat/logger.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/logger.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
@@ -19,6 +19,7 @@
 
 [file]
 auto_log = on
+color_lines = off
 flush_delay = 120
 fsync = off
 info_lines = off
--- a/weechat/python.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/python.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
--- a/weechat/relay.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/relay.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
@@ -27,14 +27,20 @@
 [network]
 allow_empty_password = off
 allowed_ips = ""
+auth_timeout = 60
 bind_address = ""
 clients_purge_delay = 0
 compression_level = 6
 ipv6 = on
 max_clients = 5
+nonce_size = 16
 password = ""
+password_hash_algo = "*"
+password_hash_iterations = 100000
 ssl_cert_key = "%h/ssl/relay.pem"
 ssl_priorities = "NORMAL:-VERS-SSL3.0"
+totp_secret = ""
+totp_window = 0
 websocket_allowed_origins = ""
 
 [irc]
@@ -45,4 +51,9 @@
 backlog_tags = "irc_privmsg"
 backlog_time_format = "[%H:%M] "
 
+[weechat]
+commands = ""
+
 [port]
+
+[path]
--- a/weechat/script.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/script.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
@@ -50,6 +50,7 @@
 [scripts]
 autoload = on
 cache_expire = 60
+download_enabled = on
 download_timeout = 30
 hold = ""
 path = "%h/script"
--- a/weechat/trigger.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/trigger.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
--- a/weechat/urlgrab.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/urlgrab.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
--- a/weechat/xfer.conf	Tue Feb 01 10:52:56 2022 -0500
+++ b/weechat/xfer.conf	Fri Mar 11 12:36:18 2022 -0500
@@ -4,7 +4,7 @@
 # WARNING: It is NOT recommended to edit this file by hand,
 # especially if WeeChat is running.
 #
-# Use /set or similar command to change settings in WeeChat.
+# Use commands like /set or /fset to change settings in WeeChat.
 #
 # For more info, see: https://weechat.org/doc/quickstart
 #
@@ -31,7 +31,8 @@
 own_ip = ""
 port_range = ""
 send_ack = on
-speed_limit = 0
+speed_limit_recv = 0
+speed_limit_send = 0
 timeout = 300
 
 [file]
@@ -43,5 +44,6 @@
 auto_resume = on
 convert_spaces = on
 download_path = "%h/xfer"
+download_temporary_suffix = ".part"
 upload_path = "~"
 use_nick_in_filename = on