Skip to content

Instantly share code, notes, and snippets.

View andrioid's full-sized avatar

Andri Óskarsson andrioid

View GitHub Profile
@andrioid
andrioid / agents.md
Last active February 20, 2026 16:40
Opinionated patterns and principles. Distilled from my PR reviews and enriched manually

Code Patterns & Preferences

General Principles

  • Consistency is paramount. That applies to UI, UX, architecture, code and APIs.
  • We must understand a problem-area before we start work on a solution
  • Aim for simplicity and readability and avoid complexity
  • Humans and computer-agents have limited context-windows. Scope should reflect this, and changes should be applied in digestible phases.
  • Architecture decisions must be reviewed by at least one other engineer
  • Review your own code-changes
@andrioid
andrioid / styrbar.yaml
Created September 27, 2025 19:51
ikea styrbar z2m
blueprint:
name: IKEA Styrbar - E2001_E2002 Switch Actions (Z2M)
description:
Define actions for press and hold on all four buttons of the E2001_E2002
switch.
domain: automation
author: Keviin Cosmos
input:
controller_device:
name: (Zigbee2MQTT) Controller Device
@andrioid
andrioid / smarthjemmet.yaml
Last active September 26, 2025 12:10
smarthjemmet zha button 4-way
blueprint:
name: Smarthjemmet 4-way ZHA
description: >
Handle button presses from a Zigbee remote with 4 buttons via ZHA.
Match on device IEEE, endpoint (1..4), and a gesture name (single/double/hold/release).
If your remote uses different command names, override them below.
domain: automation
input:
switch:
@andrioid
andrioid / chart.yaml
Created July 20, 2025 08:14
HA temperature card w. apex charts
type: custom:apexcharts-card
graph_span: 24h
header:
show: true
title: Temperatur
show_states: true
colorize_states: true
apex_config:
stroke:
width: 2
@andrioid
andrioid / svg-icon.mjs
Last active June 11, 2025 09:11
svg-icon.mjs
/**
* Usage, import as module and use like <svg-icon href="/icons/icon.svg#icon></svg-icon>.
* Note: Due to browser quirks, the icon file requires a top-level id for the fragment. Otherwise it wont work in Firefox.
*/
class IconElement extends HTMLElement {
constructor() {
super();
this._href = ""
}
@andrioid
andrioid / infinite-query-example.tsx
Last active August 20, 2024 07:30
Fetch all the pages with useInfiniteQuery
const uq = useInfiniteQuery({
queryKey: ["all_contacts"],
queryFn: ({ pageParam }) =>
api.getContacts({
page: pageParam,
}),
getNextPageParam: (lastPage) => {
if (lastPage.pagination.hasNextPage === false) return null;
return lastPage.pagination.currentPage + 1;
},
@andrioid
andrioid / nosense.tcl
Created February 10, 2023 08:14
Old Eggdrop script I made for handling a busy Icelandic IRC channel
# nosense.tcl by Andri Oskarsson
# - merlin@scrolls.org
# - Merlin@IRCnet
#
# designed to detect lines that are not classified as an actual conversation
# - It currently detects: caps, repeat, colors, bold, reverse, disturbance and more
# To mark channels for nosense detection do like (.chanset #channel +nosense)
# Lets make it so
@andrioid
andrioid / resume.json
Last active July 3, 2019 17:53
CV in JSON Resume format
{
"basics": {
"name": "Andri Óskarsson",
"label": "Computer Engineer",
"picture": "https://andri.dk/static/3a12aa0364d1851eaab41841f8a12b88/284df/coffee-art.jpg",
"email": "m@andri.dk",
"website": "https://andri.dk",
"summary": "Driven, independent Software Developer with a broad skill set.",
"location": {
"city": "Aalborg",
@andrioid
andrioid / Dockerfile
Last active July 5, 2018 08:27
docker-compose with CompileDaemon, Postgres and go-micro
# build/base-image/Dockerfile
FROM golang:1.10-alpine
ENV GOBIN /go/bin
RUN apk add --no-cache git
RUN go get -u github.com/golang/dep/cmd/dep && go get -u github.com/githubnemo/CompileDaemon
VOLUME ["/go/src/gitlab.com/parkpark/parking"]

Keybase proof

I hereby claim:

  • I am andrioid on github.
  • I am andrioid (https://keybase.io/andrioid) on keybase.
  • I have a public key ASBGyzR9oDNGwQMN6sGbtbGgq-4XqyQG_JG6jsuckLzg9wo

To claim this, I am signing this object: