Skip to content

Instantly share code, notes, and snippets.

View j8r's full-sized avatar

Julien Reichardt j8r

  • Earth
View GitHub Profile
@j8r
j8r / compile-crystal-arm64.sh
Last active April 27, 2023 17:59
Compile a Crystal program to a statically linked arm64 binary
#!/bin/sh -eu
LOCAL_PROJECT_PATH=${1-$PWD}
BUILD_COMMAND="
shards build --static --release
chown 1000:1000 -R bin
"
INSTALL_CRYSTAL="
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >>/etc/apk/repositories
apk add --update --no-cache --force-overwrite \
@j8r
j8r / youtube-dl.txt
Last active February 13, 2022 22:35
youtube-dl mp3 music download
# python3 -m pip install --user --upgrade youtube-dl
# ~/.local/bin should be in the PATH in ~/.bashrc / ~/.zshrc (PATH=$PATH:~/.local/bin)
# now at ~/.local/bin/youtube-dl
youtube-dl -o "%(title)s.%(ext)s" -f bestaudio --embed-thumbnail --extract-audio --audio-quality 0 --audio-format mp3 $URL
# yt-dlp
# python3 -m pip install --user --upgrade yt-dlp
yt-dlp -o "%(title)s.%(ext)s" --embed-thumbnail --extract-audio --audio-quality 0 --audio-format opus $URL
@j8r
j8r / string_with_chars.cr
Last active April 9, 2019 11:32
String::Chars
class String
struct Chars
include Indexable(Char)
def initialize(@str : String)
end
def unsafe_fetch(index)
@str.char_at(index)
end