Skip to content

Instantly share code, notes, and snippets.

View NorfeldtKnowit's full-sized avatar

Lasse Nørfeldt NorfeldtKnowit

View GitHub Profile
#!/bin/zsh
# Ensure the previous_exports directory exists
mkdir -p previous_exports
for drawioFile in *.drawio.svg; do
# Extracting the "content" attribute value
content=$(sed -n 's/.*content="\([^"]*\)".*/\1/p' "$drawioFile")
# Calculating the MD5 hash of the "content" and taking the first 5 characters
@NorfeldtKnowit
NorfeldtKnowit / gist:ddc6942ba0dd9d67d43de1c7c333108d
Created June 27, 2024 13:20
Generate table in drawio from table_text.txt
#!/bin/zsh
# Function to escape XML special characters
xml_escape() {
local string="${1}"
string="${string//&/&}"
string="${string//</&lt;}"
string="${string//>/&gt;}"
string="${string//\"/&quot;}"
string="${string//\'/&apos;}"
@NorfeldtKnowit
NorfeldtKnowit / README - Zellij <TAB> completion fix.md
Last active February 20, 2026 10:27
Zellij zsh completion with dynamic session name support

Zellij Zsh Completion with Dynamic Session Names + layout

This gist provides zsh completion for zellij with dynamic session name completion and completions for layouts files.

Features

  • Tab completion for all zellij commands
  • Dynamic session name completion for:
    • zellij attach <TAB> (or zellij a <TAB>) - shows active sessions
    • zellij kill-session <TAB> (or zellij k <TAB>) - shows active sessions
@NorfeldtKnowit
NorfeldtKnowit / setup-worktree.sh
Last active January 22, 2026 18:52
Git worktree setup script with dependency syncing
#!/bin/bash
# Git Worktree Setup Script
# Creates a new git worktree and optionally syncs dependencies from the main repo.
# Useful for working on multiple branches simultaneously without re-installing dependencies.
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@NorfeldtKnowit
NorfeldtKnowit / axios-supply-chain-investigation.md
Last active April 7, 2026 07:36
LLM prompt: Investigate axios supply chain attack (March 2026) across repos and machines

LLM prompt: Investigate axios supply chain attack (March 2026) across repos and machines

Axios Supply Chain Attack (March 2026) — Investigation Prompt

You are investigating whether any repositories or machines have been compromised by the axios npm supply chain attack discovered on March 31, 2026. Follow these instructions precisely.

Attack Summary

On March 31, 2026, the npm account of axios maintainer "jasonsaayman" was hijacked. Two malicious axios versions were published containing a dependency on plain-crypto-js@4.2.1, which drops a cross-platform Remote Access Trojan (RAT).

@NorfeldtKnowit
NorfeldtKnowit / product.md
Last active May 1, 2026 10:51
Pre-drafted product.md and tech.md for warpdotdev/warp#9729 — Image preview in the Code Editor file pane

Image preview in the Code Editor file pane

Draft product.md for warpdotdev/warp#9729. To be committed under specs/GH9729/product.md once the issue receives ready-to-spec.

Problem

Clicking an image in Warp's File Tree opens it as a text file in the Code Editor. There is no way to view image assets without leaving Warp.

Goals

@NorfeldtKnowit
NorfeldtKnowit / README.md
Last active July 6, 2026 12:28
AI Cookbook — Git + Lazygit with Delta (Tokyo Night)

AI Cookbook — Git + Lazygit with Delta (Tokyo Night)

This cookbook reproduces a clean, side-by-side diff setup themed in Tokyo Night, applied consistently in two places: the terminal (every git diff, git show, git log -p, and merge conflict) and lazygit's diff panes. It uses delta as the pager, with custom add/remove backgrounds, colored line-number gutters, and styled file and hunk headers, so reviews read the same way whether you are on the command line or driving lazygit.

Prerequisites

  • macOS with Homebrew.
  • A true-color (24-bit) terminal, since the theme relies on exact hex colors.
  • git and (optionally) lazygit already installed.