35
submitted 3 weeks ago* (last edited 3 weeks ago) by tinkralge@programming.dev to c/linux@programming.dev

Before I go off an write something myself, many things we open from our apps are HTTP/S URLs and they go straight to the browser. On Android, it's possible to assign apps to certain domains. I know I could write a script to do the same in linux, but my question is if there is a solution that already does this.

For those who don't know how, here's a superuser page that explains how to handle custom protocols.

This is what I use for now to open videos directly in mpv instead of a browser

~/bin/open-http.sh

#!/usr/bin/env bash
set -eu
# install with `xdg-mime default http-handler.desktop x-scheme-handler/http`
#              `xdg-mime default http-handler.desktop x-scheme-handler/https`
# is https and supported by yt-dlp
if [[ "$1" == "https://"* ]] && yt-dlp --simulate "$1" ; then
    exec mpv "$1"
else
    librewolf "$1" 
fi

http-handler.desktop

[Desktop Entry]
Comment=
Exec=~/bin/open-http.sh %u
MimeType=x-scheme-handler/https;
Name=HTTP Scheme Handler
NoDisplay=false
Path=
PrefersNonDefaultGPU=false
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=

A GUI or just config file would be great.

[-] tinkralge@programming.dev 10 points 3 months ago

Companies are already cancelling and limiting Claude subscriptions. Is this the turning point for AI?

73

Scenario: you're using opensource software and you aren't donating yet, however you have enough money left over every month to do so. Something(s) is holding you back from donating. Think about what that is and what would have to change for you to change that.

[-] tinkralge@programming.dev 4 points 6 months ago

Why? If the tracking picks it up, then it'll be up to the user whether they want to transfer money via those methods. Someone did make me think that filtering donation methods would be useful. So if there are website that use a donation method you disapprove of or do not support, you don't have to transfer money to them.

[-] tinkralge@programming.dev 4 points 6 months ago

Is the main issue really tracking and consolidating microdonations, or is it transferring credit between these donation systems and traditional finance entities like banks and credit card networks?

They are 2 main issues. As mentioned, you want to transfer the money to the right person, which means tracking (or collection, whatever term you want to assign to it). And you want to transfer in the first place. Since there are so many systems, and some that don't allow one-time donations, and people are all over the world, it definitely is a problem. That's why not doing it monthly but annually could help. But that does make me think that it should be possible for the user to filter donation methods. For example filtering out direct transfers to accounts outside of your region due to transfer costs. Thanks, I can add that.

Which regulatory compliance things would apply to this in its current form? Or do you mean that connecting to a user's bank account would incur the wrath of the authorities?

39

TL;DR detect donation options on a website, track website visits locally, show a monthly view of websites visited monthly with donation options, donate to your favorites (manually at first, automatically later - never worked in banking)

Intro

I'm sure a fair number read "monetisation" and though "that's ads". No. You've been conditioned to think that ads are the only way. They aren't. They are one of the worst.

Unfortunately, that's what many media creators, artists, writers, software developers, etc. assume. Peertube isn't a viable platform for creators because viewers have a lot of friction to give the creator money. Meanwhile, on platforms like youtube, all they have to do is view the video and everything else happens in the background.

What if we, the viewers, had an easier way to donate.

The optimal (my dream)

  • I install software and give it access to my bank account (my bank supports creating many sub accounts)
  • the software tracks the usage of the things I use, the pages I visit, the videos (and their creators) that I watch, the artists I listen to, the newspapers I read, the blogs I read, the forums I interact with, etc.
  • at the end of each month, I transfer %money to my sub account (automatic transfer)
  • the software is notified and %money is distributed, with an algorithm of my choosing, using the donation gateways of the stuff I consumed

This can all be done locally, without a server, and if need be stored per device, then aggregated via a local sync (WiFi, bluetooth, VPN, ...). Everything stays local, the bank just sees your outgoing transactions. Optimally, it would be with a private method of transferring money e.g Monero or GNU Taler.

Distribution examples

  • top X - equal split
  • weighted split (#1 - 50%, #2 - 30%, #3 20%)
  • exponential decay (halve until minimum is reached, 50%, 25%, 12.5%, ...)
  • linear decay (remove fixed amount until nothing is left, 30, 25, 20, 15, 10)
  • winner takes all (#1 get all the money)
  • weighted split + base ( base = 10, #1 +20, #2 +15, ...)

Reality

  • Tracking everything is difficult but website visits are easy with an extension
  • I've never worked with banking and have no idea how to connect to bank account (open banking?)

Tracking

These have their advantages and disadvantages, but together, they could cover most scenarios.

  • Peertube for example could add tags and provide a file on the server for information about donating to the server operator.
  • Lemmy could add tags to <head> for people who have created the thread.
  • People who use managed services but control the content can put donation links in the . These are the most at risk though as it's possible that managed service operators inject whatever they like into the traffic.

Reading the DOM

  1. find OpenGraph declarations <meta property="og:donation" content="https://wero.eu/example" />
  2. find payment provider links document.querySelector("a").filter(isPaymentProvider)

Querying the server

.well-known/donation servers should put that file there with a documented JSON format

Reading queries

Look for custom headers e.g X-Donation: https://wero.eu/example

Payments

If I'm not mistaken, GNU Taler should have an API that allows connecting to an account, but it only has a testnet. Paying with crypto probably needs a server or something where you host your wallet, but it should be possible. Open Banking, after having a quick look requires some kind of registration to be able to access the API. IMO, nobody's going to hand over details like that unless it's considered normal and we're far away from that.

Therefore, the most likely is that the user will simply be presented with the algorithms to distribute money, the amounts to distribute, and the distribution methods. My best guess is that people get a quarterly, semesterly, or annual notification with the "It's time to donate!" window and they figure it out.

Ups and downs

Advantages

  • It's completely local - nobody but you does the tracking, can analyse it, and use it
  • You decide how you want to distribute the money
  • You decide how much
  • You decide the frequency
  • You don't have to trust me with your money
    • I don't have to take a cut
    • I don't have to setup a company to handle your money
    • You don't have to trust that I transfer the money to those who have earned it
  • Operators have options:
    • Do nothing aka continue as before with existing donation options (wero, paypal, direct bank transfer, crypto, whatever)
    • Add a <meta> tag which gives power to the operator to dynamically generate it (as described before)
    • Make it work with static pages using .well-known/donations

Disadvantages

  • Users currently will have to make the transfers themselves
  • Transfers reveal who you're donating to to banks (no third-party intermediary)
  • Changes will be required by server operators or software developers
  • No security review done yet
    • Other extensions messing with <meta> tags
    • Other extensions messing with web traffic to insert HTTP headers
    • Server operators modifying HTTP headers and web content of their customers to replace donation targets
    • Malicious server operators tracking users that call .well-known/donations
    • Whatever else people come up with

I'm curious about constructive criticism, improvement suggestions, or maybe even links to dispell some of my beliefs about Open Banking.

Previous inspiration

flattr was a micro transaction platform that supposedly did something like this, but it never gained steam. They acted as the tracker and distributor, but it required that server operators also register with flattr.

[-] tinkralge@programming.dev 1 points 1 year ago

Thanks for reporting. I hope it'll get resolved!

[-] tinkralge@programming.dev 1 points 1 year ago

Man... that's unfortunate. Thanks for the link!

12
submitted 1 year ago* (last edited 1 year ago) by tinkralge@programming.dev to c/librewolf@lemmy.ml

I keep getting this error in element

MatrixError: [403] You do not belong to any of the required rooms/spaces to join this room. (https://matrix.org/_matrix/client/v3/join/%23librewolf%3Amatrix.org?server_name=matrix.org&via=matrix.org)

Anybody else?

[-] tinkralge@programming.dev 2 points 2 years ago

It's quite simple: I want to retrieveFile(fileHash) where fileHash is the output of md5sum $file or sha256sum $file, or whatever other hashing algorithm exists.

[-] tinkralge@programming.dev 4 points 2 years ago

Sure, why not. I'm not the creator of the room 🙂

[-] tinkralge@programming.dev 2 points 2 years ago

I know that @Ategon@programming.dev is there. Maybe he can make you a mod there too? And the channel could be added to the sidebar of this community too.

107
[-] tinkralge@programming.dev 4 points 2 years ago

This week some more work was done on inheriteRS to support inheriting non-trait implementations of functions.

Basically

use inheriters::specialisations;

specialisations!(
    struct Parent {
        attr1: u8,
    }
    impl Parent {
        fn from_parent(self) -> u8 { 8 }
        fn overridden(self) -> u8 { self.attr1 }
    }
    
    #[inherit(Child)]
    struct Child {
        attr2: u8,
    }
    impl Child {
        fn overridden(self) -> u8 { self.attr2 }
    }
);

results in

struct Parent {
    attr1: u8,
}
impl Parent {
    fn from_parent(self) -> u8 { 8 }
    fn overridden(self) -> u8 { self.attr1 }
}


struct Child {
    attr1: u8, // new
    attr2: u8,
}
impl Child {
    fn from_parent(self) -> u8 { 8 } // new
    fn overridden(self) -> u8 { self.attr2 }
}

There might be some clean-up necessary code-wise and the README has to be expanded. But the project is well on its way to version 1! It's a pity codeberg doesn't have easy CI/CD yet nor domain hosting e.g inheriters.codeberg.io or something. So auto-formatting, testing, auto-tagging, etc. will have to come once I can convince myself to setup a VPS somewhere that hosts all that.

[-] tinkralge@programming.dev 2 points 2 years ago

That sounds like fun! Wow. How stable is it at the moment?

[-] tinkralge@programming.dev 3 points 2 years ago

Working on some form of inheritance in rust. It's my first foray into procedural macros and so far it's fun. The idea is quite simple: generate structs with common attributes (and eventually functions) instead writing them yourself.

use inheriters::specialisations;

specialisations!(
    struct Parent {
        attr1: u8,
    }
    #[inherit(Child)]
    struct Child {
        attr2: u8,
    }
);

becomes

struct Parent {
    attr1: u8,
}
struct Child {
    attr1: u8,
    attr2: u8,
}

not

struct Parent {
    attr1: u8,
}
struct Child {
    attr1: u8,
    parent: Parent,
}

The latter leads to indirection which I'm not a fan of.

Last week I squashed one bug on the order of attributes according to inheritance. In the example above attr2 was coming before attr1. A feature is nearly done to exclude the Parent from the output and only output the child. That's useful for parents that just serve as holders for shared attributes.

The goal for v1 was to also support basic inheritance of implementations: Parent has an impl block, then that block is copied for the Child. Not sure yet if I'll implement overrides in v1 or v2. Overrides being if Parent implements do_something() and Child does too, then the implementation of Parent is not copied into the impl block.
That's what I'll try to tackle in the coming weeks.

[-] tinkralge@programming.dev 3 points 2 years ago

Jottacloud is what I want to use. Unlimited storage for ~100€/month

Close behind is 1fichier for 2€/TB/month or 12€/TB/year, but they are in France and "uptobox" (a similar provider) was shutdown by the US on French soil because they allowed providing links to the files.

You can probably find others in the list of storage systems supported by rclone

23

TL;DR No archive format like tar, zip, ... but how would you theoretically represent a symlink in a manner that can be stored on the cloud and retrieved back to the system as a symlink?

Backstory

I heavily use symlinks to organise my media and even wrote an application that helps me do so (it's in Python and being rewritten in Rust). But I also use stuff like home-manager and nix which makes heavy use of symlinks.

My goal is to back up my media and /home to the cloud at regular intervals. There are services that cost just about 60-100€ yearly for limitless storage in the cloud. So having part of my library purely in the cloud and using terrabytes of space would cost less than a single 15TB HDD (500+€). To have a local backup, I'd even need a least a second one, which would put me at >1000€ - the equivalent of at least 10 years of cloud storage.

Options explored

rclone

It is pretty sweet as it supports mounting a cloud drive as a folder and has transparent encryption! However there are multiple open issues on uploading symlinks and I don't know Go. I wouldn't mind trying to learn it if I had an idea how to upload a symlink without following it (following symlinks breaks them).

git-annex etc.

git-annex and using a bare git repo with a remote worktree is great, but I don't need to make diffs of stuff and follow how things moved around, etc. I just need to replace backups with a view of what's there. Plus, storing all that history will probably take enormous amounts of space which is wasteful.

Ideas

store a blob of stat() call for every file

I'm not sure about this. The stat struct does contain information about the filetype (directory, hard link, symlink, ...), but my knowledge of linux internals is limited and maybe that's too complicated for this usecase.

a db of links

Instead of storing the links themselves, I store a DB (sqlite? CSV?) of links, upload that DB and use the DB to restore links after pull it back down. 🤔 Actually this might be the simplest thing to do, but maybe y'all have better ideas.

1

I wrote a simple algorithm for predictive text that uses preceding words as context. Without looking at prior, it was an attempt as seeing what I could come up with.

The goal is for it to be incorporated in chorded input and pick the best candidate for the entered chord with the given context. Chorded input is the method of hitting all keys for a word simultaneously instead of hitting each key individually in expected order.

E.g you've typed "this is the worst" and hit the chord "aet", which word should be chosen? ate? tea? eta? This algorithm is there to answer that.

What I'm looking for in the code review in order of importance:

  • documentation (is it understandable? are there things missing? ...)
  • code architecture, code structure (function should be a member? composition could be changed? clarity, ...)
  • algorithm review (optimisations, improvements)
  • variable and class names (naming things is hard)
  • rust specific stuff (f64 instead of u32 maybe? dyn vs impl? ...)

The code is linted and automatically formatted.

view more: next ›

tinkralge

0 post score
0 comment score
joined 2 years ago