This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # /// script | |
| # dependencies = ["networkx", "matplotlib", "scipy"] | |
| # /// | |
| """Stand-in render of brain.orbit.json (force layout). Usage: uv run render_graph.py <json> <out.png>""" | |
| import json, sys | |
| import networkx as nx | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| import matplotlib.pyplot as plt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Swiss heating threshold Flight. | |
| Loads Swissgrid "Energieuebersicht Schweiz" 15-min data and MeteoSwiss daily | |
| station data into MotherDuck, runs data-quality checks, and estimates the | |
| heating threshold (temperature below which end-user consumption rises) with a | |
| hinge regression controlling for weekends and public holidays. | |
| Config (env vars): | |
| DB target MotherDuck database (default energy_weather) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {{- $content := .content | default .Page.RawContent -}} | |
| {{- $brainBaseURL := .Site.Language.Params.brainBaseURL | default "https://ssp.sh/brain/" -}} | |
| {{- /* Process wikilinks with proper URL formatting and alias support */ -}} | |
| {{- $content = replaceRE `\[\[([^\]]+)\]\]` `<WIKILINK_TEMP>$1</WIKILINK_TEMP>` $content -}} | |
| {{- /* Now process each wikilink individually */ -}} | |
| {{- $wikilinks := findRE `<WIKILINK_TEMP>([^<]+)</WIKILINK_TEMP>` $content -}} | |
| {{- range $wikilinks -}} | |
| {{- $linkContent := replaceRE `<WIKILINK_TEMP>([^<]+)</WIKILINK_TEMP>` "$1" . -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Extract YouTube subscription data and create RSS feed URLs | |
| """ | |
| import json | |
| import re | |
| import html | |
| from pathlib import Path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --connect to MotherDuck databases | |
| -- configure MOTHERDUCK_TOKEN and run DuckDB that connects to all shared Databases with | |
| -- `duckdb "md:"` | |
| -- and then run this query: | |
| WITH language_counts AS ( | |
| SELECT | |
| language, | |
| COUNT(*) AS count | |
| FROM ( | |
| SELECT UNNEST(STRING_SPLIT(LanguageHaveWorkedWith, ';')) AS language |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Globals */ | |
| :root { | |
| --sidebar-target-width: 300px; | |
| --sidebar-width: min(var(--sidebar-target-width), 80vw); | |
| --sidebar-resize-indicator-width: 8px; | |
| --sidebar-resize-indicator-space: 2px; | |
| --page-padding: 15px; | |
| --content-max-width: 750px; |
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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"): |
NewerOlder