Vftdan Channel
25 subscribers
110 photos
2 videos
9 files
178 links
author: @vft_dan
Download Telegram
How to fix Haskell code full of errors like Couldn't match type ‘f1’ with ‘f’:

Add {-# LANGUAGE ScopedTypeVariables #-}
(and probably {-# LANGUAGE InstanceSigs #-} if the problem is with typeclass instance implementation)
and add the minimal relevant forall for every type declaration.

This should help to find the exact problem source.
xkb to xkm compilation:

In a type block inside the xkb_types section expects shift level on the left-hand-side (as an index) of map entries and on the right-hand-side of level_name entries.

Shift level is an integer. There can be up to 63 shift levels:
#define  XkbMaxShiftLevel  63

(source: /usr/include/X11/extensions/XKB.h line 560)

Shift level inside xkb file is parsed as an integer:
    if (!ExprResolveInteger(arrayNdx, &rtrn, SimpleLookup, (XPointer) lnames))
return ReportTypeBadType(type, "level name", "integer");

(source: https://gitlab.freedesktop.org/xorg/app/xkbcomp/-/blob/master/keytypes.c#L815 )

Integers will most likely (for this exact purpose) be written a value token (ExprValue) of integer type (TypeInt); (source: https://gitlab.freedesktop.org/xorg/app/xkbcomp/-/blob/master/expr.c#L599 )

or as an identifier token (ExprIdent), in this case it's numeric value is looked up with a given function in given object. (source: https://gitlab.freedesktop.org/xorg/app/xkbcomp/-/blob/master/expr.c#L628 )

In the case of shift levels it's a simple lookup (apparently, it's case-insensitive) inside a LookupEntry array named lnames. This array has entries for levels from 1 to 8, and correspond to a string "level" prepended to their decimal representation:
static LookupEntry lnames[] = {
{"level1", 1},

...
    {"level8", 8},
{NULL, 0}
};

(source: https://gitlab.freedesktop.org/xorg/app/xkbcomp/-/blob/master/keytypes.c#L638 )

Instead of a magic number (something like level_name[8] = "Shift Level3+Alt";) xkb files will most likely have identifier names (level_name[Level8] = "Shift Level3+Alt";) (probably for human-readability reasons).
But levels 9–63 don't have corresponding identifiers, so they must be written as numeric literals.



xkb from xkm decompilation:

Just printf's lines for map and level_name entries while adding "Level" to the decimal representation of the shift level numeric value:
                fprintf(file, "        level_name[Level%d]= \"%s\";\n", n + 1,
XkbAtomText(dpy, *name, XkbXKBFile));

(source: https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/blob/master/src/xkbout.c#L239 )

This creates invalid xkb files, if there are shift levels 9–63 used inside at least one of the key types of the keymap.

--------

My keymap has additional key types, one of them has 16 shift levels.
Apparently, Xorg xserver decompiles the keymap that the user has loaded inside it and recompiles it again and, at least on failures, tries to compile it again (like every second or every key press).
This floods my Xorg log with this message about failed invocation of the compiler:
(EE) Error compiling keymap (server-0) executing '"/usr/bin/xkbcomp" -w 1 "-R/usr/share/X11/xkb" -xkm "-" -em1 "The XKEYBOARD keymap compiler (xkbcomp) reports:" -emp "> " -eml "Errors from xkbcomp are not fatal to the X server" "/var/lib/xkb/server-0.xkm"'
(EE) XKB: Couldn't compile keymap
And my display manager log — with compiler error messages:
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Error: Identifier "Level9" of type int is unknown
> Error: Level specifications in a key type must be integer
> Ignoring malformed level specification
...
> Error:            Identifier "Level16" of type int is unknown
> Error: The key type level name field must be a integer
> Ignoring illegal assignment in PC_LEVEL3_ALT_CONTROL_16LEVELS
Errors from xkbcomp are not fatal to the X server
POSIX shell encourages to write pure functions, because they can be called from subshells.
2🤔1
I'm a calendar, again

Link to post
2
Vftdan Channel
Goodbye, 131-day uptime
And also goodbye 574-day phone uptime. Ran out of charge yesterday evening while working as a hotspot in a meter from me. Apparently, KDE Connect hasn't established connection to notify me that the phone was low.
😢2
Forwarded from 0xFABC0FFEEBADC0DE
My dudes, I might have solved the yesterday vs. today problem. Caution: shameless word coinage incoming!

Introducing: "yestoday" — the last day that technically already passed, but it still doesn't feel like the following day has started (e.g. one hasn't been to bed yet).

Usage example: "I'm afraid I can't complete this task yestoday."
2
Forwarded from Vft Dan 💉💉
And make the clock go from 6:00 to 29:59 every day
👍1
🔁Thomas Adam
#tmux now has #sixel support!

Great news! Thanks to a lot of hard work from topcat001 (Anindya Mukherjee), the -portable version of tmux now has SIXEL support.

Why this is this cool? Well, it means images rendered directly into the terminal can now happen, via conversion to SIXEL where appropriate.

One such use-case is with #gnuplot.

As an example of both, see the screenshots I've attached here.

To enable this, you will need to pass a flag to configure:

./configure --enable-sixel

Please do give this a go. This isn't released yet, so if you want to try this, you must do so via git.

Note that you will need a compatible terminal to make use of this -- in my case, that's #xterm and as such, all I needed to do was add the following to my ~/.Xdefaults file:

XTerm.*.decTerminalID: vt340
XTerm.*.numColorRegisters: 256

... and then run `xrdb -merge ~/.Xdefaults`

Enjoy!

Link to post
Vftdan Channel
Have an ice day
🎉2
🔁comfortably dumb
nice thing about commuting with a car

- no schedule to follow
- go from a to b directly
- nobody steals your wallet
- only one drunk insane person

Link to post
😁2
This reminded me about a thing I am thinking about sometimes.

I don't need the exactly whole car (well, in theory. I don't drive or own any, so when I actually need one, I use taxi). I need just a personal human shipping container with a configurable HVAC, a couch, and enough luggage space, that I only enter at home, lock from inside, and only exit at the destination. I don't need it to have an engine and wheels, unless going to a wilderness. Being carried more fuel- and climate-effeciently by some kind of public trains/vans and beeing moved between them on exchanges with gantry cranes or something sounds actually nicer.

Link to post
👍1
Smart cards have a pretty big area. It should be possible to fit at least several hundred gigs on them.

Link to post
Do I understand correctly, that with AES and other block ciphers if the plaintext has repeating 16-byte-aligned-and-long regions, they will correspond to repeating ciphertext regions?

#cryptography

Link to post
🔁patter
@yassie_j can't quite find the meme I'm looking for, it's a better version of this

Link to post
😁2
🔁chjara
"well we're getting further along, we're getting different errors" debugging

Link to post
Is daisy-chaining of itertools.tees a good idea :blobcatthink:

#Python

Link to post
🔁Anton Chigurh :ve:
@ktemkin or die like a hero or live enough to become a service

Link to post
👏1
🔁transcaffeine
OH: "If it walks like a duck and quacks like a duck, group theory says it's isomorphic to a duck!"

Link to post
2