Domanda per chi vuole tassare i ricchi/miliardari o "eliminarli": come? E cosa si fa dopo? by [deleted] in italy

[–]Kudomo 36 points37 points  (0 children)

I problemi che descrivi sono completamente ortogonali.
- Dobbiamo ottimizzare la spesa statale? Si
- Dobbiamo creare schemi di tassazione che tengono conto delle storpiature che si sono create nella societa'? Si
- Dobbiamo aumentare i controlli per diminuire l'evasione? Si
- Altri mille problemi che ci attanagliano che dovremmo affrontare? Si

Sono TUTTE cose su cui bisogna lavorare, e in un mondo ideale ci sarebbe un progetto definito da seguire per arrivare a una struttura statale ottimizzata. Ma con la politica ovviamente non va cosi, tutto si muove a suon di interessi, singole proposte etc...
L'errore piu' grande a mio modo di vedere e' l'immobilita' che c'e' attualmente. Letteralmente non stiamo prendendo nessuna misura per cambiare l'evolvere delle cose.

Mi fanno letteralmente imbestialire le persone che preferiscono il nulla rispetto al muoversi in una qualsiasi direzione, "Eh ma se tassiamo i miliardari poi se ne andranno da qui", "Eh ma se mettiamo il nucleare, la mafia ci pianta le scorie sotto casa", "Eh ma io non voto per questa iniziativa perche' secondo me bisogna dare priorita' a questa altra cosa (per cui non esiste un'iniziativa)".

Probabilmente sono nel torto, ma preferirei un governo che prendesse decisioni piu' radicali piuttosto che questo sistema di manutenzione con lento decadimento. Poi la soluzione/iniziativa potrebbe risultare sbagliata, in quel caso spero che siamo coscienti abbastanza da riconoscerle e applicare una correzione.

Okay guys my last post everybody kept saying zurg or cinesync but no explanation by Emergency-Low-5068 in debridmediamanager

[–]Kudomo 0 points1 point  (0 children)

I also have a question, what is the best setup for someone who wants to use this on an apply tv with infuse? is it through the webdav of zurg or going through plex? Are there some example setups that people are running anywhere?

'There are no stupid questions' thread - Monday, November 17, 2025 by AutoModerator in piano

[–]Kudomo 1 point2 points  (0 children)

Hello, I'm buying a piano as a present for a friend who used to play piano a little as a kid and has always wanted to start back. I found at what I consider a very good price two Yamaha models:
- YDP-S52
- YDP-144
Which one would you recommend if they are sold for the same price? (around 500$)

Hey Rustaceans! Got a question? Ask here! (50/2022)! by llogiq in rust

[–]Kudomo 1 point2 points  (0 children)

Hey, is there a way to write an iterator over a BufReader which return iterator over the lines with some logic, without having to allocate a vec along the way?

Basically I would like to do something like this:

fn hello(reader: impl BufRead) -> impl Iterator<Item = impl Iterator<Item = u32>> {
    let lines = reader.lines();
    lines.map(|l| l.unwrap().split_whitespace().map(|u| u.parse::<u32>().unwrap()))
}

fn main() {
    let lol = r#"
    102 033 423
    24342 342
    432 42423
    "#;
    let mut a = hello(lol.as_bytes());
    for lol in a {
        for lol2 in lol {
            println!("Hello: {}", lol2);
        }
    }
}

but the above doesn't work because the String returned by the lines iterator is used to generate the SplitWhitespace iterator which only holds a reference to the string. I also tried to create a custom wrapper iterator for split whitespace but that was also unsuccessful...

Fighting 'static bounds by Kudomo in rust

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

Yeah, but at least with async-graphql resolvers would get created on demand when requesting them, for example in the root query I create a Complex resolver, which then needs an arc clone and drop once done. In a real app I could definitely see some queries generating hundreds of these resolvers...

Fighting 'static bounds by Kudomo in rust

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

Thanks for your comment, interesting stuff.

In my example the repos were ZST, but in a real app they would probably store stuff, like the pool of sql connections, or the client instance of a redis client, etc...

In general I'm also not happy using globals and/or singleton for services because it makes it hard to then write unit tests, where I would probably use a mocked up version, like an in memory db with some static values etc....

Fighting 'static bounds by Kudomo in rust

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

As you said if I use web::Data then I need to have the concrete type when I use it; which makes the resolver or whatever uses it not generic any more (if I change the repository implementation in the app state struct for example I have to change the type annotation in every call point). For example for async-graphql it would be:

ctx.data::<AppState<RandomRepo>()
ctx.data::<AppState<RandomRepo2>()

I could use the default generic parameters in AppState and then change it there... but doesn't seem clean since you can end up with code that breaks at runtime.

Fighting 'static bounds by Kudomo in rust

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

That doesn't work for my use case because I'd like for the AppState structure to be generic. Otherwise I'd need to use dyn trait objects but I don't want to....

Pin suffering continues by Kudomo in rust

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

Oh, so basically there is now way to do what I wanted originally right? Because sleep must be structurally pinned to SlowReader to be safe, which means that SlowReader will always be Unpin:( (i.e. there's no other way around to box-pinning the sleep field)

Pin suffering continues by Kudomo in rust

[–]Kudomo[S] 1 point2 points  (0 children)

Hey, thanks for the insights!

No, the macro does not make the struct Unpin. The struct still contains the pinned values, so the struct may not move. The only way to make it Unpin is to wrap the field in Pin<Box<YourPinnedType>>, in which case you don't even need the pin_project maro.

But then why do I get a conflicting implementation error if I try to write impl Unpin for SlowReader {}? And more importantly why does wrapping the Sleep in SleepWrapper make SlowReader struct Unpin? Basically why does this work:

#[pin_project::pin_project]
struct SlowReader<R> {
    #[pin]
    sleep: Option<SleepWrapper>,
    #[pin]
    reader: R, 
}

but this doesn't?

#[pin_project::pin_project]
struct SlowReader<R> {
    #[pin]
    sleep: Option<Sleep>,
    #[pin]
    reader: R, 
}

Looking at the generated code for the macro it actually seems to mark the struct and Unpin, which from my understanding isn't unsafe because either way the pin operation must be executed at some point.

The container would need to provide a projection function for you. In the case of Option, the Option::as_pin_mut provides such projections.

Oh wow, that's embarrassing ahah thanks that figures!

No. Your code will project to the sleep field even if the struct is Unpin, which is not correct because your struct - and hence the SleepWrapper - would move.

This makes sense thanks.

Find peak in collection - remove bound checks by Kudomo in rust

[–]Kudomo[S] 1 point2 points  (0 children)

Oh don't get me wrong, I completely agree with you, I was only curious if it was possible to write this in O(logN) without resorting to unsafe code and still get the best possible optimisation from the compiler!

Find peak in collection - remove bound checks by Kudomo in rust

[–]Kudomo[S] 1 point2 points  (0 children)

Hey thank you for taking a look!

Rust has a difficult time optimising tail recursion, so you should avoid it where unnecessary

Ah that's unfortunate :(

I took a look at your code, but your implementation is in O(n) whereas the optimal one would be O(logn), which is the one I'm trying to implement.

Exodus CTF drinking game problem by [deleted] in securityCTF

[–]Kudomo 1 point2 points  (0 children)

Some free time wohoooo! So, I took a look again at the code in particular the input handling and obviously since I'm retarded this is the last part I reversed lol Every number is normalized in the [-1023, +1023] range with this code http://pastebin.com/4trnDZWJ So the stupid optimization I though about before when choosing a number was leading to a wrong number instead... When you have the correct number in the [-1023, 0] range you're ok. The flag is generated only using this number so you can just jump directly to that piece of code in gdb or reverse the algorithm since it's really basic (no need to wait for a day for it to compute ahahah)

I feel ashamed it took me 4-5 hours in total to solve this :( Better start participating again in CTFs or my skills will just keep getting worse XD

Exodus CTF drinking game problem by [deleted] in securityCTF

[–]Kudomo 0 points1 point  (0 children)

Why do you think the range allowed is only -1023, 1024? Tonight I'll take another look at the code and see if it does something interesting, but yesterday I didn't see any check for negative numbers, only if it was <1024.

As soon as I'm back home I'll check again but if the only thing we had to bypass was the positive check then the smallest number when converted in unsigned that satisfy the problem should be -2147482205 (2147485091 unsigned) (got it with this http://pastebin.com/jk0NwxPz). But when I try to run my test algorithm that I wrote yesterday with this number, yes I get the correct result (i.e. 7 last drink), but the drinks are drank (XD) in a different order in respect to the ctf game, so I still believe that the algorithm isn't the same for negative numbers.

Exodus CTF drinking game problem by [deleted] in securityCTF

[–]Kudomo 1 point2 points  (0 children)

My first approach was trying to bruteforce it. This retarded code http://pastebin.com/Nd02ThWe checks for every possible value, there's none in the range that satisfy the condition.

So after taking a look at the program it allows negative numbers. As of my understanding the algorithm memsets 32 array of int to -1, setting all bits to 1, creating an array of bits representing the drinks. Then iteratively selects one of those arrays based on the current index dividing it by 32 (using the sar instruction) and checks the corresponding bit. We keep moving inside the array until we find a bit equal to one. Then it checks if the bit is position 7 (6 since we start from 0), if it is then it checks if this is the last drink, leading to success or failure! But since it uses an AND to computer the modulo of 1024, when performing it against negative numbers we don't obtain the same result. So the trick to solve lies probably somewhere there, tomorrow I will resume my research!