Skip to content

Instantly share code, notes, and snippets.

View alkemann's full-sized avatar

Alexander Morland alkemann

View GitHub Profile
@alkemann
alkemann / markdown.syntax.highlighter.patch
Created September 4, 2017 13:40
A Patch trying to fix markdown code blocks
Index: src/main/java/io/github/swagger2markup/markup/builder/internal/AbstractMarkupDocBuilder.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main/java/io/github/swagger2markup/markup/builder/internal/AbstractMarkupDocBuilder.java (date 1499692487000)
+++ src/main/java/io/github/swagger2markup/markup/builder/internal/AbstractMarkupDocBuilder.java (revision )
@@ -227,6 +227,20 @@
return listingBlock(replaceNewLines(text), null);
}
@alkemann
alkemann / day11.py
Created December 12, 2019 07:05
Advent of Code, a broken day 11
from lib import get_input
def intcode(input_values, ram, pos=0, rel_base=0):
p_per_op = {1: 2, 2: 2, 3: 0, 4: 1, 5: 2, 6: 2, 7: 2, 8: 2, 9: 1, 99: 0}
move_per_op = {1: 4, 2: 4, 3: 2, 4: 2, 5: 0, 6: 0, 7: 4, 8: 4, 9: 2, 99: 0}
wr_per_po = {1: True, 2: True, 3: True, 4: False, 5: False, 6: False, 7: True, 8: True, 9: True, 99: False}
while True:
op_str = str(ram[pos])
op = int(op_str[-2:])
@alkemann
alkemann / Macros.md
Last active January 9, 2022 22:24
D100 Dungeon macros for Roll20.net

D100 macros

This strategy assumes that you have created (at least) two character sheets. You should make sure to make a "custom" character sheet for this game. You can use HTML and CSS to style it if you prefer, but it is not needed since we have the character sheet in the Google sheet ( https://docs.google.com/spreadsheets/d/1ty892ds1VMRs2l5GwFIiWR1_Ov8S5YeYdzm-bYu_e24/edit?usp=sharing ).

After having made two sheets, name one Player and the other Monster. In the sheet under the Attributes and abilities tab you can click the Add button to add any number of custom attributes. You must add all the ones that are mentioned in macros you will use, but it is perfectly ok for them to have no values (will be functionally the same as 0).

The macros look up values from both Player and Monster using a syntax like this @{ then character name then | followed by the attribute to look up and ends with }. So to look up the strength score (str) on the player, it will use @{Player|str}.

For each of the m

<?php
namespace alkemann\htmx;
class HtmxDetails
{
protected $is_htmx_request;
protected $is_boosted;
protected $current_url;
@alkemann
alkemann / dataclass_basemodel.py
Created February 12, 2023 21:53
Dataclass with db in basemodel
import sqlite3
from contextlib import contextmanager
from util import BaseModel
from dataclasses import dataclass
from util import get_db
import dataclasses
from typing import Iterable
import logging