Skip to content

Instantly share code, notes, and snippets.

View gwpl's full-sized avatar

Grzegorz Wierzowiecki gwpl

  • Europe - usually: Zürich, Warsaw or Berlin
View GitHub Profile
gwpl /
Last active April 28, 2024 23:39
Vector Embeddings Algebra Tests

Exmaple outputs

Ollama with mxbai-embed-large

similarities between "queen-woman+man" and ... = {'queen': 0.7664688552859836, 'woman': 0.16067344014964902, 'man': 0.643216410618745, 'king': 0.5296803458540953, 'knight': 0.36225247833752694, 'carpenter': 0.7134908064255635, 'baker': 0.723708193109565, 'girl': 0.734322206946502, 'boy': 0.7525008550380998}
similarities between "queen-girl+boy" and ... = {'queen': 0.9750610709453384, 'woman': 0.5392273263146471, 'man': 0.5579780738003502, 'king': 0.5312961528030734, 'knight': 0.5244125308085369, 'carpenter': 0.8835927517707559, 'baker': 0.9011729720423287, 'girl': 0.9227513575082695, 'boy': 0.9679081680297743}
similarities between "queen-woman-girl+man+boy" and ... = {'queen': 0.7059391012944155, 'woman': 0.11622645526937725, 'man': 0.6346237227600416, 'king': 0.5228061118283761, 'knight': 0.3225914898607214, 'carpenter': 0.6156882192910788, 'baker': 0.6321456800653157, 'girl': 0.6540596727195828, 'boy': 0.7065316024823556}
gwpl / memtest.c
Created March 13, 2024 11:47
Toy example illustrating that on Linux memory is initialized when used.
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main() {
// Allocate 16GB of memory
size_t size = 16UL * 1024 * 1024 * 1024;
char* memory = malloc(size);
// Access only some memory in the middle
gwpl /
Created February 16, 2024 11:42
alias find_sources='find . -type f \( -name '\''*.md'\'' -o -name '\''*.toml'\'' -o -name '\''*.txt'\'' -o -name '\''*.py'\'' -o -name '\''*.rs'\'' -o -name '\''*.go'\'' -o -name '\''*.sol'\'' -o -name '\''*.css'\'' -o -name '\''*.js'\'' -o -name '\''*.yaml'\'' -o -name '\''*.json'\'' -o -name '\''*.c'\'' -o -name '\''*.cpp'\'' -o -name '\''*.cc'\'' -o -name '\''Makefile'\'' -o -name '\''*.sh'\'' \)'
head -n -0 `find_sources`
gwpl /
Last active January 22, 2024 21:42
Swiss Letter Markdown+LaTeX Template for pandoc
pandoc -o Swiss_Letter_Template.{pdf,md}
gwpl /
Last active January 8, 2024 12:38
Micro example of proptest for micro AST | as reading "Proptest from the Bottom Up"
Maybe some inspiration (proptesting , not fuzzing, per say, still maybe helpful/inspiring):
Micro example of proptest for micro AST | as reading "Proptest from the Bottom Up"
use std::fmt;
use proptest::prelude::*;
// Definition of Micro Language AST Grammar
gwpl / RDF SPARQL oxigraph Rust
Last active December 30, 2023 21:47
RDF SPARQL oxigraph Rust Notes ( Link to this post: )

oxigraph ( ) ! (also you may find related project interesting )

And btw. it looks like rdflib-endpoint (mentioned earlier) can via rdflib-endpoint --store Oxigraph ... be configured to use oxigraph!

cargo install oxigraph_server
mkdir -p oxigraph_data
oxigraph_server --location oxigraph_data load -f example.ttl 
gwpl /
Last active December 18, 2023 12:36
Wish for p2p "give access to my terminal and me approve commands" tool

I with a tool that would allow to give easy like "remotedesktop" access, but for terminal access, with :

  • build in , review of each command to execute on client side
  • review of outputs of commands being send
  • option to allow to stream output of command without review
  • automatic report generation in Markdown with proper codeblocks (generated on both sides)
  • easy p2p connections behind nats like croc , toss/catch , syncthing.

So basically I would love tool to help people troubleshoot linux issues, like [croc] or [toss] but two easily establish tcp-ip connection(s)

gwpl /
Created December 17, 2023 10:01
Test backticks markdown
gwpl / Dockerfile
Created December 7, 2023 20:15
Nix on Alpine Dockerfile Helloworld
FROM alpine:latest
RUN apk add --no-cache curl xz
RUN addgroup -S nixbld && adduser -S -G nixbld nix
RUN mkdir -m 0755 /nix && chown nix /nix
USER nix
RUN curl -L | sh
ENV PATH=/home/nix/.nix-profile/bin:$PATH