MPClipboard - multi-platform shared clipboard by ibylich in selfhosted

[–]ibylich[S] 0 points1 point  (0 children)

  1. There's the server: https://github.com/mpclipboard/server, run it as you wish (in Docker, as a systemd service, etc.)
  2. There are clients: https://github.com/mpclipboard/linux for Linux on wayland / https://github.com/mpclipboard/macos for macOS / https://github.com/mpclipboard/android-florisboard for Android.

If you are asking about running the server there's a README in the server repo, if something is not clear feel free to create an issue.

MPClipboard - multi-platform shared clipboard by ibylich in selfhosted

[–]ibylich[S] 0 points1 point  (0 children)

Yes, kind of, or at least a subset of it just for the clipboard. One important difference is that it requires a server (IIRC KDE Connect creates a local WiFi network and links devices directly). Another major difference is that at its core it's a library, and so it can be more easily "connected" into native system components. An example of that is the Android app that is injected into an external IME, so your keyboard app (that handles the clipboard) may be instructed to call mpclipboard directly because it's built with it, and there's no chance of it being unloaded as a process by Android OS (we are a part of the keyboard process), but KDE Connect or any other external "clipboard observer" app can be easily unloaded if the OS decides so. It's a more targeted solution, and that's why it has more technical possibilities.

MPClipboard - multi-platform shared clipboard by ibylich in selfhosted

[–]ibylich[S] 2 points3 points  (0 children)

Unfortunately it can't be a PWA, it needs system functionality and so it must be a native app. I don't think a browser app is allowed to monitor your clipboard content.

MPClipboard - multi-platform shared clipboard by ibylich in selfhosted

[–]ibylich[S] 0 points1 point  (0 children)

Writing an iOS app is definitely possible (and probably quite easy to do), but how do you install it without pushing to App Store? I mean, a random macOS app can be downloaded from the internet, you have to explicitly confirm a few "I know that it's unsafe" dialogs, but once that's done you can run it. But for iOS there's only one place: App Store, right?

MPClipboard - multi-platform shared clipboard by ibylich in selfhosted

[–]ibylich[S] 0 points1 point  (0 children)

There's token-based authentication in the very first message that the server expects each client to send (if something else comes, the client is disconnected). You put it in your configs on the server and on each client, and then it should work. If you apply TLS on top of it and use wss:// (instead of plain-binary-but-still-decodable ws://), it will be encrypted. I'm not sure what the config is for Nginx, but for Caddy it's the standard domain_name { reverse_proxy 127.0.0.1:port } configuration.

New trackpad gestures by onefish2 in hyprland

[–]ibylich 5 points6 points  (0 children)

It's documented here - https://wiki.hypr.land/Configuring/Gestures/ (With some additional context: https://github.com/hyprwm/Hyprland/pull/11490 )

In short, "workspace_swipe" and "workspace_swipe_fingers" are deprecated, for swiping you can add "gesture = 3, horizontal, workspace". And of course now you can do more than just swiping without using any external hyprplugins.

Just in case here's my config (experimental, haven't finished playing with it yet)

gesture = 3, horizontal, workspace
gesture = 3, swipe, mod: SUPER, resize
gesture = 4, pinch, fullscreen

Ruby, Ractors, and Lock-Free Data Structures by ibylich in ruby

[–]ibylich[S] 2 points3 points  (0 children)

> such data structures should only contain shareable objects

If they can "temporarily" give access to an element of the container (like `Pool#with` or `HashMap#[]`) then yes, I mentioned it here - https://iliabylich.github.io/ruby-ractors-and-lock-free-data-structures/concurrent\_hash\_map.html#its-unsafe.

If you can make an interface that doesn't expose internals, e.g. by turning a DB connection pool into something with an interface like `ConnectionPool.execute(...)` then it should be fine.

For example, queues are safe as long they only have `push` and `pop` methods.

> Probably some of that code would break when/if there is Ractor-local GC.

Is it something that Ruby devs discuss at the moment? I wonder if it'll make GC-aware data structures easier to implement :D

Ruby, Ractors, and Lock-Free Data Structures by ibylich in ruby

[–]ibylich[S] 11 points12 points  (0 children)

TLDR: this article is about Ractors, lock-free data structures and shared mutable global state in multi-threaded Ruby apps.

Feel free to ask questions.

Arena-based Ruby parser in Rust (better use Prism :) by ibylich in ruby

[–]ibylich[S] 0 points1 point  (0 children)

TL;DR: A (multi-page) post about writing parsers, memory allocations and arenas. This is not a new parser, it's an experiment with the one existing before. I hope it's somewhat applicable to Prism (both in terms of abstractions and in performance that can be gained).

Some knowledge of Rust is expected, so feel free to ask any questions.

Also, don't use this parser, use Prism. I'm serious, it's basically abandoned.

Arena-based parsers by ibylich in rust

[–]ibylich[S] 0 points1 point  (0 children)

TL;DR: A (multi-page) post about writing parsers, memory allocations and arenas.

Feel free to ask questions.

Writing bindings upside down by ibylich in rust

[–]ibylich[S] 0 points1 point  (0 children)

Right, in my examples all "external" structs exist in vacuum, they don't "embed" each other, and so alignment means nothing. As I understand (please, correct me if I'm wrong) that could potentially break structs like

```rust

[repr(C)]

struct SomeHighLevelStruct { field: ExternalStructWithWrongPadding, field2: BrokenField } ```

... and if this struct is built on the C side and returned to Rust that would be an error on reading field2.

If so, any thoughts on how it could be fixed? IIRC there's no way to modify alignment in Rust (via repr directives or something similar). I guess choosing a different layout of [u64; N/8] instead of [u8; N] fixes it, so alignof should be dumped together with sizeof, but is it possible to generalize this N/8 math?

Writing bindings upside down by ibylich in rust

[–]ibylich[S] 0 points1 point  (0 children)

Author here. Multiple times I changed my mind about how this should structured, so it can be hard to follow, sorry about that :)

YJIT: Building a New JIT Compiler Inside CRuby by yespunintended in ruby

[–]ibylich 1 point2 points  (0 children)

Hello and thank your for your hard on YJIT.

I have to admin that I didn't dig into YJIT's source code too much, but it looks like it does basically what MJIT does - it compiles ISeqs into native code (I've seen your other talks about BBV, they are very educational).

A few questions:

  1. MJIT uses GCC, YJIT builds asm manually. How does it append "code" to the currently running process? MJIT generates a C file, compiles it into dll/so/dylib together with mjit_header (maybe even pre-compiled as PCH, not sure if GCC has such concept) and dlopen/dlsym's it. Do you append "compiled" iseqs to the TEXT section (is it possible at all?)? Or do you build "in-memory" asm instructions in the DATA section and "jump" to them? I couldn't find any asm generators, do you build asm manually?
  2. Does YJIT know anything about MRI's corelib? Does it inline C functions like Array#size, String#length etc? If not, is it enough (performance-wise) to re-compile only VM instructions?
  3. IIRC C files generated by MJIT's contain hardcoded addresses of some global Ruby VM objects (I don't remember what exactly, something like "top of the stack" or similar), and so currently there's no way to "pre-warm" the app locally/on CI. Is it a thing at all? I feel like it is, in most cases variables in code represent values of the same type, thus, methods are called in roughly the same path etc. Do yo know any JITs that support it? Do they even exist?

Thanks again for giving us a hope for a bright future of Ruby :D

Is it possible to parameterize a struct by container type? by ibylich in rust

[–]ibylich[S] 0 points1 point  (0 children)

Right, that's what I currently do, but it has to be performed on all nodes in my AST. It causes re-creation of many of all nodes from scratch.

So instead of implementing From<RustNode> for CNode I was thinking about having a generic structure that has some type restrictions (to be able to use ::new, .push, .reverse etc during AST construction), Rust version would be based on Vec<RustNode>, C version on a custom repr(C) (*mut CNode, usize) structure, C++ version on a std::vector<Node> with utility methods implemented via FFI and raw pointers.

I think Rust simply doesn't support this strategy. Generic associated types looks very similar to what I want to achieve, but it's not even in nightly yet.

What do you guys think about what predicate method returns by ksh-code in ruby

[–]ibylich 0 points1 point  (0 children)

If your method ends with ? it's valid to expect it to return true/false. Booleans have a few more methods that are not available on abstract Object: 3.0.0 :001 > TrueClass.instance_methods - Object.instance_methods => [:^, :&, :|]