Skip to content

Instantly share code, notes, and snippets.

View iluvcapra's full-sized avatar
💭
Workin’

Jamie Hardt iluvcapra

💭
Workin’
View GitHub Profile
@phucdev
phucdev / convert_dataset.py
Last active November 18, 2025 19:23
Convert ClassLabel/Sequence[ClassLabel] to string labels for HuggingFace Datasets
from datasets import Dataset, ClassLabel, Value, load_dataset
def convert_class_labels_to_str(examples: Dataset):
"""
Utility function to turn (shallow) ClassLabel indices to string labels.
This is common for datasets hosted on the Hugging Face datasets hub with data loading scripts, where the label(s)
are stored as ClassLabel or Sequence[ClassLabel] objects.
Often times we are interested in the string labels rather than the indices.
If any ClassLabel feature is embedded in a nested structure like a dict this will not work
This file has been truncated, but you can view the full file.
{
"1594486665971892224": {
"id": 1594486665971892224,
"user_id": 16298441,
"user": null,
"created_at": 1668990219,
"text": "if you tell me The Mask is standing behind me i will turn around and try to look at it. Because my dumb ass thinks The Mask is real",
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
"retweet_count": 670,
@torbiak
torbiak / groff-install-font
Last active August 21, 2025 23:59
Install ttf and otf fonts for use with groff
#!/usr/bin/env bash
# groff-install-ttf converts a TrueType (ttf) or OpenType (otf) font to a
# Printer Font ASCII (pfa) font and a groff font (ditroff) and installs them to
# groff's site-font directory.
#
# Requires fontforge.
#
# You're the best, Peter Schaffter, but contrary to the verbose and
# difficult-to-follow http://www.schaffter.ca/mom/momdoc/appendices.html#fonts,
# the t42 file doesn't seem to be necessary, at least with recent versions of
@iluvcapra
iluvcapra / AEPtulImport
Last active November 30, 2021 08:15
Pro Tools Import Apple Event via AEDebugSends=1
{ 1 } 'aevt': Sd2a/SRgn (i386){
return id: 315 (0x13b)
transaction id: 0 (0x0)
interaction level: 32 (0x20)
reply required: 1 (0x1)
remote: 0 (0x0)
for recording: 0 (0x0)
reply port: 0 (0x0)
target:
{ 1 } 'sign': 4 bytes {