Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Losh sjl

View GitHub Profile
View lisprb.lisp
(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-)
View list.lisp
;;;; -*- 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))
View gist:124c4eff0273e8d0b477bfecf11774f8
(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"
View move-focus.lisp
(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))))))
View lol.lisp
(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)))))))
View pro
#!/usr/bin/env bash
set -eio pipefail
ssh -t "0.backends.$2.$1" postgres-readonly
@sjl
sjl / gist:f9b589af22c1ac27b2de06fb3e97bfae
Last active Feb 1, 2018
creatures without an explicit level/tier (only having an inherited one)
View gist:f9b589af22c1ac27b2de06fb3e97bfae
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 Feb 1, 2018
creatures in caves of qud by tier
View gist:fe8d9dfa35cdc9268fde52123f3b0b0a
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 Jan 21, 2018 — forked from fukamachi/clhs.ros
A Roswell script for opening HyperSpec page describing a given symbol in the default browser.
View clhs.ros
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
A Roswell script to open the HyperSpec page of a specified symbol in the default browser.
View test.lisp
(defun instrument-candles (&key
((:instrument instrument))
((:price price) "M")
((:granularity granularity) "S5")
((:count count) 500)
((:from from)
(write-to-string
(local-time:timestamp-to-unix
(local-time:timestamp- (local-time::now) 5 :minute))))
((:to to)
You can’t perform that action at this time.