Skip to content

Instantly share code, notes, and snippets.

View NostraDavid's full-sized avatar
🏠
Working from home

NostraDavid NostraDavid

🏠
Working from home
View GitHub Profile
@NostraDavid
NostraDavid / starship.toml
Last active March 22, 2025 15:54
~/.config/starship.toml - based on powerline-status + powerline-gitstatus
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
# `prev_bg` is a special variable that sets the background color to the previous
# module's background color, which is useful for creating a seamless transition between
# modules. For example, you can use it to create a seamless transition between the
# `directory` and `git_branch` modules.
# You can also override fg and bg colors for each module. `fg:prev_bg fg:light_bg` means
# that the foreground color is the previous module's background color, but if there is
@NostraDavid
NostraDavid / process_better.py
Created November 19, 2024 17:00
Polars > Spark, for small (sub 200GB) datasets
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "polars",
# ]
# ///
from pathlib import Path
from typing import OrderedDict
import polars as pl
@NostraDavid
NostraDavid / .wezterm.lua
Created October 5, 2024 10:21
Default Windows wezterm.lua
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder()
-- Set font to JetBrains Mono NF
config.font = wezterm.font('JetBrainsMono Nerd Font')
config.font_size = 10
@NostraDavid
NostraDavid / pde.md
Created September 19, 2024 09:56
Pythonic Data Engineer (GitHub)

Pythonic Data Engineering Style Guide

The Essence of Style

Our coding style is a collective effort, blending engineering and art, aiming for precision and creativity. The best is yet to come.

Why Have Style?

Good style advances our design goals: readability, maintainability, performance,

@NostraDavid
NostraDavid / get_repos.sh
Created September 18, 2024 17:40
Grab all your repos from github and put them in subfolders per user, using curl, jq and git.
#!/usr/bin/env bash
# Set your GitHub token here
GITHUB_TOKEN="<token goes here>"
# Make the cURL request to GitHub API and store the response
response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/user/repos?per_page=100")
@NostraDavid
NostraDavid / debian_12_setup.sh
Created June 21, 2023 19:26
Debian 12 setup
# in Terminal
sudo --login
# as su
usermod -aG sudo david
# ctrl-d
# reboot
# back in terminal
sudo apt install flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
@NostraDavid
NostraDavid / export_chatgpt.js
Created April 3, 2023 19:44
Save this as a bookmark. Go to a ChatGPT chat. Click the bookmark to export the file, with the UUID and Chat Title in the filename
javascript: (() => {let output = "";const es = document.querySelectorAll("[class*='min-h-[20px]']");const today = `${new Date().toISOString().slice(0, 19)}Z`;output += `---\ndate: "${today}"\n---\n#\n%60;for (let i = 0; i < es.length; i++) {const first = es[i].firstChild;if (!first) continue;if (first.nodeType === Node.TEXT_NODE) {let lines = first.textContent.split("\n"); for (let i = 0; i < lines.length; i++) {const line = lines[i];output += %60\n> ${line}%60;}output += %60\n%60;}if (first.nodeType === Node.ELEMENT_NODE) {const childNodes = first.childNodes;for (let j = 0; j < childNodes.length; j++) {const childNode = childNodes[j];if (childNode.nodeType === Node.ELEMENT_NODE) {let tagName = childNode.tagName;let textContent = childNode.textContent;switch (tagName) {case "P":output += %60\n${textContent}%60;break;case "OL":output += %60\n%60;childNode.childNodes.forEach((el, index) => {if (el.nodeType === Node.ELEMENT_NODE && el.tagName === "LI") {output += %60${index + 1}. ${el.textContent}\n%60;}});break
# Note that the "# %%" thing is from Jupyter Notebooks, which should be supported by vscode by default :)
# Just run the code with the "run code" button that pops up right above the "# %%"
# %%
import functools
from typing import Callable
ComposableFunction = Callable[[float], float]
def compose(*functions: ComposableFunction) -> ComposableFunction:
@NostraDavid
NostraDavid / .gitignore
Last active September 18, 2024 17:40
Whitelisting gitignore, instead of the default blacklisting.
# ignore all root items, not recursively
/*
# whitelist dirs
!docs
!example_data
!requirements
!src
!tests
@NostraDavid
NostraDavid / pre-commit-config.yaml
Created December 22, 2021 13:32
A basic pre-commit config
---
repos:
# update the rev versions with a `pre-commit autoupdate`
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/myint/autoflake
rev: v1.4