A Pen by Miriam Suzanne on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nom::{ | |
bytes::complete::{tag, take_while}, | |
combinator::recognize, | |
sequence::preceded, | |
IResult, | |
}; | |
/** | |
* Using Rust Nom, show how to detect "content that begins at the start of a line." This particular | |
* variant rolls forward until it finds any content *other than* the start of a line, which is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Old-school noweb in poly mode for emacs, now with Markdown. This does require one | |
;; bit of sed (perl, whatever) to work properly: you'll have to find all the chunks | |
;; that start with '<<...>>=' and remove the polymode ending indicating the language type. | |
(use-package poly-noweb | |
:ensure | |
:config | |
(require 'poly-markdown) | |
(define-obsolete-variable-alias 'pm-host/markdown-for-noweb 'poly-noweb-markdown-hostmode "v0.2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make help | |
# | |
# Usage: Download this file and put it somewhere. In a GNU Makefile, add the | |
# following line near the top of your Makefile: | |
# | |
# ``` | |
# include /path/to/help.mk | |
# ``` | |
# | |
# Alternatively, you could just cut and paste the code from this gist into your |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Absolutely dumb progressive "screensaver". Basically, it watches a folder and, whenever a new | |
# image appears, puts that one up fullscreen, then tears down the prior one underneath. Useful for a | |
# folder where you're either doing slow downloads or rendering illustrations and just want to watch | |
# the results. | |
# Requires [feh](https://feh.finalrewind.org/), | |
# [tac](https://man7.org/linux/man-pages/man1/tac.1.html) | |
# inotifywait(https://github.com/inotify-tools/inotify-tools). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import toml | |
from typing import List, Dict, Any | |
# I use Zola as my primary static site generator, and these are the functions I | |
# use regularly with python scripts to access, manipulate, and modify the | |
# headers and content. | |
def get_file_metablock_markers(lines: List[str], filename: str) -> List[int]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
def get_root() -> str: | |
"""Return the current project root. | |
A lot of scripts written for build system need to know where they are | |
relative to a project's root. This function returns the root folder, giving | |
developers a concrete starting location for all file manipulation. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dbm import gnu | |
from collections import namedtuple | |
from markdownify import markdownify as md | |
from slugify import slugify | |
EVENT = b"event:event:" | |
elfs = gnu.open("./elfs.jbak", "r") | |
def key_extraction(key): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
shopt -s nullglob | |
function _die() { | |
echo "ERROR $? IN ${BASH_SOURCE[0]} AT LINE ${BASH_LINENO[0]}" 1>&2 | |
exit 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAME_ROM_PATH="$HOME/.local/share/mame/roms" | |
_mame_completions() | |
{ | |
COMPLETIONS=$(echo $(ls "$MAME_ROM_PATH" | sed 's/\.zip$//i')) | |
COMPREPLY=$(compgen -W "$COMPLETIONS" "${COMP_WORDS[1]}") | |
} | |
complete -F _mame_completions mame |
NewerOlder