Skip to content

Instantly share code, notes, and snippets.

View sjl's full-sized avatar

Steve Losh sjl

View GitHub Profile
@sjl
sjl / test.lisp
Last active October 27, 2017 21:55
(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)
@sjl
sjl / fuckemojigarbageregex.txt
Created October 13, 2017 17:33
Tweetbot regex to mute emoji garbage. You're literate, use words.
[🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐸🐵🙊🙉🙊🐒🐔🐧🐦🐤🐣🐥🦆🦅🦉🦇🐺🐗🐴🦄🐝🐛🦋🐌🐚🐞🐜🕷🕸🐢🐍🦎🦂🦀🦑🐙🦐🐠🐟🐡🐬🦈🐳🐋🐊🐆🐅🐃🐂🐄🦌🐪🐫🐘🦏🦍🐎🐖🐐🐏🐑🐕🐩🐈🐓🦃🕊🐇🐁🐀🐿🐾🐉🐲🌵🎄🌲🌳🌴🌱🌿☘️🍀🎍🎋🍃🍂🍁🍄🌾💐🌷🌹🥀🌻🌼🌸🌺🌎🌍🌏🌕🌖🌗🌘🌑🌒🌓🌔🌚🌝🌞🌛🌜🌙💫⭐️🌟✨⚡️🔥💥☄️☀️🌤⛅️🌥🌦🌈☁️🌧⛈🌩🌨☃️⛄️❄️🌬💨🌪🌫🌊💧💦☔️😀😃😄😁😆😅😂🤣☺️😊😇🙂🙃😉😌😍😘😗😙😚😋😜😝😛🤑🤗🤓😎🤡🤠😏😒😞😔😟😕🙁☹️😣😖😫😩😤😠😡😶😐😑😯😦😧😮😲😵😳😱😨😰😢😥🤤😭😓😪😴🙄🤔🤥😬🤐🤢🤧😷🤒🤕😈👿👹👺💩👻💀☠️👽👾🤖🎃😺😸😹😻😼😽🙀😿😾👐🙌👏🙏🤝👍👎👊✊🤛🤜🤞✌️🤘👌👈👉👆👇☝️✋🤚🖐🖖👋🤙💪🖕✍️🤳💅🖖💄💋👄👅👂👃👣👁👀🗣👤👥👶👦👧👨👩👱‍♀️👱👴👵👲👳‍♀️👳👮‍♀️👮👷‍♀️👷💂‍♀️💂🕵️‍♀️🕵️👩‍⚕️👨‍⚕️👩‍🌾👨‍🌾👩‍🍳👨‍🍳👩‍🎓👨‍🎓👩‍🎤👨‍🎤👩‍🏫👨‍🏫👩‍🏭👨‍🏭👩‍💻👨‍💻👩‍💼👨‍💼👩‍🔧👨‍🔧👩‍🔬👨‍🔬👩‍🎨👨‍🎨👩‍🚒👨‍🚒👩‍✈️👨‍✈️👩‍🚀👨‍🚀👩‍⚖️👨‍⚖️🤶🎅👸🤴👰🤵👼🤰🙇‍♀️🙇💁💁‍♂️🙅🙅‍♂️🙆🙆‍♂️🙋🙋‍♂️🤦‍♀️🤦‍♂️🤷‍♀️🤷‍♂️🙎🙎‍♂️🙍🙍‍♂️💇💇‍♂️💆💆‍♂️🕴💃🕺👯👯‍♂️🚶‍♀️🚶🏃‍♀️🏃👫👭👬💑👩‍❤️‍👩👨‍❤️‍👨💏👩‍❤️‍💋‍👩👨‍❤️‍💋‍👨👪👨‍👩‍👧👨‍👩‍👧‍👦👨‍👩‍👦‍👦👨‍👩‍👧‍👧👩‍👩‍👦👩‍👩‍👧👩‍👩‍👧‍👦👩‍👩‍👦‍👦👩‍👩‍👧‍👧👨‍👨‍👦👨‍👨‍👧👨‍👨‍👧‍👦👨‍👨‍👦‍👦👨‍👨‍👧‍👧👩‍👦👩‍👧👩‍👧‍👦👩‍👦‍👦👩‍👧‍👧👨‍👦👨‍👧👨‍👧‍👦👨‍👦‍👦👨‍👧‍👧👚👕👖👔👗👙👘👠👡👢👞👟👒🎩🎓👑⛑🎒👝👛👜💼👓🕶🌂☂️🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🍒🍑🍍🥝🥑🍅🍆🥒🥕🌽🌶🥔🍠🌰🥜🍯🥐🍞🥖🧀🥚🍳🥓🥞🍤🍗🍖🍕🌭🍔🍟🥙🌮🌯🥗🥘🍝🍜🍲🍥🍣🍱🍛🍚🍙🍘🍢🍡🍧🍨🍦🍰🎂🍮🍭🍬🍫🍿🍩🍪🥛🍼☕️🍵🍶🍺🍻🥂🍷🥃🍸🍹🍾🥄🍴🍽❤️💛💚💙💜🖤💩🔥🎵🎶]
@sjl
sjl / 69.lisp
Created October 11, 2017 01:06
Project Euler #69 in uLisp (runnable on Ardunio Zero or Due)
(defun dividesp (n d)
(= n (* d (/ n d))))
(defun brute-force-prime-p (n)
(let ((d 3))
(loop (cond
((> (* d d) n) (return t))
((dividesp n d) (return nil))
(t (incf d 2))))))
@sjl
sjl / qudwr.markdown
Last active July 11, 2017 13:00
Caves of Qud: Skills taught via Water Ritual
Faction Skills
Antelopes none
Apes Conk
Arachnids Lunge
Baboons none
Baetyls ?
Barathrumites Tinkering I
Bears none
Beasts none
RATIO | KEY | DISPLAY NAME | VALUE | WEIGHT
28.0 | STEEL-POTTER'S-KNIFE | &Ysteel&y potter's knife | 28.0 | 1.0
28.0 | STEEL-BUTCHER-KNIFE | &Ysteel&y butcher knife | 28.0 | 1.0
20.0 | STEEL-KUKRI | &Ysteel&y kukri | 20.0 | 1.0
20.0 | STEEL-DAGGER | &Ysteel&y dagger | 20.0 | 1.0
20.0 | STEEL-UTILITY-KNIFE | &Ysteel&y utility knife | 20.0 | 1.0
12.0 | WORN-BURNOOSE | worn burnoose | 12.0 | 1.0
10.0 | DAGGER2 | iron dagger | 10.0 | 1.0
7.0 | STEEL-VINEREAPER | &Ysteel&y vinereaper | 35.0 | 5.0
6.666 | STEEL-SHORT-SWORD | &Ysteel&y short sword | 20.0 | 3.0
@sjl
sjl / qud-item-values
Last active May 5, 2022 07:45
Item values in Caves of Qud, sorted by value/weight ratio
PRICE/WEIGHT | ITEM-KEY | DISPLAY-NAME | PRICE | WEIGHT
10000.0 | HANDENUKE | &mHand-E-Nuke | 10000.0 | 1.0
3000.0 | TIMECUBE | &ctimecube | 3000.0 | 1.0
2265.0 | MENTAL-AGGREGATOR | mental aggregator | 2265.0 | 1.0
1135.0 | SHORT-SWORD8 | &rmetametal &Kshort sword | 1135.0 | 1.0
750.0 | GEOMAGNETIC-DISC | geomagnetic disc | 750.0 | 1.0
635.0 | DAGGER8 | &rmetametal dagger | 635.0 | 1.0
630.0 | SHORT-SW
@sjl
sjl / gist:3eb4c3b233d9fb143a55ac98f1f58ef4
Created January 5, 2017 13:23
one function to a function
Original from https://groups.google.com/forum/#!msg/comp.lang.lisp/9SKZ5YJUmBg/Fj05OZQomzIJ
Path: gmd.de!newsserver.jvnc.net!yale.edu!yale!gumby!wupost!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!news.ecn.bgu.edu!anaxagoras.ils.nwu.edu!riesbeck
From: ries...@ils.nwu.edu (Chris Riesbeck)
Newsgroups: comp.lang.lisp
Subject: Re: Loop macro
Date: 1 Apr 1993 17:37:56 GMT
Organization: The Institute for the Learning Sciences
Lines: 149
Distribution: world
body { width: 600px; margin 50px auto 200px; }
@sjl
sjl / gui.lisp
Created November 19, 2016 14:31
(in-package :chip8.gui)
(named-readtables:in-readtable :qtools)
;;;; Config -------------------------------------------------------------------
(defparameter *current* nil)
(defparameter *scale* 8)
(defparameter *width* (* *scale* 64))
(defparameter *height* (* *scale* 32))
(defparameter *fps* 60)
(defmacro let-bail (bindings &rest body)
(if (null bindings)
`(progn ,@body)
(destructuring-bind ((&whole binding symbol value &optional return-value)
&rest more-bindings)
bindings
(if (eql symbol 'bail-when)
`(if ,value ,return-value (let-bail ,more-bindings ,@body))
`(let (,binding) (let-bail ,more-bindings ,@body))))))