Skip to content

Instantly share code, notes, and snippets.

@leobeeson
leobeeson / ontology_ttl_driven_etl.py
Created June 8, 2024 09:25
Two methods for using an ontology .ttl file to guide data validation and transformations in an en ETL pipeline.
import rdflib
from rdflib.namespace import RDF, RDFS, OWL
# Create a Graph
g = rdflib.Graph()
# Parse the TTL file
ttl_file_path = 'path/to/your/ontology.ttl'
g.parse(ttl_file_path, format='ttl')
@leobeeson
leobeeson / async_nested_event_loop.py
Created February 11, 2024 15:04
Async nested event loop for line-by-line execution of async requests.
import asyncio
import nest_asyncio
# Apply nest_asyncio to enable nested event loop usage:
nest_asyncio.apply()
# Class used for the example:
extractor = EntityExtractor()
# Wrap the awaited line in an async function:
@leobeeson
leobeeson / mongodb_6_on_wsl2_ubuntu_2204.md
Last active May 17, 2024 12:21
Installation of MongoDB 6.0 on WSL2 Ubuntu 22.04

Installation of MongoDB 6.0 on WSL2 Ubuntu 22.04

Installed MongoDB using the following guide: Install MongoDB

However, the installation in the guide is for MongoDB 5.0 on WSL with Ubuntu 20.04 (focal) distro.

The following is an adaptation of the guide for installing MongoDB 6.0 on WSL with Ubuntu 22.04 jammy distro.

  1. Open your WSL terminal (ie. Ubuntu) and go to your home directory:: cd ~
  2. Update your Ubuntu packages: sudo apt update
@leobeeson
leobeeson / a-tour-of-go-exercise-slices.go
Created February 16, 2023 12:22
Solution to `Slices Exercise` in `A Tour of Go` tutorial.
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
canvas := make([][]uint8, dy)
for y := 0; y < dy; y ++ {
canvas[y] = make([]uint8, dx)
}