Skip to content

Instantly share code, notes, and snippets.

View ad-si's full-sized avatar
🎯
Working on airsequel.com

Adrian Sieber ad-si

🎯
Working on airsequel.com
View GitHub Profile
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 16, 2024 19:51
Hyperlinks in Terminal Emulators
@dino-
dino- / string-conversions.hs
Last active May 3, 2024 08:57
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@montasaurus
montasaurus / llmc.sh
Last active April 20, 2024 21:32
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@LeaVerou
LeaVerou / dabblet.css
Created April 19, 2013 21:19
SVG inspired by Quine's paradox
/**
* SVG inspired by Quine's paradox
*/
svg {
display: block;
margin: 40px auto;
font: 83px sans-serif;
}
@zlbruce
zlbruce / svg2icns
Created October 1, 2016 01:17
covert svg to icns (with imagemagick)
#!/bin/bash
echo "*** SVG 2 ICNS ***"
if [ $# -ne 1 ]; then
echo "Usage: svg2icns filename.svg"
exit 100
fi
filename="$1"
name=${filename%.*}
ext=${filename##*.}
echo "processing: $name"
@kroger
kroger / midi2mp3
Last active December 18, 2023 17:03
Convert MIDI files to MP3 using fluidsynth. See
#!/usr/bin/env bash
SOUNDFONT=/Users/kroger/Dropbox/Sfonts/BOPLMEVF16.sf2
TMPDIR=/tmp
if [[ ! -f $SOUNDFONT ]]
then
echo "Couldn't find the soundfont: $SOUNDFONT"
exit 1
@nick-desteffen
nick-desteffen / OSX UTC Time Zone
Created August 5, 2011 01:50
Set Time zone in OSX to UTC
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
@ChiChou
ChiChou / unhex.sql
Last active October 11, 2023 05:44
SQLite3 convert hex string to int (requires sqlite >= 3.8.3)
WITH RECURSIVE
unhex(str, val, weight) AS (
SELECT 'deadbeef', 0, 1
UNION ALL
SELECT
substr(str, 1, length(str) - 1),
val + (instr('0123456789ABCDEF', substr(str, length(str), 1)) - 1) * weight,
weight * 16
FROM unhex WHERE length(str) > 0
)
@rauschma
rauschma / about-proposal.md
Last active October 6, 2023 18:30
Enum proposal

Advantages compared to using symbols as enum values:

  • Enum values are much more customizable. For example, one can have custom prototype and/or instance methods.
  • Enum values get two custom properties:
    • name provides direct access to the name of an enum value.
    • ordinal holds a number, the position of the enum value. Useful for some applications.
  • One can use instanceof to test whether a value is an element of an enum.
  • One occasionally requested feature for enums is that enum values be numbers (e.g. for flags) or strings (e.g. to compare with values in HTTP headers). That can be achieved by making those values properties of enum values. For an example, see enum Mode, below.

Static properties of enums: