Skip to content

Instantly share code, notes, and snippets.

View knbknb's full-sized avatar
💭
🙅‍♀️💡💤😴🛌🤪🧔

Knut Behrends knbknb

💭
🙅‍♀️💡💤😴🛌🤪🧔
View GitHub Profile
@knbknb
knbknb / all-pseudocalc-fields.sh
Last active September 23, 2024 13:32
jq: scriptfragments for mDIS
#!/usr/bin/env bash
# Set default value for INTERMEDIATE_FILE
DEFAULT_INTERMEDIATE_FILE="../pseudocolumns-per-table.json"
# Check if an argument is provided, otherwise use the default value
INTERMEDIATE_FILE=${1:-$DEFAULT_INTERMEDIATE_FILE}
if [[ ! -f "$1" ]]; then
echo "Filename '$1' does not exist, writing JSON to '$DEFAULT_INTERMEDIATE_FILE'"
fi
output_file="alter_tables.sql"
@knbknb
knbknb / mdis-samplehub-gfz-schema-questions.md
Last active August 23, 2024 08:53
mdis-samplehub-gfz: schema

Initial (MDIS): program - expedition - site - hole - core - section - split - sample

final: GfzSektion - LabWorkingGroup - ResearchProject - SamplingLocation - Sample - AnalysisMetaData - AnalyisRun

in mDIS, lieber kürzere Namen sektion – labteam – projekt – location – sample – metadata - run

@knbknb
knbknb / show-perplexity-model-specs.py
Last active December 16, 2024 09:39
Perplexity models: scraper for APIdoc webpage
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
# Fetch the HTML
response = requests.get('https://docs.perplexity.ai/guides/model-cards')
# Parse the HTML
soup = BeautifulSoup(response.text, 'html.parser')
@knbknb
knbknb / colorize-dbeaver-erd-diagram.py
Last active August 31, 2024 10:36
colorize a DBeaver ERD file
#!/usr/bin/env python
import xml.etree.ElementTree as ET
import sys
import os
import re
# python colorize-diagram.py ./samplehub_gitlab.erd
# Check if the input file is provided
if len(sys.argv) != 2:
@knbknb
knbknb / hackernews-button.userscript.js
Created August 21, 2024 20:51
Hacker News Collapse Button
// ==UserScript==
// @name HN Comment Collapse/Expd Button Injector
// @version 1
// @grant none
// @namespace http://userscripts.org/people/14536
// @description Toggle all comments from collapsed to expanded state
// @match https://news.ycombinator.com/*
// @author Knut Behrends, ChatGPT
// ==/UserScript==
(function() {
@knbknb
knbknb / docker-tlsverify-commands.sh
Last active August 16, 2024 07:37
docker-tlsverify-commands.sh
# apt install mkcert
# create a root CA locally
mkcert --install
# on well
## server certificate and key
mkcert --cert-file ~/.local/share/mkcert/well-server.crt --key-file ~/.local/share/mkcert/well-server.key 192.168.178.25 localhost 127.0.0.1 ::1
@knbknb
knbknb / systemctl-and-journalctl-commands.sh
Last active August 16, 2024 06:41
systemctl and journalctl commands
### systemctl and journalctl commands
sudo journalctl --follow --unit=docker \
--since "5 days ago" --priority=warning --priority=err --no-pager
## create an override file
sudo systemctl edit docker.service
# will create (including subdirs):
# /etc/systemd/system/docker.service.d/override.conf
@knbknb
knbknb / qmd_template_at_a_glance.qmd
Last active August 19, 2024 14:06
R: quarto custom css
---
title: Title
subtitle: Subtitle
author: # originally: Erik Erhardt
date: last-modified # today, now, last-modified
date-format: long # full, long, medium, short, iso, https://quarto.org/docs/reference/dates.html
format:
html:
theme: litera
highlight-style: atom-one
@knbknb
knbknb / docker-commands.sh
Last active January 15, 2025 16:28
Docker HTTP API
curl --unix-socket /run/docker.sock http://localhost/version | jq
curl --unix-socket /run/docker.sock http://localhost/images/json | jq -c "[.[] | [.RepoTags[0] , .Labels.maintainer]]" | perl -ple "s/,\[/\n[/g" | sort
@knbknb
knbknb / hat.rkt
Created May 16, 2024 08:15 — forked from rdivyanshu/hat.rkt
Hat tiling
#lang racket
(require metapict)
(require metapict/pict)
(struct M-edge (turn) #:transparent)
(struct X+ M-edge () #:transparent)
(struct X- M-edge () #:transparent)
(struct A+ M-edge () #:transparent)