Skip to content

Instantly share code, notes, and snippets.

View dandrake's full-sized avatar

Dan Drake dandrake

View GitHub Profile

Trice: a trick-taking dice game

Here are the rules for what I call Trice -- it's a trick-taking dice game. The name comes from trick-taking, and that it plays quickly.

Setup

  • The game is usually played with 4 players, but generalizes to 2+.
  • You'll need sets of dice in different colors/patterns -- one for each player. The recommended set is the "standard D&D set": d4, 3d6, d8,
@dandrake
dandrake / base_ten_base_T.py
Last active February 25, 2023 14:25
converting between "base ten" and "base T"
# Python code accompanying https://ddrake.prose.sh/base_ten_without_zero
def T_to_zero(Tnum):
"""Convert a number (provided as a string) written with "T" notation
to a Python integer, which by default is displayed using the
ordinary positional notation with "0".
"""
T_digit_to_int = {str(i): i for i in range(1, 10)}
T_digit_to_int['T'] = 10
return sum(10**p * T_digit_to_int[d] for p, d in enumerate(reversed(Tnum)))
@dandrake
dandrake / my-mark-ring.el
Last active March 1, 2023 01:18
emacs personal mark ring
; Emacs has two mark rings: a buffer-local one, and a global one. I always get confused with them; my mental model
; is that there ought to be just one mark ring. I want to implement that without trampling over the existing mark
; ring stuff. Here's a first draft at doing so: I just add a hook so that anytime the mark is set, we append to
; my own personal mark ring, and then I have a function that is basically a copy-and-paste of pop-to-mark-command.
; This...seems to work? I am (1) stunned that it was so easy, and (2) suspcious that this ought to be unnecessary
; if I really understand the mark rings and used them correctly.
; Thanks to https://mathstodon.xyz/@vernon@emacs.ch for pushing me to try this; see https://mathstodon.xyz/@vernon@emacs.ch/109913166908490838
; and my replies.
"""
Print a "continuous" calendar -- as a ribbon / candy bar:
https://davidseah.com/node/compact-calendar/
https://docs.python.org/3/library/calendar.html
Example output:
>>> calendar.setfirstweekday(1)
>>> print(domonths(2023, 9, 6))
@dandrake
dandrake / not_code_just_a_note.md
Last active December 21, 2023 20:31
Using gist just to share simple notes?

A demo for a friend looking to share Evernote-style notes

You can write Markdown content and is should work as expected with links and such.

Moreoever, because this is github, there's git's revision control behind the scenes.

Here's a typo that I'll fix...click Edit in the top right, and edit away. Then see your changes in the Revisions tab from the upper left.

I even attached an image file: here it is.

;; Inspired by this blog post on "let's surround":
;; https://arialdomartini.github.io/emacs-surround-2 and
;; https://www.emacswiki.org/emacs/SurroundRegion.
;;
;; Notable bits:
;;
;; - Specifying =open= as a default value in the closing delimiter completing
;; read -- that allows the user to hit return to re-use the opening
;; delimiter for the closing one.
;; - This moves point accordingly, so that you can make repeated calls to