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
gwpl / Example_Outputs.md
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
gwpl / clean.sh
Last active March 15, 2024 15:56
`openssl pkeyutl` how to: -sign -verify -encrypt -decrypt , using openssh keys snippets/examples
rm -v pub.pkcs8 test.sign test.txt.decrypted test.txt.encrypted
@gwpl
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
gwpl / make_dump_of_sources_with_paths.sh
Created February 16, 2024 11:42
make_dump_of_sources_with_paths.sh
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
gwpl / 00_compile_to_pdf.sh
Last active January 22, 2024 21:42
Swiss Letter Markdown+LaTeX Template for pandoc
pandoc -o Swiss_Letter_Template.{pdf,md}
@gwpl
gwpl / proptest_addition_AST_micro_example.rs
Last active January 8, 2024 12:38
Micro example of proptest for micro AST | as reading https://proptest-rs.github.io/proptest/proptest/tutorial/index.html "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 https://proptest-rs.github.io/proptest/proptest/tutorial/index.html "Proptest from the Bottom Up"
```rust
use std::fmt;
use proptest::prelude::*;
// Definition of Micro Language AST Grammar
@gwpl
gwpl / RDF SPARQL oxigraph Rust Notes.md
Last active December 30, 2023 21:47
RDF SPARQL oxigraph Rust Notes ( Link to this post: https://stackoverflow.com/a/77737438/544721 )

oxigraph ( https://github.com/oxigraph/oxigraph ) ! (also you may find related project interesting https://crates.io/crates/reasonable )

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
gwpl / BashMelodies.sh
Last active December 22, 2023 10:44
BashMelodies: - Musical Bash!
#!/bin/bash
#
# 🎶 Just transformed #Bash into a musical instrument with a little help from an AI!
# Check out this cool script that plays melodies using simple commands. 🤖🎵
# PS: Wouldn't have explored this without the AI insights. Here's our chat:
# https://chat.openai.com/share/60aa47f0-3793-47f7-a8d8-f2a14ee04747
#
# Run as script
# Or source into your shell "source BashMelodies.sh" and call functions directly!
@gwpl
gwpl / p2p_give_access_proposal.md
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)