--- a/lisp/build-binary.sh Wed Mar 05 11:43:39 2025 -0500
+++ b/lisp/build-binary.sh Tue Mar 25 14:16:24 2025 -0400
@@ -9,6 +9,6 @@
sbcl --load "$LISP" \
--eval "(sb-ext:save-lisp-and-die \"$NAME\"
:executable t
- :compression t
+ :compression nil
:save-runtime-options t
:toplevel '$NAME:toplevel)"
--- a/lisp/weather.lisp Wed Mar 05 11:43:39 2025 -0500
+++ b/lisp/weather.lisp Tue Mar 25 14:16:24 2025 -0400
@@ -1,6 +1,6 @@
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload
- '(:adopt :with-user-abort :split-sequence :iterate :losh :drakma :jarl :flexi-streams :local-time)
+ '(:adopt :with-user-abort :split-sequence :iterate :losh :drakma :jarl :flexi-streams :local-time :safe-read)
:silent t))
(defpackage :weather
@@ -10,6 +10,10 @@
(in-package :weather)
+(defpackage :conf
+ (:use)
+ (:export :zip-code))
+
;;;; Zip Codes ----------------------------------------------------------------
(defun load-zip-code-coordinates ()
@@ -28,27 +32,27 @@
;;;; Config -------------------------------------------------------------------
(defvar *api-token* nil)
+(defvar *zip-code* nil)
(defun load-config ()
(let* ((token-paths (uiop:xdg-config-pathnames "weather/api-token"))
(config-paths (uiop:xdg-config-pathnames "weather/config"))
(token-path (find-if #'probe-file token-paths))
(config-paths (reverse (remove-if-not #'probe-file config-paths))))
- (declare (ignore config-paths)) ; TODO
(if (null token-path)
(error "Cannot find API token file at any of the following paths:~2%~
~{ ~A~%~}~%~
Visit https://home.openweathermap.org/api_keys to get one."
token-paths)
(setf *api-token* (string-trim '(#\space #\newline)
- (alexandria:read-file-into-string token-path))))))
+ (alexandria:read-file-into-string token-path))))
+ (dolist (config-path config-paths)
+ (with-open-file (f config-path)
+ (let ((config (safe-read:safe-read f (list :conf))))
+ (setf *zip-code* (getf config 'conf:zip-code *zip-code*)))))))
;;;; OpenWeatherMap -----------------------------------------------------------
-;;; TODO Switch to weather.gov some day to get my taxes' worth, e.g.
-;;; https://forecast.weather.gov/MapClick.php?lat=43.1577&lon=-77.6066&FcstType=digitalDWML
-;;; Sadly this is XML.
-
(defclass* response ()
((hourly :json (vector hour)))
(:metaclass jarl:json-class))
@@ -84,8 +88,9 @@
(defun query-weather (latitude longitude)
+ (assert *api-token* () "API token not loaded, call (load-config) first.")
(multiple-value-bind (body status headers uri stream needs-close reason)
- (drakma:http-request (format nil "https://api.openweathermap.org/data/2.5/onecall")
+ (drakma:http-request (format nil "https://api.openweathermap.org/data/3.0/onecall")
:redirect t
:parameters `(("lat" . ,latitude)
("lon" . ,longitude)
@@ -105,13 +110,16 @@
(defun display-hour (hour &optional force-date)
(let* ((ts (timestamp hour))
- (h (local-time:timestamp-hour ts)))
- (format t "~12A ~2,'0D:00 ~4D°F ~4D% ~{~A~^, ~}~%"
+ (h (local-time:timestamp-hour ts))
+ (temperature (temperature hour))
+ (feels-like (feels-like hour)))
+ (format t "~12A ~2,'0D:00 ~4D°F ~4D°f ~4D% ~{~A~^, ~}~%"
(if (or force-date (zerop h))
(ymd ts)
"")
h
- (round (temperature hour))
+ (round temperature)
+ (round feels-like)
(round (* 100 (precipitation hour)))
(map 'list #'description (weather hour)))))
@@ -179,7 +187,7 @@
(adopt:print-help-and-exit *ui*)
(progn
(load-config)
- (run (or (first arguments) "48105")
+ (run (or (first arguments) *zip-code*)
:hours (gethash 'hours options))))
(error (e) (adopt:print-error-and-exit e))))))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remote/bin/ont-basecalling-model-info Tue Mar 25 14:16:24 2025 -0400
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+bam_file="$1"
+
+module load Bioinformatics samtools >/dev/null 2>&1
+
+# view all the SAM headers
+# only look at @RG
+# pull out the basecall_model=… field
+# coalesce
+
+samtools view -H "$bam_file" \
+ | grep -P '^@RG' \
+ | grep -P -o $'basecall_model=[^ \t]+' \
+ | sort | uniq -c
+
+samtools view -H "$bam_file" \
+ | grep -P '^@RG' \
+ | grep -P -o $'modbase_models=[^ \t]+' \
+ | sort | uniq -c
--- a/stumpwm/miscellaneous.lisp Wed Mar 05 11:43:39 2025 -0500
+++ b/stumpwm/miscellaneous.lisp Tue Mar 25 14:16:24 2025 -0400
@@ -63,9 +63,11 @@
(defcommand describe-window () ()
(show-window-properties))
+(defcached (weather :seconds 120) ()
+ (losh:sh '("/home/sjl/src/dotfiles/lisp/bin/weather" "48105" "-H" "36") :result-type 'list))
+
(defcommand rain () ()
- (_ '("/home/sjl/src/dotfiles/lisp/bin/weather" "48105" "-H" "36")
- (losh:sh _ :result-type 'list)
+ (_ (weather)
(mapcar (lambda (line) (ppcre:regex-replace " 1[0-9]:00 " line "^6\\&^*")) _)
(message "~{~A~^~%~}" _)))