Skip to content

Instantly share code, notes, and snippets.

View moritztim's full-sized avatar

Moritz Tim W. moritztim

View GitHub Profile
@moritztim
moritztim / macos-pkl-install.sh
Created February 13, 2024 18:40
Macos PKL Install
#!/bin/bash
tag="0.25.2"
# Identify CPU architecture
architecture="$(uname -m)"
if [ "$architecture" == "arm64" ] || [ "$architecture" == "aarch64" ]; then
build="aarch64"
elif [ "$architecture" == "x86_64" ]; then
if sysctl -n sysctl.proc_translated > /dev/null 2>&1; then
# This is an ARM CPU running in translation mode
@moritztim
moritztim / spedometer-only.css
Created October 11, 2024 17:45
Displays only the spedometer of the beamng drive web UI. Your `appid` may vary.
.bng-app:not([appid="3"]) {
display: none;
}
.container {
background: black !important;
}
.bng-app[appid="3"] {
width: 100vw !important;
; Replace "example.com" with your domain name (keep the . at the end) and import the file in your cloudflare dashboard
example.com. 1 IN A 185.199.108.153 ; GitHub Pages
example.com. 1 IN A 185.199.109.153 ; GitHub Pages
example.com. 1 IN A 185.199.110.153 ; GitHub Pages
example.com. 1 IN A 185.199.111.153 ; GitHub Pages
example.com. 1 IN AAAA 2606:50c0:8000::153 ; GitHub Pages
example.com. 1 IN AAAA 2606:50c0:8001::153 ; GitHub Pages
example.com. 1 IN AAAA 2606:50c0:8002::153 ; GitHub Pages
example.com. 1 IN AAAA 2606:50c0:8003::153 ; GitHub Pages
@moritztim
moritztim / data_url.py
Created December 16, 2024 23:26
Text to Data URL in python
import base64
def data_url(mime_sub_type: str, text: str) -> str:
"""Convert text to data URL"""
return f"data:text/{mime_sub_type};base64,{base64.b64encode(text.encode()).decode()}"
@moritztim
moritztim / urlParamSchema.schema.json
Created January 13, 2025 22:26
Meta-Schema for abstracting URL parameters into a JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "URL Param Schema",
"description": "Schema to be converted to URL parameters",
"definitions": {
"urlParamSchema": {
"oneOf": [
{
"type": "object",
"properties": {
@moritztim
moritztim / stringCase.schema.json
Created January 13, 2025 23:04
JSON Schema describing the formatting of a multi-word identifier
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "string",
"title": "String Case",
"description": "Formatting of a multi-word identifier",
"default": "snake",
"$comment": "Based on stringcase.org",
"oneOf": [
{
"oneOf": [