Skip to content

Instantly share code, notes, and snippets.

View CosmicToast's full-sized avatar

Chloé Vulquin CosmicToast

View GitHub Profile
@CosmicToast
CosmicToast / get_netboot_xyz.sh
Created December 16, 2019 20:59
Gets .kpxe and .efi boot endpoints of netboot.xyz, for use with dnsmasq.
#!/bin/sh
USER=dnsmasq:dnsmasq
MIRROR='https://boot.netboot.xyz/ipxe'
KPXE=netboot.xyz.kpxe
UEFI=netboot.xyz.efi
SHA2=netboot.xyz-sha256-checksums.txt
cd "$(dirname $0)"
rm -f "$KPXE" "$UEFI" "$SHA2"
@CosmicToast
CosmicToast / news.peg
Last active December 19, 2019 21:00
Toast NEWS PEG
Document <- DocPart+
DocPart <- VersionHeader ( AuthPart EOL )+
VersionHeader <- SectSep Version '(' Date ')' EndOfLine EndOfLine
AuthPart <- AuthorLine Item+
AuthorLine <- Author EOL
Author <- ASCII+ ('"' DomChar+ '"')? ASCII+ '<' Email '>'
Email <- Char+ '@' Domain
Domain <- DomChar+ ( PERIOD DomChar+ )+
@CosmicToast
CosmicToast / fedimg
Last active January 12, 2020 04:41
Fediverse (mastodon-api compatible) image and file status uploader
#!/bin/zsh
# deps: curl, mkdir(1p), jq
# return codes:
# 1: regular error, see stdout
# 2: media upload error
# 3: status post error
local app=${0:t}
usage() {
echo "$app [-a|-A <token>] [-i|-I <instance>] [-n] [-N <spoiler>] [-s <status>] -f <file>..."
@CosmicToast
CosmicToast / README.md
Last active March 4, 2020 00:39
Useful plasma5 service menus

Some useful ServiceMenus for plasma5

A small collection, because reasons.

Installation

To apply these, place the .desktop file you're interested in in ~/.local/share/kservices5/ServiceMenus/, then run kbuildsycoca5 (failures are ok). For each of them, the binary in question (specified under TryExec=) must be in the systemwide $PATH. You can expand it in the plasma5 env files, or via PAM. Or just, you know, symlink it into /usr/local/bin.

Optionally, you can download/place a compliant icon into ~/.local/share/icons/.

@CosmicToast
CosmicToast / README
Created August 13, 2020 13:54
Toast's Syntax Files
Toast's Syntax Files
Arbitrary syntax implementations for things I thought were missing.
The format is $PROG.$NAME.$EXT
For example, gedit.gemini.lang or micro.gemini.yaml.
All of these are written by me and available under the CC0.
Instructions based on prog (remove the $PROG. prefix first):
@CosmicToast
CosmicToast / big-pinafore-emojos.user.css
Last active September 14, 2020 11:31
Toast's UserCSS collection
/* ==UserStyle==
@name big-pinafore-emojos
@namespace github.com/openstyles/stylus
@version 1.0.1
@description Makes pinafore emojos bigger.
@author Chloe Kudryavtsev
==/UserStyle== */
@-moz-document domain("pinafore.social"), domain("dev.pinafore.social") {
.inline-custom-emoji {
width: 2.8em;
@CosmicToast
CosmicToast / args.bash
Created March 16, 2021 00:48
A schemaless argument parser for bash.
#!/usr/bin/env bash
# a schemaless argument parser
# this file is licensed under any of the following SPDX licenses
# to be chosen by the user:
# * 0BSD (https://spdx.org/licenses/0BSD.html)
# * BlueOak-1.0.0 (https://blueoakcouncil.org/license/1.0.0)
# * CC0-1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
# * Unlicense (https://unlicense.org/)
@CosmicToast
CosmicToast / fetch.sh
Created June 23, 2021 22:46
Fetching library for shell.
#!/bin/sh
# this file is licensed under any of the following SPDX licenses
# to be chosen by the user:
# * 0BSD (https://spdx.org/licenses/0BSD.html)
# * BlueOak-1.0.0 (https://blueoakcouncil.org/license/1.0.0)
# * CC0-1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
# * Unlicense (https://unlicense.org/)
# this all works with toybox, busybox and coreutils
# everything except http_src and http_run is POSIXLY correct
@CosmicToast
CosmicToast / jamplate.janet
Created June 4, 2023 20:21
Proof of concept PHP-style templating mode for Janet
(def- opener "<?janet")
(def- closer "?>")
(def- file ~{:main (some (+ :code :text))
:text '(to (+ ,opener -1))
:code (/ :code* ,parse-all)
:code* (* ,opener '(to ,closer) ,closer)})
(defn template-string
[s]
(def out @"")
@CosmicToast
CosmicToast / README.md
Created January 14, 2020 01:50
Useful MinIO policies

Some useful policies for MinIO

A small collection, because reasons.

User Policies

To apply these:

  1. Download the file.
  2. mcli admin policy add MYMINIO NAME NAME.json (replace MYMINIO with your configured instance and NAME with the filename).
  3. mcli admin policy set MYMINIO NAME user=USER (same as above, replace USER with the user you want to configure).