Skip to content

Instantly share code, notes, and snippets.

View samebchase's full-sized avatar
🦑

Samuel Chase samebchase

🦑
View GitHub Profile
@samebchase
samebchase / gen-gemini-pres.raku
Created February 20, 2024 09:57
Raku program to generate gemini presentation slides from a single file
#!/usr/bin/env raku
# Example structure of presentation.gmi\
# All the gemtext you want on a 'slide' separated by ===
#`{
# Lightweight Web+Gemini hosting
===
## This is too easy, my $OLD-MUGGLE-RELATIVE could do it
* It was challenging to get it working for me.
@samebchase
samebchase / brc.go
Created February 20, 2024 04:44
One Billion Rows Challenge - Baseline solution in Go.
package main
import (
"bufio"
"flag"
"log/slog"
"os"
"strconv"
"strings"
)
@samebchase
samebchase / 1brc.raku
Last active February 16, 2024 11:20
1brc attempt in Raku
#!/usr/bin/env raku
sub generate-stats($path) {
my $c = Channel.new;
$c.send($_) for $path.IO.lines()
.race(batch => 1024)
.map({ my @v = .split(";");
@v; });
$c.close;
@samebchase
samebchase / create-new-empty-file.raku
Created February 12, 2024 08:26
Creating an empty file nested in directories. aka mkdir -p followed by touch.
#!/usr/bin/env raku
use v6.d
sub MAIN($path-to-file) {
my $path = IO::Path.new: $path-to-file;
try {
mkdir $path.dirname;
CATCH {
@samebchase
samebchase / tailwind-installation-issues.md
Last active January 29, 2024 10:29
Installing tailwind

Issue

I am trying to get started with Phoenix, and when I follow the steps, I get this error:

Error after using OpenBSD tailwind binary

samuel@carolyn ~/p/f/funemployment> mix assets.build

Rebuilding...
0/input0.mute=0 at 12 -> hw:0/96: added
0/input1.mute=0 at 13 -> hw:0/97: added
dec: s16le, 2 channels
enc: s16le, 2 channels
snd0 pst=cfg: 48000Hz, s16le, play 0:1, rec 0:1, 16 blocks of 480 frames
vlc0 vol=127,pst=ini: using default, mode = 1
vlc0 vol=127,pst=ini,rmsg,widl: SETPAR message
vlc0 vol=127,pst=ini,rmsg,widl: playback channels 0:1 -> 0:1
vlc0 vol=127,pst=ini,rmsg,widl: 48000Hz sample rate, 480 frame blocks
vlc0 vol=127,pst=ini,rmsg,widl: 12000 frame buffer
model test_json_values is table<test_json_values> is export {
has Json $.j_field is column;
has Json $.k_val is column;
}
sub fetch-nullable-json-values() is export {
for test_json_values.^all -> $val {
say $val;
say $val.j_field;
}
@samebchase
samebchase / Models.rakumod
Created January 14, 2022 17:04
Nullable Json columns
model foo is table<foo> {
has Str $.id is column;
has Json $.from_data is column{:nullable};
has Json $.to_data is column{:nullable};
has Json $.extra_data is column{:nullable};
}
@samebchase
samebchase / realistic.clj
Created November 28, 2020 12:43
realistic.clj
(ns my-amazing.module.core
(:require [another-library.json.module :as json]
[yet-another.http.library :as http]))
grammar Namespace {
token TOP { <ns-form>
# <clojure-forms>
}
# token clojure-forms { }
token ns-form { <.ws>?
(<.comment-line> <ws>?)*
<.ws>?