Skip to content

Instantly share code, notes, and snippets.

View superatomic's full-sized avatar
I may be slow to respond.

Olivia Kinnear superatomic

I may be slow to respond.
View GitHub Profile
@superatomic
superatomic / food.json
Created May 1, 2024 23:04
Food tag for Minecraft datapacks, containing all food items (excluding cake). Accurate as of Minecraft Java Edition 1.20. Licensed under CC0 1.0.
{
"values": [
"minecraft:apple",
"minecraft:baked_potato",
"minecraft:beef",
"minecraft:beetroot",
"minecraft:beetroot_soup",
"minecraft:bread",
"minecraft:carrot",
"minecraft:chicken",
@superatomic
superatomic / lst
Created November 29, 2023 05:06
lst: strip comments, empty lines, and indentation from files
#!/bin/bash
sed -rf- -- "$@" <<-EOF
s/([^#]*)#.*$/\1/ # remove comments
s/^\s*//;s/\s+$// # strip leading and trailing whitespace
/^$/d # remove blank lines
EOF
@superatomic
superatomic / unique.py
Created May 28, 2023 19:43
A python 3.12 `unique` function, with type hints.
from collections.abc import Hashable, Iterable, Iterator
def unique[T: Hashable](items: Iterable[T]) -> Iterator[T]:
seen = set()
for item in items:
if item not in seen:
seen.add(item)
yield item
@superatomic
superatomic / example-formula.rb
Created April 26, 2022 01:06
Example Homebrew Formula
# The following file is a copy of <https://github.com/syhw/homebrew/blob/master/Library/Contributions/example-formula.rb>.
# I found this useful, so I uploaded it as a Gist so I can easily find it again.
# Copyright 2009-2015 Homebrew contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
@superatomic
superatomic / xshe.toml
Last active June 29, 2022 05:07
Xshe Example – Cross-Shell Environment Variable Configuration
#############################################################
# Cross-Shell Environment Variable Configuration using Xshe #
# https://github.com/superatomic/xshe #
#############################################################
# Xshe allows for setting environment variable across multiple shells:
PS1 = '> '
# These lines add the environment variables for the XDG Base Directory Specification.
# (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
@superatomic
superatomic / xshe-v0.3.2.toml
Last active April 15, 2022 23:29
OUTDATED Xshe v0.3.2 Example – Cross-Shell Environment Variable Configuration
##############################################################################################
## ======================================================================================== ##
## ⚠️ THIS FILE IS OUTDATED; DO NOT USE IT! ##
## ⚠️ UPDATED VERSION: https://gist.github.com/superatomic/52a46e53a4afce75ede4db7ba6354e0a ##
## ======================================================================================== ##
##############################################################################################
# Original file contents is as follows:
#############################################################