rustmas: Advent of Code entirely from the terminal, inputs to stars
▲ 21 r/rust

rustmas: Advent of Code entirely from the terminal, inputs to stars

Got super tired of going to the browser to grab inputs and paste answers, so I built a tool that does the whole loop from the CLI. You give it your session cookie once, in a .env:

cargo run fetch -y 2015 -d 1 # pull a puzzle into cache/

cargo run solve -y 2015 -d 1 # run your solution

cargo run solve -y 2015 -d 1 --validate # check against a third party solver

cargo run solve -y 2015 -d 1 --submit # check, then submit for the star

Year and day are filters, so omitting means all of them. Things it does that took real thought:

Solve fetches whatever is missing, so fetch is optional. A fully cached run works offline.

--submit only sends answers the independent solver agreed with first, because wrong answers to AOC cost an escalating cooldown as you continually submit. Checks with the solver are free (thanks fornwall). Submissions aren't.

When part one gets a star, it pulls part two's text in the same run instead of leaving it for next time.

Inputs are cached with a hash of the session that fetched them. Inputs are account specific, so if you swap accounts the tool notices and refetches rather than letting you submit an answer computed from the old account's input.

Puzzle text is cached per part as markdown.

Worth being clear about the approach: this isn't a binary you install and are done with. It's a repo you live in. You clone it, and the tool handles the fetching, checking, and submitting, but the solutions are yours to write, day by day, inside it. Solving a new day means copying the template, writing your parts, and adding one registry line, so the project grows as your event does. No solutions ship with main; mine are on a separate branch if you'd like examples.

Credit where owed:

On AI usage:

I use it as a working partner, and some code in this repo is generated. The hill that I stand on is understanding before allowing AI to iterate since generation without understanding of what you're asking for usually results in a black box that likely doesn't exactly do what was intended (this to me constitutes slop). I write the code I want to write, which is most of it, and hand off what I could write in my sleep: doc comment wording, README instructions, test scaffolding, and refactors I've already designed but don't want to push through by hand, like restructuring files and rewiring every import. It's also a brainstorming partner, where I'll ask for variations on an idea and then write my own from what I learned. Everything generated went through my eyeballs line by line, and the design decisions are recorded in context/design/, including the ones that got reversed and why.

https://github.com/scadoshi/rustmas

u/scadoshi — 17 hours ago
▲ 10 r/csharp

Hot path overflow checks: do you try/catch? And which style would you write?

Writing checked int helpers for code that runs millions of times per program run. Two questions.

  1. Do you actually use checked() with a try catch for this? Throwing walks the stack, so I widen to long, bounds check, and return null instead (both versions in the image).

What surprises me is that everything the BCL offers here throws: checked(), int.CreateChecked, all of it. The Try convention is everywhere else in the BCL (TryParse, TryGetValue) but arithmetic never got one, and coming from Rust where checked_add just hands you an Option, that's wild to me.

  1. Style. The image shows the same method twice: one pattern-matching expression against a plain if/else. Which would you rather find in a codebase?

I'm coming from Rust so I'm obviously a declarative fanboy when I can be, but "and var sum" might be too clever for the next reader.

Where do C# people stand on these?

If the repo interests you: it's a CLI tool for Advent of Code, so you can do the whole thing from the terminal with just your session cookie, no clicking through the site to submit answers. https://github.com/scadoshi/sharpmas

u/scadoshi — 18 hours ago
▲ 124 r/rustjerk

Finally, a crate for the working class 🇺🇸

Tired of NaN gatekeeping you out of .max()? Tired of the elite establishment (Rust std) telling you Ord is a requirement to find the biggest number? Not anymore.

Introducing WalmartMaxxing™, peak API design. .walmart_max() / .walmart_min(), works on anything with PartialOrd, because if it can be compared, it can be compared, and the constitution guarantees your right to fold() over it in O(n) unoptimized freedom.

No Ord. No NaN propaganda. No total order. Just vibes and PartialOrd.

Rollback pricing on borrow checker requirements. Always low, always safe™ (narrator: it was not always safe).

u/scadoshi — 1 month ago
▲ 3 r/testimonials+1 crossposts

Reliable closed testing service, 12 testers, Play Store production access on first try ($25)

I used u/teekamsuthar's closed testing service to get my app, Zwipe, through Google's 14-day closed testing requirement, and it delivered exactly what it promised.

$25 got me 12 real testers who stayed active for the full two weeks, no drop-off, no resets. I got a detailed QA feedback report partway through so I could push a meaningful update, and tailored answers for the Production Access application itself when testing wrapped. The app got approved on the first submission.

Communication was responsive throughout and everything was handled on their end. If you're stuck on the tester requirement and don't want to chase people down daily, this is a solid, reliable way to get through it.

reddit.com
u/scadoshi — 1 month ago
▲ 131 r/rustjerk

got perma'd from a C sub, need cope from church of ferris

hello fellow borrowers in christ. got permabanned from r/C_Programming today for going through their weekly showcase thread and informing every poster that their code was objectively dangerous, definitionally UB, and probably leaking memory somewhere even if they couldn't see it. guy posted a bubble sort, i told him his pointer arithmetic was a ticking time bomb. mods didn't love that.

so what did you do today in the name of ferris. confess below, ferris is watching and ferris is pleased

reddit.com
u/scadoshi — 1 month ago
▲ 3 r/EDH

Day 344 of building Zwipe (Tinder for Magic cards): a user told me the suggestions were repetitive, so today I rebuilt how it serves cards

Day 344 of building Zwipe, a swipe-based Magic deck builder (basically Tinder for Magic cards).

A few days ago someone messaged me on here with a fair complaint: the card suggestions always came up in the same order. Same sequence for every deck, same for every player, whether you were starting fresh or not. He was right, and it bugged me too.

So today I rebuilt how Zwipe decides what card to show you next.

Here is what changed:

The stack now deals in hands. Cards get ranked for your commander, then served twenty at a time in a shuffled order that is unique to each deck. Build two decks with the same commander and they open with different cards, and the deal changes each day, so coming back tomorrow feels fresh instead of memorized.

The rankings move with the community now. Every swipe is a vote: cards people actually add climb the stack over time, cards everyone skips sink, maybes count as half an add, and cutting a card from your deck takes its vote back. A card can never jump its tier though, the best twenty always come before the next twenty, just in a different order for each deck.

Your controls are untouched. Sorts, filters, and the synergy toggle all work exactly like before. This only shapes the default order.

The part I am most excited about: it gets sharper the more everyone builds. Every swipe teaches the stack what actually belongs with a given commander, so the suggestions you see next month are built from the swipes the community makes today. It is the one thing a tool that just scrapes existing decklists can never do.

Still completely free. No ads, no subscriptions.

This one came straight from a player's DM, so if you try it and something feels off, tell me. Feedback decides what I build next.

zwipe.net

reddit.com
u/scadoshi — 2 months ago
▲ 242 r/rustjerk

Can someone report? This should not compile

I knew I should have just learned C

u/scadoshi — 2 months ago
▲ 880 r/mtg

I made "Tinder for Magic cards" swipe to build your Commander deck. Free, no ads. Would love feedback

u/scadoshi — 2 months ago

Rust habits you grew out of? Drop the beginner pattern and what you do now

Trying to start a thread on the little novice habits we all picked up early in Rust and what the cleaner version looks like once it clicks. Not talking about huge architecture stuff, just the small everyday patterns that quietly get better as you go.

I'll throw out a couple to get it going:

1. Cloning to dodge the borrow checker → just borrow

Reaching for .clone() the second the borrow checker complains:

fn process(data: Vec<u8>) -> usize {
    data.len()
}

let data = vec![1, 2, 3];
let len = process(data.clone()); // clone so we can still use data after
println!("still have {} bytes", data.len());

Take a slice instead and the clone disappears:

fn process(data: &[u8]) -> usize {
    data.len()
}

let data = vec![1, 2, 3];
let len = process(&data);
println!("still have {} bytes", data.len());

2. Rigid param types → flexible impl Into<String>

Taking String forces the caller to allocate up front, and taking &str just pushes the .to_string() inside so you allocate even when they already handed you an owned String:

struct User {
    name: String,
}

impl User {
    fn new(name: String) -> Self {
        User { name }
    }
}

User::new("scadoshi".to_string()); // caller has to build the String themselves

impl Into<String> lets them pass whichever they've got, and only allocates when it actually has to:

impl User {
    fn new(name: impl Into<String>) -> Self {
        User { name: name.into() }
    }
}

User::new("scadoshi");               // &str works
User::new(String::from("scadoshi")); // owned String moves straight in, no extra copy

What are yours?

reddit.com
u/scadoshi — 2 months ago

A year deep into Rust. Is my project list what you'd expect or am I missing something?

Interested in taking a read on whether my projects cover what you'd expect from someone going deep on systems/backend Rust, or if there's an obvious gap.

- Zwipe: full-stack mobile MTG deck builder. One Dioxus codebase for iOS + Android, Axum + Postgres, 110k+ cards, 416 tests, zero unwrap in prod. Live at zwipe.net.

- Diprotodon: Redis-compatible server with hand-rolled RESP parsing.

- Nighthawk: hand-written LSM-tree KV store. WAL, SSTables, bloom filters, compaction.

- Migration tools: production CLIs, multi-week manual migrations down to one command. Retry logic, file-locked caches, cross-platform release binaries.

- Everything else is on a portfolio site built in Rust: https://scottyfermo.com

On AI, since it always comes up: I always understand the architecture and strategy before I have it build anything, otherwise I'm not really gaining from it. A lot of my research is AI-driven too, bouncing between AI, articles, and googling, which usually ends up being a few threads then Google's AI summary haha. Once I've got something in mind I'll have an AI plan it out, I critique the plan, then have it build. For the side quests where learning is the point, I write everything by hand until it turns menial, then describe the repetition to an AI in detail. Dipro and Nighthawk are mine where it counts.

Does this read coherent or scattered? And what's the one project you'd want to see that isn't there yet? Honesty is welcome

reddit.com
u/scadoshi — 2 months ago

Day 333 of building Zwipe, my swipe-to-build Magic deck app: just shipped a chunky update

Been heads-down ~11 months on Zwipe, a mobile MTG deck builder where you build by swiping: right to add, left to skip, up to stash on the maybeboard. Pushed 1.1.0 today and figured I'd share what's new:

> Zwipe-select — swipe through legal commanders / partners / backgrounds / signature spells to fill your command zone instead of hunting for them in search

> Deck tags — label your decks by archetype (Aggro, Tokens, Reanimator… ~65 to pick from) with a quick searchable picker

> Keyword helper — tap any keyword on a card for a plain-language reminder of what it does. handy if you're newer or just blanking on Ward vs Hexproof again

> Expanded card view — tap a card in your deck for its full rules text (rendered with real mana symbols), cost, P/T or loyalty, and rarity

Still totally free. No ads, no subscriptions. iOS is live, Android's in beta.

zwipe.net if you want to check it out. happy to answer anything in the comments.

u/scadoshi — 2 months ago

have to learn C# for my job. when do you think they're going to find out 👀

namespace CSharpAoc.Common;

public abstract record Result
{
    public sealed record Ok(TValue Value) : Result;

    public sealed record Err(TError Error) : Result;

    public TValue Unwrap()
    {
        return this switch
        {
            Ok ok => ok.Value,
            Err err => throw new InvalidOperationException(
                $"Cannot Unwrap an Err. TError: {err.Error}"
            ),
            _ => throw new InvalidOperationException("Unknown Result state"),
        };
    }

    public TError UnwrapErr()
    {
        return this switch
        {
            Ok ok => throw new InvalidOperationException(
                $"Cannot UnwrapErr an Ok. TValue: {ok.Value}"
            ),
            Err err => err.Error,
            _ => throw new InvalidOperationException("Unknown Result state"),
        };
    }

    public bool IsOk() => this is Ok;

    public bool IsErr() => this is Err;

    public Result AndThen(Func> func)
    {
        return this switch
        {
            Ok ok => func(ok.Value),
            Err err => new Result.Err(err.Error),
            _ => throw new InvalidOperationException("Unknown Result state"),
        };
    }

    public Result Map(Func func)
    {
        return this switch
        {
            Ok ok => new Result.Ok(func(ok.Value)),
            Err err => new Result.Err(err.Error),
            _ => throw new InvalidOperationException("Unknown Result state"),
        };
    }
}
reddit.com
u/scadoshi — 2 months ago

[Testing] Zwipe - TCG deck builder (already on iOS) - 14-day closed test, I'll test yours back

Hi all, I need to clear Google's 12-tester / 14-day closed-testing requirement before I can launch on Android. Looking for testers, and happy to test yours back. Drop your link in the comments and I'll join today.

The app is Zwipe, a deck builder for trading-card games. It's already on iOS, so it's a real, working app, not a blank shell. Free, no ads, no in-app purchases.

How to join the test (takes about a minute):

  1. Join the tester group: https://groups.google.com/g/zwipers
  2. Opt in on the web: https://play.google.com/apps/testing/com.scadoshi.zwipe
  3. Install on Android: https://play.google.com/store/apps/details?id=com.scadoshi.zwipe

Google requires testers to stay opted in for 14 days, so please keep the app installed for two weeks. It genuinely helps get Zwipe to launch.

Feedback is very welcome - bugs, confusing bits, anything. Just reply here or DM me.

reddit.com
u/scadoshi — 2 months ago
▲ 2 r/AndroidAppTesters+1 crossposts

[Testing] Zwipe - TCG deck builder (already on iOS) - 14-day closed test, I'll test yours back

Hi all, I need to clear Google's 12-tester / 14-day closed-testing requirement before I can launch on Android. Looking for testers, and happy to test yours back. Drop your link in the comments and I'll join today.

The app is Zwipe, a deck builder for trading-card games. It's already on iOS, so it's a real, working app, not a blank shell. Free, no ads, no in-app purchases.

How to join the test (takes about a minute):

  1. Join the tester group: https://groups.google.com/g/zwipers
  2. Opt in on the web: https://play.google.com/apps/testing/com.scadoshi.zwipe
  3. Install on Android: https://play.google.com/store/apps/details?id=com.scadoshi.zwipe

Google requires testers to stay opted in for 14 days, so please keep the app installed for two weeks. It genuinely helps get Zwipe to launch.

Feedback is very welcome - bugs, confusing bits, anything. Just reply here or DM me.

reddit.com
u/scadoshi — 2 months ago
▲ 3 r/AndroidAppTesters+1 crossposts

[Testing] Zwipe - TCG deck builder (already on iOS) - 14-day closed test, I'll test yours back

Hi all, I need to clear Google's 12-tester / 14-day closed-testing requirement before I can launch on Android. Looking for testers, and happy to test yours back. Drop your link in the comments and I'll join today.

The app is Zwipe, a deck builder for trading-card games. It's already on iOS, so it's a real, working app, not a blank shell. Free, no ads, no in-app purchases.

How to join the test (takes about a minute):

  1. Join the tester group: https://groups.google.com/g/zwipers
  2. Opt in on the web: https://play.google.com/apps/testing/com.scadoshi.zwipe
  3. Install on Android: https://play.google.com/store/apps/details?id=com.scadoshi.zwipe

Google requires testers to stay opted in for 14 days, so please keep the app installed for two weeks. It genuinely helps get Zwipe to launch.

Feedback is very welcome - bugs, confusing bits, anything. Just reply here or DM me.

reddit.com
u/scadoshi — 2 months ago
▲ 1 r/CommanderMTG+1 crossposts

Zwipe is live, a swipe-based deck builder for Magic, free on iOS

Seems like most deck builders are built for desktop and mobile gets treated as an afterthought. Zwipe is mobile-first.

You pick a commander, the app filters to color identity and format legality, you pick what you want and then you swipe.

Swiping snapshot

- Right adds the card

- Left skips

- Down undoes the last action

- Up sends it to the maybeboard (where applicable)

When you want to narrow further, the filter sheet has the dimensions you'd actually reach for.

110k+ cards from Scryfall, refreshed nightly (English-only for now). Format legality is real-time. Double-faced cards flip the way you'd expect. The printing carousel lets you swap in whatever version of the card fits the deck.

It's free on the App Store right now. Android is next. This is a solo build from a new developer, so if you have feature requests or bug reports, I'm welcoming both on my Discord.

If you brew on the couch more than at a desk, please give it a shot 😄

zwipe.net

reddit.com
u/scadoshi — 2 months ago