Skip to content

Instantly share code, notes, and snippets.

View LunarLambda's full-sized avatar

Meriel Luna Mittelbach LunarLambda

View GitHub Profile
@LunarLambda
LunarLambda / explain.zsh
Last active August 28, 2024 12:40
I wrote a ZSH oneliner that generates a drop-in configuration for user@.service for setting the XDG base directory environment variables.
#!/usr/bin/zsh -f
print -- "Setting XDG_DATA_HOME to \"foo bar\" for demonstration purposes"
XDG_DATA_HOME="foo bar"
print -l -- "Base expansion" \
"\$(typeset -m 'XDG_*_HOME')" "" \
$(typeset -m 'XDG_*_HOME') ""
print -l -- "Add newline splitting and sorting flags: (fo)" \
"\${(fo)\"\$(typeset -m 'XDG_*_HOME')\"}" "" \
@LunarLambda
LunarLambda / pokescale.sh
Created October 12, 2023 07:25
Script for pixel-perfect scaling of Pokémon sprites or other pixel art for use as Discord or Mastodon emotes
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage: $0 <infile> <outfile>"
echo "use TARGET environment variable to set target size (default: 128)"
exit 1
fi
convert -trim +repage "$1" "$2"
read -r w h <<<"$(identify -format '%[fx:w] %[fx:h]' "$2")"
@LunarLambda
LunarLambda / git-eol.md
Last active November 21, 2024 19:47
Guide to line ending handling in Git

Guide to line ending handling in Git

Clickbait title: Improve your Git experience with this one weird trick StackOverflow hates

If you're reading this guide, it's because you're either wondering about, or have actively run into a problem with, Git's handling of line endings. Maybe you're a Windows user, or someone working on the same repository as you is, or you do development across operating systems, or you're working with tools that break operating system convention, or...

@LunarLambda
LunarLambda / arch-wsl-diy.md
Last active May 18, 2024 12:00
Arch on WSL2, DIY-Style
@LunarLambda
LunarLambda / fizzbuzz-befunge.md
Last active January 28, 2021 18:53
Weird Coding - FizzBuzz in Befunge

Weird Coding - FizzBuzz in Befunge

Jan 28 2021

I seem to have a real infatuation with unconvential programming challenges. Whenever I get to do something completely new that is at the same time simple enough to take no more than a day or two, but also far enough 'out there' that just looking up the solution is out of the question, my brain really seems to light up.

So, after rewatching [Tom Scott's video about the FizzBuzz interview question][fizzbuzz-yt], I figured a fun brain teaser would be to try and implement FizzBuzz in [Befunge][befunge], an esoteric programming language I am quite fond of.

Without much fanfare, here it is:

@LunarLambda
LunarLambda / vim-indentation-guide.md
Created September 30, 2019 22:43
A Best Effort Guide to Vim's Indentation Settings.

Vim 'Indentation Hell': A Best Effort Guide

I love Vim. But it isn't perfect, unfortunately.
And one part that is particularly confusing when setting up for the first time is indentation.
This guide strives to cover what options are relevant, what they do, how they interact, and how to set them up for most popular indentation styles.

Meet The Cast

Vim has 5 options relating to (manual) indentation: