Skip to content

Instantly share code, notes, and snippets.

@dtornow
dtornow / rename.md
Created March 30, 2023 18:55
Rename PDF Document

Rename PDF Document

Simple script to rename a pdf document to its most likely title via openai, written by, you guessed, openai :)

You will need an openai key

Why

I like to read and collect a lot of papers, but they almost always come with names like 0909.1788.pdf, so I rename each and every one.

@dtornow
dtornow / file.md
Last active January 15, 2021 14:04

For each Node N, Daemon D, Pod P, and Container C of P

  • if N hosts D and N hosts P and P's address is a and C listens on port p then
    • if there is a Send Event observed at D with a target-address a and a target-port p then
  • there is a Recv Event observed at C with a target-address a and a target-port p
Ref(Rollbinding, Role) ≝
∧ RoleBinding.RoleRef.Kind = Role.Kind
∧ RoleBinding.RoleRef.Name = Role.Name
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: GrowPods
subjects:
- kind: Group
name: Editor
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: SowChaos
namespace: default
subjects:
- kind: ServiceAccount
name: ChaosMonkey
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: default
name: SowChaos
rules:
- apiGroups: [""] # indicates the core API group
resources: ["pods"]
verbs: ["list", "delete"]
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: GrowPods
rules:
- apiGroups: [""] # indicates the core API group
resources: ["pods"]
verbs: ["*"]
@dtornow
dtornow / file.tla
Last active March 18, 2019 17:10
RBAC
Matches(Binding, User) ≝
∃ Subject ∈ Binding.Subjects:
CASE Subject.Kind = "User" ⟶
Subject.Name = User.Name
[] Subject.Kind = "Group" ⟶
Subject.Name \in User.Groups
[] Subject.Kind = "ServiceAccount" ⟶
ServiceAccount(Subject.Name, WithDefault(Subject.Namespace, Binding.Namespace)) = User.Name
# POST /api/
Verb: Create
APIGroup:
APIVersion: 1.0
Resource: Pod
SubResource:
Namespace: default
Name:
Attributes:
# Requesting User
user:
# Requested Operation
verb: string
apigroup: string?