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 / 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 / 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)

@gwpl
gwpl / Test_backticks.md
Created December 17, 2023 10:01
Test backticks markdown
@gwpl
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 https://nixos.org/nix/install | sh
ENV USER=nix
ENV PATH=/home/nix/.nix-profile/bin:$PATH
@gwpl
gwpl / gist:8faa1b314c7d5905dd23ce041d65dc79
Created November 28, 2023 00:07
Building docker and running custom entrypoint with `pytest` inside for aider
# https://github.com/paul-gauthier/aider or when working on a patch on fork:
docker build --file docker/Dockerfile -t aider-image .
# to launch pytest:
docker run -it --volume $(pwd):/app --entrypoint /bin/bash aider-image -c "pip install pytest && pytest"