Skip to content

Instantly share code, notes, and snippets.

View sjl's full-sized avatar

Steve Losh sjl

View GitHub Profile
(declaim (optimize (speed 3) (safety 1) (space 1) (debug 1) (compilation-speed 1)))
(defconstant +width+ 1280)
(defconstant +height+ 720)
(defconstant +samples+ 50)
(defconstant +max-depth+ 5)
(defstruct (vec
(:conc-name v-)
@sjl
sjl / list.lisp
Last active December 24, 2018 04:08
;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
(in-package :split-sequence)
(declaim (inline
collect-until
count-while
split-list split-list-if split-list-if-not
split-list-from-end split-list-from-start split-list-internal))
(defcommand screen-single () ()
(loop with laptop = "eDP1"
with extern = "DP1"
for (output commands) in `((,laptop ("--primary"))
(,extern ("--off"))
(,laptop ("--preferred")))
do (uiop:run-program `("xrandr" "--output" ,output ,@commands))))
(defcommand screen-multi () ()
(loop with laptop = "eDP1"
(defcommand move-focus* (direction)
((:direction "Enter a direction: "))
(labels ((in-float-p ()
(typep (current-group) 'float-group))
(focus-first-frame ()
(unless (in-float-p)
(dotimes (i 10)
(move-focus (ecase direction
(:left :right)
(:right :left))))))
(defcommand wrapping-move-focus (direction)
((:direction "Enter a direction: "))
(let ((frame (current-frame)))
(move-focus direction)
(when (eql frame (current-frame))
(ecase direction
(:right (gnext) (dotimes (i 10) (move-focus :left)))
(:left (gprev) (dotimes (i 10) (move-focus :left)))))))
#!/usr/bin/env bash
set -eio pipefail
ssh -t "0.backends.$2.$1" postgres-readonly
@sjl
sjl / gist:f9b589af22c1ac27b2de06fb3e97bfae
Last active February 1, 2018 23:42
creatures without an explicit level/tier (only having an inherited one)
TIER | ITEM-KEY | DISPLAY-NAME
0 | PLANT | [Plant]
0 | GODSHROOM | &oelcatl
0 | SHIMSCALE-MANGROVE-TREE_BLUE | shimscale mangrove tree
0 | SHIMSCALE-MANGROVE-TREE | shimscale mangrove tree
0 | BANANA-TREE | banana tree
0 | SPOTTED-SHAGSPOOK-1 | spotted shagspook
0 | SPOTTED-SHAGSPOOK-2 | spotted shagspook
0 | DANDY-CAP-1 | dandy cap
0 | DANDY-CAP-2 | dandy cap
@sjl
sjl / gist:fe8d9dfa35cdc9268fde52123f3b0b0a
Last active February 1, 2018 23:37
creatures in caves of qud by tier
TIER | ITEM-KEY | DISPLAY-NAME
0 | PLANT | [Plant]
0 | GODSHROOM | &oelcatl
0 | SHIMSCALE-MANGROVE-TREE_BLUE | shimscale mangrove tree
0 | SHIMSCALE-MANGROVE-TREE | shimscale mangrove tree
0 | BANANA-TREE | banana tree
0 | SPOTTED-SHAGSPOOK-1 | spotted shagspook
0 | SPOTTED-SHAGSPOOK-2 | spotted shagspook
0 | DANDY-CAP-1 | dandy cap
0 | DANDY-CAP-2 | dandy cap
@sjl
sjl / clhs.ros
Created January 21, 2018 01:10 — forked from fukamachi/clhs.ros
A Roswell script for opening HyperSpec page describing a given symbol in the default browser.
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
A Roswell script to open the HyperSpec page of a specified symbol in the default browser.