Skip Navigation

sam

@sam.r1b.it.ap.tdpl.io

7 Posts26 Comments0 Memberships

Joined October 2026

A long-time Lemming and the proud owner of r1b.it 🐸

🌉 bridged from @sam@r1b.it by Tidepool

  • science memes 🧬 - Your daily dose of peer-reviewed giggles, lab-coat laughs, and existential dread induced by quantum mechanics

    cross-posted from: https://r1b.it/post/38416

    With mander.xyz being down for so long, I've really started to miss my nerdy science memes. So, being an instance owner, I decided to fix that! !memes@r1b.it is the perfect home for all of your biology, chemistry, physics, math or otherwise scientific shitposts and memes :) This is a drop-in replacement for the late !science_memes@mander.xyz. Like with my other mander replacement, !herps@r1b.it, I do not expect anyone to stick around if/when mander comes back. This is just a temporary home for all of us science lovers. If you do decide to stay tho, I greatly appreciate it!

  • Does this work for my micro-instance?

    cross-posted from: https://r1b.it/post/12935

    As I have browsed the Fediverse through r1b.it, I've noticed lots of missing content from remote communities. Some of that has to do with actual federation problems (which I have been in talks with other instance owners to fix), but most of it is a result of completely intentional behavior. Regardless of that, though, I feel as if missing content detracts from the r1b.it user experience. So, I decided to flex my programming muscles a bit and devised a solution. For the more technically inclined bunch, you can keep reading to see how it works. For everyone else, you can just be happy to hear that you should now be getting all new content from your subscribed communities! If you have any further federation issues, please let me know. You can always @ me in !croak :)

     py
    #!/usr/bin/env python3
    import subprocess
    import urllib.parse
    import urllib.request
    import time
    import random
    
    LOCAL_DOMAIN = "https://r1b.it/"
    DB_CONTAINER = "REDACTED"
    DB_USER = "REDACTED"
    DB_NAME = "REDACTED"
    
    SQL_QUERY = """
    SELECT DISTINCT c.actor_id 
    FROM community_follower cf
    JOIN person p ON cf.person_id = p.id
    JOIN community c ON cf.community_id = c.id
    WHERE p.local = true 
      AND c.local = false;
    """
    
    def get_subscriptions():
        cmd = [
            "docker", "exec", "-i", DB_CONTAINER,
            "psql", "-U", DB_USER, "-d", DB_NAME, "-t", "-A", "-c", SQL_QUERY
        ]
        try:
            res = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return [line.strip() for line in res.stdout.splitlines() if line.strip()]
        except Exception:
            return []
    
    def resolve_community(actor_id):
        encoded = urllib.parse.quote(actor_id, safe="")
        api_url = f"{LOCAL_DOMAIN}/api/v3/resolve_object?q={encoded}"
        req = urllib.request.Request(
            api_url, 
            headers={"Accept": "application/json", "User-Agent": "LemmyAutoSync/1.0"}
        )
        try:
            with urllib.request.urlopen(req, timeout=10) as resp:
                return resp.status
        except urllib.error.HTTPError as e:
            return e.code
        except Exception:
            return 500
    
    def main():
        communities = get_subscriptions()
        if not communities:
            return
    
        print(f"Found {len(communities)} unique remote subscriptions")
        
        random.shuffle(communities)
    
        for actor_id in communities:
            status = resolve_community(actor_id)
            if status == 200:
                print(f"{actor_id} FEDERATED")
            elif status == 400:
                print(f"{actor_id} ALREADY FEDERATED")
            else:
                print(f"{actor_id} FAILED ({status)")
            
            # Polite randomized pause
            time.sleep(random.uniform(1, 5))
    
        print("Sync complete.")
    
    if __name__ == "__main__":
        main()
  • Why do so few self-host?

    Is it just up-front cost? I understand that for larger instances because they'd have to setup heftier systems, but even micro-instances seem to rent cloud compute when they could probably get by with port-forwarding to an old laptop. Edit: I understand that self-hosting is a skill that takes years to learn, and I'm aware that the vast majority of people on Earth choose to spend their time and energy investing into completely different topics. However, Lemmy tends to attract the techy type, so I suppose I just assumed the ratio of self-hosters-to-not would be higher. I'm not saying it's trivial, just that I presume more Lemmings know how to do it than, say, Redditors (taking total users into account ofc)