Meine Notizen

These are just some notes I am making, mostly for myself.
It helps to externalise my notes properly to a more or less imaginary audience.

2024-05-15

Zusammgenfassung Fefes Hackback presentation

Annahmen von Hackback

  1. Wir werden angegriffen
    • Wie definieren?
    • Eher runtergekommene Infrastruktur
  2. Wir merken es zeitnah
    • Nein. Ein halbes bis fünf Jahre.
  3. Wir können den Angreifer identifizieren
    • Nein. IP-Log des gehackten Servers. Aber Quelle Quelle? Nein. NSA Quantum Insert macht IP sogar noch wertloser.
  4. Wir können zurückschlagen
    • Hacken wurde kriminalisiert
    • Exploits kaufen hochspekulativ
    • Exploits einmalig
    • Exploits unethisch
  5. Das verhindert weitere Angriffe
    • Generell anzuzweifeln
    • Hackbacked entities kopieren den Exploit...
Kurz: Humbug.

2024-04-21

Stichpunkte zu "Don't make me think"

Based on years old notes.

Core

=> make stuff self-evident, we scan, satifice and muddle through

Design like billboards

User Testing, User Testing, User Testing

2024-04-20

Stichpunkte zu "The Design of Everyday Things"

Based on years old notes.

Core

Terms/Basics

User perspective

4 constraints

Errors

Designing

Design Principle

2024-04-13

Taking a look at CSS size types

Relative

Relative to display itself:

10px

A pixel is the smallest unit on a display, that you are able to get a sharp 1px line. Thus relative to the used display. This includes images, so image-px. map to css-px, not display-px. In printing however 1px must be exactly 1/96th of an inch in all printed output. Thus px is a good unit to use, when requires alignment of text to images, or need for sharp x*1px

Relative to parent size:

10%

Relative to font size:

10em - font size

10rem - root font size

10ex - x height

Relative to viewed window:

10vw - view width

Absolute

Absolute (for printers):

10in

10cm

10pc

10mm

10pt

viewport meta tag

Now what does viewport="content="width=device-width, initial-scale=1.0" do? This is more or less legacy of old web and old small resolution mobile devices. Because there were no responsive websites early on, small screen devices would render the site based on a larger, more common desktop resolution. width=device-width sets the true width and initial-scale=1.0 zooms correctly. In the following you see 4 examples, rendered with Firefox Developer tools.

Examples:

No viewport meta tag:
Initial-width only:
initial-scale only:
Both:
2024-04-10

Stichpunkte zu "Das geheime Leben der Bäume"

This books has quite a few critics, but its a nice short read. Here some points to remember for me:

In the end this emphasises the need for old growth forest/Urwald, leaving the forest to itself and treating trees not just as implict. (Especially the possible late biomass increase make me more skeptical of taking trees out, while also protecting it. Same goes for hunters. Both are also driven by economic incentives) However, many opinions he has are quite out there and could be presented much more objectivly, but it is not that kind of book.

2024-04-05

Building a minimal Gameboy game

I stumbled again over the Gameboy assembler tutorials. This time I delved a little into the tutorials and wrote these notes to remember.
Links: gbdev.io/gb-asm-tutorial - gbdev.io/pandocs - rgbds.gbdev.io/docs

The minimal "game" I went for:
a falling object needs to be avoided
by the player moving left/right.
Includes: input, sprite movement, collision.


Annotated source code:

INCLUDE "hardware.inc"
 
SECTION "Header", ROM0[$100]

  jp EntryPoint

  ; Make room for the header
  ds $150 - @, 0 

EntryPoint:

WaitUntilVerticalBlankStart:
    ld a, [rLY]
    cp a, 144
    jp c, WaitUntilVerticalBlankStart

    ld [rLCDC], [LCDCF_OFF]

    ; Copy the tile data
    ld de, Tiles
    ld hl, _VRAM9000
    ld bc, TilesEnd - Tiles
    call Memcopy

    ; Copy the tileMap
    ld de, Tilemap
    ld hl, _SCRN0
    ld bc, TilemapEnd - Tilemap
    call Memcopy

    ; Copy sprite tile
    ld de, Player
    ld hl, _VRAM
    ld bc, PlayerEnd - Player
    call Memcopy

    ; Copy ball tile
    ld de, Ball
    ld hl, _VRAM + $10
    ld bc, BallEnd - Ball
    call Memcopy

    ; Clean OAMRAM
    ld a, 0
    ld b, 160
    ld hl, _OAMRAM
ClearOAMRAM:
    ld [hli], a
    dec b
    jp nz, ClearOAMRAM

    ; Draw objects in AMRAM
    ; Player sprite
    ld hl, _OAMRAM
    ld a, 128 + 16
    ld [hli], a
    ld a,  16 + 8
    ld [hli], a
    ld a, 0
    ld [hli], a
    ld [hli], a
    ; Ball sprite
    ld a, 0
    ld [hli], a
    ld a, 32 + 8
    ld [hli], a
    ld a, 1
    ld [hli], a
    ld a, 0
    ld [hli], a

    ; Turn the LCD on
    ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON
    ld [rLCDC], a

    ; During the first (blank) frame, initialize display registers
    ld a, %11100100
    ld [rBGP], a
    ; initialize one of the object palettes, rOBP0
    ld a, %11100100
    ld [rOBP0], a

    ; Initialize global variables
    ld a, 0
    ld [wCurKeys], a
    ld [wNewKeys], a

Main:
    ld a, [rLY]
    cp 144
    jp nc, Main
WaitUntilVerticalBlankStart2:
    ld a, [rLY]
    cp 144
    jp c, WaitUntilVerticalBlankStart2:

    ; move bullet down
    ;cp a, b sets C if a < b, and clears it if a >= b.
MoveBall:    
    ld a, 2
    ld h, a
    ld a, [_OAMRAM + 4]
    add a, h
    ld b, a
    ld a, 160
    cp a, b 
    jp c, MoveBallEnd
    ld a, b
    ld [_OAMRAM + 4], a

    ;check jump to top
    ld a, [_OAMRAM + 4]
    cp a, 159
    jp c, MoveBallEnd
    ld a, 0
    ld [_OAMRAM + 4], a
    ;; add random x position
NewBallY:
    call rand
    ld a, 161
    cp a, b
    jp c, NewBallY
    ld a, b
    ld [_OAMRAM + 5], a
MoveBallEnd:

CheckCollision:
    ; First, check if the ball is low enough to hit player.
    ;get y of player and enemy
    ld a, [_OAMRAM]
    ld b, a
    ld a, [_OAMRAM + 4]
    cp a, b
    ; If the ball isn't at the same Y position as the paddle, it can't bounce.
    jp nz, CheckCollisionEnd 

    ; Now let's compare the X positions of the objects to see if they're touching.
    ld a, [_OAMRAM + 5] ; enemy X position.
    ;right border of player, add this width to enemy
    add a, 8
    ld b, a
    ld a, [_OAMRAM + 1] ; player X position.
    ;if enemy x > player x, else End
    cp a, b
    jp nc, CheckCollisionEnd

    add a, 16 ; get player, but also added 8 for enemy right edge prev.
    ;if enemy x < player x, else End
    cp a, b
    jp c, CheckCollisionEnd

    ; player hit
    ld a, 0
    ld [_OAMRAM + 1], a
CheckCollisionEnd:

    ; Check the current keys every frame and move left or right.
    call UpdateKeys
    ; First, check if the left button is pressed.
CheckLeft:
    ld a, [wCurKeys]
    and a, PADF_LEFT
    jp z, CheckRight
Left:
    ; Move the paddle one pixel to the left.
    ld a, [_OAMRAM + 1]
    dec a
    ; If we've already hit the edge of the playfield, don't move.
    cp a, 7
    jp z, Main
    ld [_OAMRAM + 1], a
    jp Main

; Then check the right button.
CheckRight:
    ld a, [wCurKeys]
    and a, PADF_RIGHT
    jp z, Main
Right:
    ; Move the paddle one pixel to the right.
    ld a, [_OAMRAM + 1]
    inc a
    ; If we've already hit the edge of the playfield, don't move.
    cp a, 161
    jp z, Main
    ld [_OAMRAM + 1], a
    jp Main

; Copy bytes from one area to another.
; @param de: Source
; @param hl: Destination
; @param bc: Length
Memcopy:
    ld a, [de]
    ld [hli], a
    inc de
    dec bc
    ld a, b
    ;; Or checks if length is still left, by bitwise-or of bc
    or a, c
    jp nz, Memcopy
    ret

UpdateKeys:
  ; Poll half the controller
  ld a, P1F_GET_BTN
  call .onenibble
  ld b, a ; B7-4 = 1; B3-0 = unpressed buttons

  ; Poll the other half
  ld a, P1F_GET_DPAD
  call .onenibble
  swap a ; A3-0 = unpressed directions; A7-4 = 1
  xor a, b ; A = pressed buttons + directions
  ld b, a ; B = pressed buttons + directions

  ; And release the controller
  ld a, P1F_GET_NONE
  ldh [rP1], a

  ; Combine with previous wCurKeys to make wNewKeys
  ld a, [wCurKeys]
  xor a, b ; A = keys that changed state
  and a, b ; A = keys that changed to pressed
  ld [wNewKeys], a
  ld a, b
  ld [wCurKeys], a
  ret

.onenibble
  ldh [rP1], a ; switch the key matrix
  call .knownret ; burn 10 cycles calling a known ret
  ldh a, [rP1] ; ignore value while waiting for the key matrix to settle
  ldh a, [rP1]
  ldh a, [rP1] ; this read counts
  or a, $F0 ; A7-4 = 1; A3-0 = unpressed keys
.knownret
  ret

;tiles we can select from in the mapping
;; https://www.huderlem.com/demos/gameboy2bpp.html
;; .33333.. -> 01111100 -> $7C
;;             01111100 -> $7C
;; Three tiles: black, white, gray
Tiles:
    DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF, $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
    DB $00,$00,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00
    DB $FF,$00,$FF,$00,$FF,$00,$FF,$00, $FF,$00,$FF,$00,$FF,$00,$FF,$00
TilesEnd:

;maps the tiles to the screen/background, all white
Tilemap:
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
    db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, 0,0,0,0,0,0,0,0,0,0,0,0
TilemapEnd:


;; Player just a black rectangle
Player:
    DB $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
PlayerEnd:

;; can also set it with values between 0 and 3
;; this is based on hardware.inc, symbols can be changed
Ball:
    dw `00000000
    dw `00033000
    dw `00333300
    dw `03333330
    dw `03333330
    dw `00333300
    dw `00033000
    dw `00000000
BallEnd:

;; declaring variables
SECTION "Input Variables", WRAM0
wCurKeys: db
wNewKeys: db

; RANDOM NUMBER GENERATOR
SECTION "MathVariables", WRAM0
randstate:: ds 4

SECTION "Math", ROM0

;; From: https://github.com/pinobatch/libbet/blob/master/src/rand.z80#L34-L54
; Generates a pseudorandom 16-bit integer in BC
; using the LCG formula from cc65 rand():
; x[i + 1] = x[i] * 0x01010101 + 0xB3B3B3B3
; @return A=B=state bits 31-24 (which have the best entropy),
; C=state bits 23-16, HL trashed
rand::
  ; Add 0xB3 then multiply by 0x01010101
  ld hl, randstate+0
  ld a, [hl]
  add a, $B3
  ld [hl+], a
  adc a, [hl]
  ld [hl+], a
  adc a, [hl]
  ld [hl+], a
  ld c, a
  adc a, [hl]
  ld [hl], a
  ld b, a
  ret
Further points:
2024-04-01

jar/AppImage as Ubuntu Desktop-App

This is a note to help me, when I want to add a .jar or .appimage to my Desktop and call it like normally installed .deb packages:

Create a file example.desktop with the following content:

                [Desktop Entry]
                Name=Example
                Comment=The application does example
                Exec=/home/username/example/example.appimage
                Icon=/home/username/example/example.png
                Type=Application
                Terminal=false
            
Then call desktop-file-validate and desktop-file-install on this file. Now you find this app in the startup menu.

If you want to associate such an app with a file ending you need to edit ~/.local/share/applications/mimeapps.list (at least in Ubuntu) and add a line to the file. Use the existing associations as example.

If you want to call this program via terminal, a simple alias should suffice. Use the ~/.bash_profile or /etc/profile and add alias example="/home/username/example/example.appimage".

Interesting Words in Japanese

While learning any language you always find interesting words, that don't have a translation or have a interesting historical backround:

Stichpunkte zu "Scount Mindset"

Here some points to remember for me:

Ancient Egpytian "Appeal to the living"

Hyroglyphs that translate to: As you love to live and hate to die.

Egyptian Middle Kingdom common Tombstone engraving, and excerpt from
the "Book of the Dead", called "appeal to the living" and part of it conatins:
As you love to live and hate to die.
source: @DigItWithRaven

The Rime of the Ancient Mariner & The Wanderer

After listening to Tokiens reciting of The Ride of the Rohirim, I was looking more into the Rohirim and stumbled over the poem The Wanderer in this article.
Additionally somehow I found the more modern poem Ancient Mariner, which felt similar, including the great interpretation of Iron Maiden.

Hominin & Culture timeline

Two HackerNews comments have this great little list of the human culture timeline and hominin timeline in general:
7-6 million years ago: Possible divergence of the lineage leading to humans from the lineage leading to chimpanzees and bonobos (our closest living relatives).
Ardipithecus kadabba (~5.8-5.2 million years ago)
Ardipithecus ramidus (~4.4 million years ago)
Australopithecus anamensis (~4.2-3.9 million years ago)
Australopithecus afarensis (Lucy) (~3.9-2.9 million years ago)
Kenyanthropus platyops (~3.5 million years ago)
Australopithecus africanus (~3.3-2.1 million years ago)
Paranthropus aethiopicus (~2.7-2.3 million years ago)
Australopithecus garhi (~2.5 million years ago)
Paranthropus robustus (~2-1.2 million years ago)
Homo habilis (~2.1-1.5 million years ago)
Homo rudolfensis (~1.9 million years ago)
Homo ergaster/Homo erectus (~1.9 million years ago - ~143,000 years ago)
Paranthropus boisei (~1.7-1.1 million years ago)
Homo heidelbergensis (~700,000-300,000 years ago)
Homo naledi (~335,000-236,000 years ago)
Homo neanderthalensis (Neanderthals) (~400,000-40,000 years ago)
Denisovans (around 300,000-50,000 years ago)
Homo sapiens (modern humans) (~300,000 years ago to present)
Oldowan industry - simple flaked stone tools (~2.9-1.7 million years ago)
Acheulean industry - advanced tools like hand axes (~1.7 million - ~160,000 years ago)
Archaic humans in Southeast Asian islands like Indonesia (~1.8-1 million years ago, dating is a bit uncertain on this one)
First control of fire (~1 million - ~700,000 years ago)
First archaic humans living in colder climates like Atapuerca, Spain (~800,000 years ago)
First wooden spears denoting a change in hunting tech (~400,000 years ago)
Widespread control of fire (~400,000 years ago)
==> First homo sapiens <== (~300,000 years ago)
First neanderthals arrive in Europe (~230,000-150,000 years ago)
First use of ochre pigment for symbolic purposes (~190,000 years ago)
Body lice genetically diverge from head lice due to clothing (~170,000 years ago)
Mousterian industry - points, scrapers, denticulates, notches, and awls (~300,000-40,000 years ago)
First time eating seafood at Pinnacle Point (~150,000 years ago)
Humans start collecting and using shell beads (~130,000 years ago)
First heat treated material - silcrete (~110,000 years ago)
First compound adhesive leads to tar-hafted tools (~100,000 years ago)
First bed (~77,000 years ago)
First bow and arrow in Sibudu (~72,000–60,000 years ago)
Arrival in Australia (and thus first boat?) (~70,000-65,000 years ago)
First musical instrument (flute) (~60,000 years ago)
First burial ritual at Shanidar Cave (~60,000 years ago but controversial)
First sewing needle (~45,000 years ago)
Aurignacian industry - true homo sapien tools like microlithics, blades, projectile points, pressure flaking, split-base bone points (~43,000-26,000 years ago)
Gravettian industry - Bow and arrow, harpoons, and darts come into their own (~33,000-22,000 years ago)
Solutrean & Magdalenian industry - flint tools, cave art, etc. (~22,000-12,000 years ago)