Skip to content

Instantly share code, notes, and snippets.

View sspaeti's full-sized avatar
🔗
maintaining awareness of new emerging open-source #dataengineering technologies

Simon Späti sspaeti

🔗
maintaining awareness of new emerging open-source #dataengineering technologies
View GitHub Profile
@sspaeti
sspaeti / query_read_bsky_feed.duckdb.sql
Created October 30, 2024 09:13
Reading bsky posts with DuckDB example.
-- Query the API directly and flatten the nested JSON structure
WITH raw_data AS (
SELECT * FROM read_json_auto('https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=did:plc:edglm4muiyzty2snc55ysuqx&limit=10')
),
unnested_feed AS (
SELECT unnest(feed) as post_data FROM raw_data
)
SELECT
-- Post basics
post_data.post.uri as post_uri,
@sspaeti
sspaeti / rss-feed-generator.py
Created December 21, 2023 10:56
Generating RSS feed based on existing `sitemap.xml`
import xml.etree.ElementTree as ET
import PyRSS2Gen as rss
import datetime
# Parse the sitemap.xml
tree = ET.parse("book/sitemap.xml")
root = tree.getroot()
# Define the RSS feed basic info
rss_feed = rss.RSS2(
@sspaeti
sspaeti / variables.css
Created December 8, 2023 11:08
Custom Themes for mdBook in `theme/css/variables.css`
/* Themes */
/* My favorite theme: https://github.com/rebelot/kanagawa.nvim */
.kanagawa {
/* Using the Kanagawa color palette */
--bg: #1F1F28; /* sumiInk1 for Default background */
--fg: #DCD7BA; /* fujiWhite for Default foreground */
--sidebar-bg: #2A2A37; /* sumiInk2 for a subtler sidebar background */
--sidebar-fg: #C8C093; /* oldWhite for Dark foreground in sidebar */
@sspaeti
sspaeti / prompt-roles-chatgpt.csv
Created June 19, 2023 21:51
prompts act as role for ChatGPT.nvim
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 3.
"act","prompt"
"Rust Developer", "I want you to act as a expert Rust software developer. I will provide some specific information about a Rust project and you will have to come up with a solution. I will provide you with a Rust project that has a long code in one file. I want you to write well structured code"
"Technical Author and Data Engineer", "I want you to act as an expert Data Engineer and someone fond of diving into the latest in open-source data engineering on my blog. Your voice isAuthentic, friendly succinct, and informative with the goal of value-adding to the readers. The writing whenever possible in the I form. So I can be honest and trustworthy. You try to give clues and tools concrete and extremely specific. The Key is to inspire instead of describing everything. You tell a story and involve the user with well structure such as 1. writing about now 2. us 3. self like described in the "Public Narrative" with Collective Action and Power now us and self. You help the user by highlighting importan
@sspaeti
sspaeti / html2markdown.py
Created September 26, 2021 08:43
Convert exported HTML pages to Markdown pages recursively where you start this script from
"Convert exported HTML pages to Markdown pages recursively where you start this script from"
import os
from markdownify import markdownify
from pathlib import Path
for dirpath, dirs, files in os.walk("."):
print("--" + dirpath)
for filename in files:
if filename.endswith(".html"):
@sspaeti
sspaeti / wp-to-gohugo-image-mover.py
Created April 15, 2021 06:06
Moving images from WordPress /images/wp-content to /content/posts/my-post/images
"""
If you moved from Wordpress to GoHugo and all your images are in "/images/wp-content", but you want to use image processing or other featues of GoHugo
that only works in the content-folder (/content/posts/).
This script
1. searches all images from wordpress which are used in the content
2. creating a folder with the name of the content-file (*.md)
3. moving images to /content/posts/my-post-name/images
4. and creates and index.en.md with the content.
After you run it, I used regexp search/replace in visual studio to replace old images to new path inside the content (*.md) files.
@sspaeti
sspaeti / onenote_export.py
Last active June 22, 2024 22:32 — forked from danmou/onenote_export.py
Onenote export to HTML
### README
# This Python scripts exports all the OneNote notebooks linked to your Microsoft account to HTML files.
## Output
# The notebooks will each become a subdirectory of the `output` folder, with further subdirectories
# for the sections within each notebook and the pages within each section. Each page is a directory
# containing the HTML file `<page-name>.html` and its images and attachments. I changed to create
# sepearte directories for `images` and `attachments` as my Markdown editor (obsidian) would show
# this directories seperately what didn't look nice in the File-Tree. Like this, images and Attachments
# are not shown in the tree but within the Markdown which is what I wanted. Any sub-pages will be