[–] 6 points 20 hours ago

I'm also selfhosting mail and I had to do some initial work to remove the server's IP from blocklists. That was pretty much it.

Receiving email isn't an issue. Other servers will just send them, I think they only check the blocklists if it's the other way 'round. Gmail is a bit nasty, they'll occasionally do weird things if I send out newsletters and mailing lists. But with all the other providers it's mostly just fine. Issues arise once I (inadvertently) forward spam. That leads to some extra work.

I do have to tune my own spamfilter regularly. So there's some effort I put in.

  • source
  • parent
  • context
  • [–] 8 points 1 day ago*

    I have no clue. But I must say I hate how I can't find out because a Playstation is like 1300€ these days. That's way too much. And I probably won't pay for a gaming pc either once they release it for PC.

  • source
  • [–] 1 point 2 days ago* (last edited 2 days ago) (1 child)

    I think I start to see some things I'd perceive as culture as well. I mean half of it is nonsense: cattle handlers exist all around the world and they're doing the job in a similar way. Rodeo is from Latin America. Baseball is a variant of European sports, "high school culture" is everything but culture...

    But for example Basketball has an interesting history to it. Seems the Germans already had a similar game in 1591... But then basketball was invented by an Canadian-American at some international YCMA Training School in the USA. I doubt we'd have it if it weren't for the USA. The Levi's 501 also very American. Though I must say work-wear already existed, denim is from France... Their invention is the cut and the copper rivets. But certainly connected to a lot of culture.

    Sitcoms, Reality TV, Indians, Cajun... Yeah Idk. I feel the Indians(??) exist despite America, not because of it. Cajun is nice, but they didn't really invent it, it's more that they bought Louisiana from the French. And not sure if sitcoms and other special forms of entertainment for the masses pass as high culture. Maybe it does, idk. But at that point I'd rather go with something like the blues and rock music we discussed earlier. I think that's kind of a higher art form and due to specifics in American history. Whereas positioning the comedians and the camera a certain way and add (canned) laughter is kind of a measly invention compared to other cultures who single-handedly invented modern philosophy or the french fries?!

    But why don't you believe in the melting pot? Didn't kinda all things we're currently discussing happen due to some melting pot situation? I mean the music... The jeans was someone from Germany and someone from Latvia and the situation in the US, lots of sports and culture comes from cultures mixing...

    And sure. Europe is a melting pot. I know actual people who live in Spain, have been there... There's a Spanish restaurant in walking distance from where I live... We also have Mexican restaurants here, Arabic ones, burgers, an American-themed steakhouse, Indian food, Japanese, Turkish... There's no issue getting exposed to all sorts of things? Cajun cuisine is gonna be tricky, but it's not like we don't know what gets served there and how their music sounds.

  • source
  • parent
  • context
  • [–] 1 point 2 days ago* (last edited 2 days ago) (3 children)

    Lol. I mean if I'm not allowed to talk about the US because I don't live there... You probably also don't get to use the word "culture" because you're likely from there and have no clue what culture is?!

    I mean if you want I can name about 100 things [...]

    Sure go ahead. But make it like 5. And proper things which really got invented there and they didn't just add two things on top and relabeled it as American.

    Ok you just kinda ignore what I say by stating [...]

    What are you even talking about? I reply to each point you raise?!? I mean I can feel you're not happy with the answers, how nobody else sees it this way... But that doesn't make what I say less true?!

  • source
  • parent
  • context
  • [–] 1 point 2 days ago (5 children)

    Hehe, just go to any random place abroad and see if they accept American fast food as culture. It's not even a mainstream thing... We'll eat Döner Kebap here and lots of Pizza. None of that is American in any way or form. The occasional MacDonald's we keep around is for the 5 people without taste buds, and if it's 3am and all the other places are closed for cleaning. Our neigbours eat Bamischijf, the Brits eat fish and chips... Literally no one eats what the US Americans portray as food. And even they'll prefer burritos if available.

    Yes. People certainly added to movie and music. It's just the more cultured someone is, the more distance they get between themselves and something like Hollywood productions and country music because what the USA is definitely good at is make things big and commercialize them. I just don't think there's a lot of unique American-ness in something like music. It was a global effort, the spirit and temper comes from abroad... And yes, some of the influential exchange happened on US soil.

    But that wasn't what you were saying. You said "America invented"... And they clearly didn't invent any of what we're talking about.

  • source
  • parent
  • context
  • [–] 1 point 2 days ago

    Thanks for the additional info. I didn't spot the links in the footer.

    Yeah, guess ending up in some Roko's Basilisk situation will be mostly due to our own idiocy. We get to shape AI. We could put in effort and design something we'd like to share the planet with. Or we can just maximize intelligence and see where that'll lead. Seems we're going for the latter. But that comes with consequences.

  • source
  • parent
  • context
  • [–] 1 point 2 days ago* (last edited 2 days ago) (7 children)

    They dug up a fast food restaurant in Pompeii. That's hardly in the States?! And like 1400 years before discovering the New World?

    Movie theaters were popularized in London and Paris in and the cathode ray tube was invented by two Germans.

    Punk, rock etc I think was also heavily influenced by the Brits. I mean one of the most influential rock bands was from Liverpool (UK). But indeed lots of music is a cultural achievement which originated in the USA. Wouldn't make me feel patriotic, though, since it happened by kidnapping lots of people from another continent and they brought the music.

    At least get your facts right if you decide to insult other people.

  • source
  • parent
  • context
  • [–] 4 points 3 days ago* (2 children)

    Sounds nice and cozy! But I must say I also miss the warmth of the sun on my skin on a nice evening bicycle ride. And by now that'd be like the middle of the night and anyway, it's dark, cold and raining for days at a time.

  • source
  • [–] 20 points 3 days ago* (last edited 3 days ago)

    I have used changedetection.io for a while. It can parse the pages and do notifications, also launch a headless browser and do screenshots. And from what I see they also seem to have added a proper open-source license a while ago. (On the downside they also added a lot of AI stuff which wasn't there when I used it.) But I also had some minor hiccups. Not sure it's good enough for important legal stuff.

  • source
  • [–] 2 points 3 days ago

    Certainly getting harder to tell by the day. Dunno why this happens, but some pop and rock will have this weird uncanny AI voice. It's kind of unique and noticeable. From everything to the right-wing propaganda videos to that little viking girl recently, to some department store music... But there's also vocals I can't tell. And even more so in instrumentals. There used to be weird quirks, and I believe they started with realistic country music, because that's the most bland genre there is. Plus the lyrics to country music (and pop) are meaningless, nobody would be able to differentiate between a 4 year old, ChatGPT and a regular songwriter... But now it's getting way better. And I can't tell either... But I guess it also doesn't matter a lot for the genres I listen to. And it's not like AI can play the accordeon and sing like Weird Al does.

  • source
  • parent
  • context
  • [–] 2 points 3 days ago* (last edited 3 days ago)

    Yeah, sorry I didn't want come off as obtuse. Guess it's more being annoyed.

    I mean I grew up catholic. And there's quite some things I'm not okay with concerning the catholic church. Things many people don't like. For example their stance towards women, people who aren't heterosexual. People who they employ and who happen to get divorced, their stance towards contraceptives... All of that isn't just part of history, but severe issues as of today.

    And we've been trying to talk to the church for like 50 years now?! And they never listen. And it got considerably worse for the church. The last decades people realized there's nothing in it for them. So they voted with their feet and left. And now the church struggles with income and all kinds of things, has to close churches and in a few years they're probably going to go extinct...

    But does that make them reconsider or repent or modernize? Of course not!

    That's kind of the main thing. And all the misconduct comes on top. But what am I supposed to do with that? I mean I'd applaud them and maybe resume contributing if they for example offered places for young people to do projects in the afternoon. But they're also(!) closing those because they're not interested in investing in young people unless it's the altar servers. (Or profitable daycares.) They also don't really contribute a lot to my own life...

    So what's left for me except feeling disillusioned?

    (I've also talked a bit to people from the other big Christian denomination here. And it's a similar story with them. They're more modern than we are, but there's also a lot of systemic issues, they also have their followers dwindle and I just don't see a lot of stuff on the positive side with them, either.)

  • source
  • parent
  • context
  •  

    Sometimes I get into arguments about AI and people comment weird stuff here on Lemmy. Like we have ethical AI models (meaning they're not made up of unethically sourced training material). Or we got plenty "libre" or "free and open-source" AI models.

    Am I missing something? Or is this just a bunch of people trying to bullshit me? Is anyone here aware of such large language models and would be so kind as to educate me? I mean we do have a ton of open-weights models. But proper open-source or ethical??? I've been following the news for quite a while and I'm aware of a very select few I'd call LLMs with training datasets available. I'm aware of:

    • Pythia by EleutherAI (up to 12B, from 2023) and Dolly 2 by Databricks (12B, also from 2023)
    • BLOOM by BigScience (176B, from 2022)
    • GPT-2 by OpenAI (1.5B, from 2019)
    • The recreation of LLaMA by the RedPajama-Project
    • Apertus by the ETH Zürich

    Edit: In the comments we got:

    • LLM360 with K2-65B, Crystal-7b, Amber-7B
    • the Soofi-Project
    • OLMoE

    That list needs a lot of footnotes, though. Some of them come with restrictions, terms and conditions... And none of them can do modern tasks like AI-assisted coding. The only one getting close is the Swiss model. Sadly the earlier version I tried didn't perform well. Seems they released an updated v1.5 version this summer, I wonder if that's better and anybody uses it for real-world applications.

    So... Back to my initial question: Are there models out there with datasets available? I mean except the exactly one somewhat usable one I already found?

     

    @ozoned@piefed.social is doing a "Works On My Machine LIVE" episode with Rimu.

    Announcement:

    I'm going to be doing a "Works On My Machine LIVE" episode with Rimu for Piefed.

    Monday Aug 31st 00:00 UTC. I think?!? :D Time zones always screw me up.

    https://womm.live

    Calendar: https://freestreamers.btfree.org/

     

    I would like to experiment with image editing. Idk, brush up my vacation photos, remove some of the other tourists, make it look like I've been somewhere I haven't... Swap my face onto someone or change my clothes, change the weather/sky... Draw me as a character in some artist's style... If it works well enough, take some of the blurry images from my potato phone camera from 15 years ago and clean them up... The stuff I've seen people on YouTube do with AI.

    What's a good and recent model or "editor" to do that? Open-weights please and preferably something I can just use straight away without fiddling 3 hours with some ComfyUI nodes. Bonus points for being efficient and running on my laptop 😅

    And is there some Free Software UI / software to make it easy? I mean I'm perfectly able to learn how to provide it with stencils(maybe they don't need that anymore in 2026?) and whatever stuff it needs as input, run it on the commandline... But maybe there's a nice interface like an image editor?

    Edit: I forgot: I mentioned different use-cases... Seems to me there are different models for like regular image editing (which gets one image and a prompt as input) and models which get two images as input? Like a picture, and another picture and the instruction to draw this person onto that picture?

    AI scrapers everywhere Idea (palaver.p3x.de)
     

    There's a nice article: The Day I Logged 1 In Every 2000 Public IPv4: Visualizing The AI Scraper DDoS which someone kindly dropped in the fuck_ai community. It's worth reading.

    After reading it, I decided to have another look at my logfiles and I'm pretty sure I see the same thing. A good while back I had my small 1-3 people instance nearly melt because of Tencent and Alibaba. I managed to address that by blocking some of their IP ranges. Proceedingly rimu implemented a Honeypot, which currently has 14.272 IPs blocked on my instance. And a few database requests got more efficient. But I think the overall situation deteriorated. These days the AI scrapers seem to come from everywhere on the internet.

    My logfiles just scroll by again. It's not as bad as when I was hit by the really nasty crawlers. The server keeps up with it, I'm just constantly sending out loads of data. There's a crawler getting caught up in the honeypot almost every minute. But there's also still a near infinite amount of addresses left, querying all kinds of posts, communities and user profiles. And I notice since it's a dysproportionate amount of traffic for a small instance.

    I think the honeypot is great. But the AI scrapers have way to many addresses. And in the mid-term we probably need to come up with some more mitigations. At least to cater to smaller servers.

    Just wanted to draw some attention to how things change. I've switched my instance to "private" for now, but I'll continue to investigate.

    I've made two images myself (for palaver.p3x.de). First is all IPv4 addresses in my nginx log. That includes all Fedi instances and users. But I'm just a small instance and I guess most of the reddish areas are caused by crawlers.

    AJvKYRbM1j1amZm.png

    Second image is what's in my honeypot, (dots visible after zooming in):

    1y7biwvTHxw9Q8q.png

     

    I'm looking for something more like an traditional Free and Open Source project with an active community, different use-cases...

    I tried googling it. But there's just way to many results these days. And they're mostly(?) cooked up by some AI agent and tend to get abandoned randomly after a few weeks. Or they have broad claims in a shiny README.md and then I install something and in reality it sucks and doesn't even do half of it. Or they're made by lunatics like Peter Steinberger who default to giving their agents root permissions on everything. That's why I try to avoid that category of projects.

    I know I can code everything myself with Python, but it'd be great to have some workflows and integrations laid out for me, memory, RAG, a sandboxed Linux shell, cron, webhooks... So I can just go ahead and connect it to my local LLM and use it for various things. React to my my messages, look up information, read new pull-requests from a repository or RSS feed, write something to a homepage, pipe something into TTS or Ace-Step do a radio show or whatever. Make a small group of agents or my own tools...

    Idk, something roughly alike n8n just proper open-source? Is there anything out there you other people use?

    I'm asking in the LocalLlama community since I try to run it locally. And I need some amount of customizability so I can create some clever workflows. Something like OpenCode also doesn't really help if it wastes a million tokens on some mundane task and it's not really designed to fit with my limited amount of compute resources. Or if it's super hard to customize it to do so.

    GNU/Linux.ch Artikel: Das Fediverse stirbt langsam Discussion & Question Stats Ideas & Essay (gnulinux.ch)
     

    Wir können in den letzten Monaten einen deutlichen Rückgang der aktiven Nutzenden feststellen. Doch was genau sind die Gründe dafür und was können wir dagegen tun?


    Interessanter Artikel. Bin nicht sicher was ich davon halten soll. Hier ist die Statistik auf die der Artikel sich bezieht. Meine Instanz sieht auch einen massiven Ausschlag an neuen Nutzern letzten Februar/März aber auch hier im Threadiverse war es eigentlich immer schwer neue Nutzer zu halten. Wenn es denn tatsächlich auch echte neue Nutzer waren. Wir haben immer wieder diese Ereignisse mit einem Zustrom von Leuten. Aber ansonsten gehen die Statistiken für Lemmy eigentlich regelmäßig bergab. Und das ist auch schon eine ganze Weile so.

    Und ich denke ich beobachte auch einen gesellschaftlichen Wandel. Also vielen Leuten ist das was mir wichtig ist zunehmend unwichtiger?! Oder wir haben resigniert? Aber eigentlich wäre doch im Moment ein guter Zeitpunkt um von den Plattformen die schon lange zunehmend kommerzieller und manipulativer werden zu Alternativen zu wechseln, die von Menschen für Menschen geschaffen werden?

     

    Richard Sutton is the father of reinforcement learning, winner of the 2024 Turing Award, and author of The Bitter Lesson. And he thinks LLMs are a dead end. [...] LLMs aren’t capable of learning on-the-job, so no matter how much we scale, we’ll need some new architecture to enable continual learning. And once we have it, we won’t need a special training phase — the agent will just learn on-the-fly, like all humans, and indeed, like all animals. This new paradigm will render our current approach with LLMs obsolete.

    Long interview from the Dwarkesh Patel Podcast. I like the more technical/philosophical arguments. And I think it's a more nuanced perspective than what we normally hear about AI.

    https://piped.video/watch?v=21EYKqUsPfg

    Plugin Experiment: Matplotlib Charts v0.0.1 Discussion Experimental (palaver.p3x.de)
     

    Caution: This is not a working plugin. This is intended to highlight some ways the plugin system could be used in the future. But this specific code is an early attempt and not up to quality standards.

    Description: Experiment on plugin use-cases. Generates statistics graphs about posts, replies, users and instances over time, along with versions, languages and voting behaviour of a user.
    It reads from the database and writes files to the public directory served by the webserver. Images are public and can be accessed by anyone, so factor that in and don't publish somewhat personal information like the voting behavour in the last chart. This does some expensive database queries as well. It's just experimentation, not meant to be deployed yet.

    Additional dependencies: matplotlib

    charts/init.py

    import os, sys  
    import logging  
    
    from app.plugins.hooks import hook  
    from flask import current_app, g, Blueprint  
    from app.utils import get_task_session  
    from app.models import Site, Instance, Post, PostReply, User, ActivityPubLog, PostVote, PostReplyVote  
    from sqlalchemy import text, func, literal_column, and_, or_  
    
    from matplotlib.figure import Figure  
    from matplotlib.colors import TABLEAU_COLORS  
    import matplotlib.dates as mdates  
    from datetime import datetime, timedelta  
    
    
    PLUGIN_NAME = __name__.split('.')[-1]  
    logger = logging.getLogger(__name__)  
    
    
    def fetch_stats(session, obj, interval='day', starttime=None, endtime=None, count1=None, count2=None, sum2=None, createdcolumn=None):  
        if interval not in ['hour', 'day', 'week', 'month']:  
            interval = 'day'  
        if not starttime:  
            starttime = g.site.created_at  
        if not endtime:  
            endtime = datetime.now()  
        if not count1:  
            count1 = [obj.id != None]  
        if not createdcolumn:  
            createdcolumn = obj.created_at  
    
        timeseries = func.generate_series(starttime, endtime, f"1 {interval}").alias('timeseries')  
        one = literal_column("1")  
    
        if count2:  
            data = session.query(timeseries.column, func.count(one).filter(*count1), func.count(one).filter(*count2))  
        elif sum2:  
            data = session.query(timeseries.column, func.count(one).filter(*count1), func.sum(sum2))  
        else:  
            data = session.query(timeseries.column, func.count(one).filter(*count1))  
        data = data.select_from(timeseries).outerjoin(obj, func.date_trunc(interval, createdcolumn) == func.date_trunc(interval, timeseries.column))  
        data = data.group_by(timeseries.column).order_by(timeseries.column)  
    
        if interval == 'day':  
            data = data.all()[2:-2] # throw away first two days and today to remove outliers/unstable data  
    
        data2 = {'timestamp': [], 'count1': [], 'count2': [], 'zeros': []}  
        for row in data:  
            data2['timestamp'].append(row[0])  
            data2['count1'].append(row[1])  
            if count2:  
                data2['count2'].append(row[2])  
            data2['zeros'].append(0)  
    
        return data2  
    
    
    @hook("cron_daily")  
    def generate_charts_loop(data):  
        """Hook that runs on a periodic interval"""  
        from app import redis_client  
        with current_app.app_context(), get_task_session() as session:  
            g.site = session.query(Site).get(1)  
    
            languages = session.execute(text('SELECT language.name, COUNT(*) FROM post LEFT JOIN language ON post.language_id = language.id AND post.deleted = False GROUP BY name ORDER BY count DESC LIMIT 10')).all()  
            colors = list( TABLEAU_COLORS.keys() )  
            colors.insert(1, 'lightgray')  
            fig = Figure()  
            ax = fig.add_subplot()  
            labels = [r.name if r.name else 'Unknown' for r in languages]  
            hbars = ax.barh(labels, [r.count for r in languages], align='center', label=labels, color=colors)  
            ax.invert_yaxis()  
            ax.xaxis.set_visible(False)  
            ax.set_title('Top 10 post languages', y=0.0)  
            ax.text(0.99, -0.01, datetime.now().strftime('%Y-%m-%d %H:%M:%S') + '  on ' + g.site.name, verticalalignment='top', horizontalalignment='right', transform=ax.transAxes, color='darkgrey') #, fontsize=15  
            fig.tight_layout()  
            filename = "/var/lib/piefed/app/static/tmp/languages.svg"  
            fig.savefig(filename, format="svg")  
    
            software = session.execute(text('SELECT software, COUNT(*) FROM instance WHERE "gone_forever" IS False GROUP BY software ORDER BY count DESC LIMIT 15')).all()  
            myexplode = [0.2 if r.software == 'piefed' else 0 for r in software]  
            fig = Figure()  
            ax = fig.add_subplot()  
            colors = list( TABLEAU_COLORS.keys() )  
            hbars = ax.barh([r.software for r in software], [r.count for r in software], align='center', color=colors)  
            ax.bar_label(hbars, fmt='%d')  
            ax.invert_yaxis()  
            ax.set_title('Instances by Software', y=0.0)  
            ax.text(0.99, -0.01, datetime.now().strftime('%Y-%m-%d %H:%M:%S') + '  on ' + g.site.name, verticalalignment='top', horizontalalignment='right', transform=ax.transAxes, color='darkgrey') #, fontsize=15  
            fig.tight_layout()  
            fig.savefig("/var/lib/piefed/app/static/tmp/software.svg", format="svg") # , transparent=True  
    
            for software in ["mastodon", "lemmy", "peertube", "friendica", "piefed", "sharkey", "mbin"]:  
                version = session.execute(text('SELECT version, COUNT(*) FROM instance WHERE "software" = :software AND "gone_forever" IS False GROUP BY version ORDER BY count DESC'), {'software': software}).all()  
                fig = Figure()  
                ax = fig.add_subplot()  
                ax.pie([r.count for r in version], labels=[r.version for r in version])  
                ax.set_title(f"{software} versions", y=0.0)  
                ax.text(0.99, -0.01, datetime.now().strftime('%Y-%m-%d %H:%M:%S') + '  on ' + g.site.name, verticalalignment='top', horizontalalignment='right', transform=ax.transAxes, color='darkgrey') #, fontsize=15  
                fig.tight_layout()  
                fig.savefig(f"/var/lib/piefed/app/static/tmp/version_{software}.svg", format="svg")  
    
            for interval in ['day', 'week', 'month']: # hour  
                data = fetch_stats(session, Instance, interval)  
                data_gone = fetch_stats(session, Instance, interval, createdcolumn=Instance.last_seen, count1=[Instance.gone_forever == True])  
                fig = Figure()  
                ax = fig.subplots()  
                ax.fill_between(data['timestamp'], data['zeros'], data['count1'], step='pre', alpha=0.4)  
                ax.step(data['timestamp'], data['count1'], label="Instances discovered")  
                ax.fill_between(data_gone['timestamp'], data_gone['zeros'], [-x for x in data_gone['count1']], step='pre', alpha=0.4)  
                ax.step(data_gone['timestamp'], [-x for x in data_gone['count1']], label="Instances gone")  
                ax.plot([], [], ' ', label=f"(per {interval})")  
                ax.legend(loc="upper right")  
                fig.tight_layout()  
                fig.savefig(f"/var/lib/piefed/app/static/tmp/instances_{interval}.svg", format="svg")  
    
                data_posts = fetch_stats(session, Post, interval, count1=[and_(Post.deleted == False, Post.up_votes > 0)], count2=[Post.deleted == True])  
                data_replies = fetch_stats(session, PostReply, interval, count1=[and_(PostReply.deleted == False, PostReply.up_votes > 1)], count2=[PostReply.deleted == True])  
                posts_byvote = fetch_stats(session, Post, interval, count1=[and_(Post.deleted == False, Post.up_votes > 30)], count2=[and_(Post.deleted == False, Post.up_votes == 0)])  
                replies_byvote = fetch_stats(session, PostReply, interval, count1=[and_(PostReply.deleted == False, PostReply.up_votes > 10)], count2=[and_(PostReply.deleted == False, PostReply.up_votes <= 1)])  
                fig = Figure()  
                axs = fig.subplots(2)  
                axs[0].fill_between(data_posts['timestamp'], data_posts['zeros'], data_posts['count1'], step='pre', alpha=0.4)  
                axs[0].step(data_posts['timestamp'], data_posts['count1'], label = f"Posts (per {interval})")  
                axs[0].fill_between(data_posts['timestamp'], data_posts['zeros'], [-x for x in data_posts['count2']], step='pre', alpha=0.4)  
                axs[0].step(data_posts['timestamp'], [-x for x in data_posts['count2']], label="Posts removed")  
                axs[0].fill_between(posts_byvote['timestamp'], posts_byvote['zeros'], posts_byvote['count1'], step='pre', alpha=0.4)  
                axs[0].plot([], [], label=">30 upvotes")  
                axs[0].fill_between(posts_byvote['timestamp'], data_posts['count1'], [x + y for x, y in zip(data_posts['count1'], posts_byvote['count2'])], step='pre', alpha=0.4)  
                axs[0].plot([], [], label="0 upvotes")  
                axs[1].fill_between(data_replies['timestamp'], data_replies['zeros'], data_replies['count1'], step='pre', alpha=0.4)  
                axs[1].step(data_replies['timestamp'], data_replies['count1'], label = f"Comments (per {interval})")  
                axs[1].fill_between(data_replies['timestamp'], data_replies['zeros'], [-x for x in data_replies['count2']], step='pre', alpha=0.4)  
                axs[1].step(data_replies['timestamp'], [-x for x in data_replies['count2']], label= "Comments removed")  
                axs[1].fill_between(replies_byvote['timestamp'], replies_byvote['zeros'], replies_byvote['count1'], step='pre', alpha=0.4)  
                axs[1].plot([], [], label=">10 upvotes")  
                axs[1].fill_between(replies_byvote['timestamp'], data_replies['count1'], [x + y for x, y in zip(data_replies['count1'], replies_byvote['count2'])], step='pre', alpha=0.4)  
                axs[1].plot([], [], label="<=1 upvote")  
                axs[0].legend(loc="upper left")  
                axs[1].legend(loc="upper left")  
                fig.tight_layout()  
                fig.savefig(f"/var/lib/piefed/app/static/tmp/posts_{interval}.svg", format="svg")  
    
                data = fetch_stats(session, User, interval, createdcolumn=User.created, count1=[User.bot == False], count2=[and_(User.bot == False, User.deleted == False, User.banned == False, User.last_seen - User.created < timedelta(days=3), User.created < datetime.now() - timedelta(days=5))])  
                users_removed = fetch_stats(session, User, interval, createdcolumn=User.last_seen, count1=[or_(User.deleted == True, User.banned == True)])  
                fig = Figure()  
                ax = fig.subplots()  
                ax.fill_between(data['timestamp'], data['zeros'], data['count1'], step='pre', alpha=0.4)  
                ax.step(data['timestamp'], data['count1'], label="Users discovered")  
                ax.fill_between(users_removed['timestamp'], users_removed['zeros'], [-x for x in users_removed['count1']], step='pre', alpha=0.4)  
                ax.step(users_removed['timestamp'], [-x for x in users_removed['count1']], label="Users removed")  
                ax.fill_between(data['timestamp'], data['count1'], [x - y for x, y in zip(data['count1'], data['count2'])], step='pre', alpha=0.4)  
                ax.plot([], [], label="non-returning")  
                ax.plot([], [], ' ', label=f"(per {interval})")  
                # ToDo: show inactive  
                ax.legend(loc="upper right")  
                fig.tight_layout()  
                fig.savefig(f"/var/lib/piefed/app/static/tmp/users_{interval}.svg", format="svg")  
    
            starttime = datetime.now() - timedelta(days=3)  
            endtime = datetime.now()  
            interval = 'hour'  
            timeseries = func.generate_series(starttime, endtime, f"1 {interval}").alias('timeseries')  
            one = literal_column("1")  
            data = session.query(timeseries.column, func.count(one).filter(ActivityPubLog.id != None), ActivityPubLog.activity_type, ActivityPubLog.direction).select_from(timeseries).outerjoin(ActivityPubLog, func.date_trunc(interval, ActivityPubLog.created_at) == func.date_trunc(interval, timeseries.column)).group_by(timeseries.column, ActivityPubLog.activity_type, ActivityPubLog.direction).order_by(timeseries.column).all()[:-2]  
            timestamps = []  
            activity_types = []  
            values = dict()  
            values['in'] = dict()  
            values['out'] = dict()  
            for r in data:  
                timestamp_ = r[0]  
                value_ = r[1]  
                type_ = r[2]  
                direction_ = r[3]  
                if direction_ not in ['in', 'out']:  
                    continue  
                if type_ not in values[direction_]:  
                    values[direction_][type_] = dict()  
                values[direction_][type_][timestamp_] = value_  
                if timestamp_ not in timestamps:  
                    timestamps.append(timestamp_)  
                if type_ not in activity_types:  
                    activity_types.append(type_)  
            val2 = dict()  
            for direction in ['in', 'out']:  
                val2[direction] = dict()  
                for type_ in activity_types:  
                    val2[direction][type_] = []  
                    for i, ts in enumerate(timestamps):  
                        if (type_ in values[direction]) and (ts in values[direction][type_]):  
                            val2[direction][type_].append(values[direction][type_][ts])  
                        else:  
                            val2[direction][type_].append(0)  
            fig = Figure()  
            ax = fig.subplots()  
            defaultColors = [  
                "#3366CC", "#DC3912", "#FF9900", "#109618", "#990099", "#3B3EAC", "#0099C6",  
                "#DD4477", "#66AA00", "#B82E2E", "#316395", "#994499", "#22AA99", "#AAAA11",  
                "#6633CC", "#E67300", "#8B0707", "#329262", "#5574A6", "#651067"  
            ]  
            bottom = [0 for r in timestamps]  
            shownTypes = ['Announce', 'Create', 'Update', 'Delete', 'Undo Vote', 'Dislike', 'Like'] # , 'PeerTube View', 'Duplicate', 'User Ban', 'Add Mod/Sticky', 'Remove Mod/Sticky', 'Undo Delete', 'Post Lock', 'Accept', 'Follow', 'Flag', 'Unknown', 'Undo'  
            for type_, color in zip(shownTypes, defaultColors):  
                y2 = [x + y for x, y in zip(val2['in'][type_], bottom)]  
                ax.vlines(timestamps, bottom, y2, colors=color, linewidth=3, label=type_)  
                bottom = y2  
            ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))  
            ax.legend(loc='center left')  
            fig.tight_layout()  
            fig.savefig(f"/var/lib/piefed/app/static/tmp/activity.svg", format="svg")  
    
            user = session.query(User).filter(User.id == 145).one()  
            interval = 'day'  
            starttime = max( datetime.now() - timedelta(days=180), user.created )  
            endtime = datetime.now()  
            data_posts = fetch_stats(session, Post, interval, starttime, endtime, count1=[Post.user_id == user.id])  # , sum2=Post.up_votes  
            data_replies = fetch_stats(session, PostReply, interval, starttime, endtime, count1=[PostReply.user_id == user.id])  
            data_post_votes = fetch_stats(session, PostVote, interval, starttime, endtime, count1=[and_(PostVote.user_id == user.id, PostVote.effect > 0)], count2=[and_(PostVote.user_id == user.id, PostVote.effect < 0)])  
            data_reply_votes = fetch_stats(session, PostReplyVote, interval, starttime, endtime, count1=[and_(PostReplyVote.user_id == user.id, PostReplyVote.effect > 0)], count2=[and_(PostReplyVote.user_id == user.id, PostReplyVote.effect < 0)])  
            data_votes = {'timestamp': [x for x, y in zip(data_post_votes['timestamp'], data_reply_votes['timestamp'])],  
                          'count1': [x + y for x, y in zip(data_post_votes['count1'], data_reply_votes['count1'])],  
                          'count2': [x + y for x, y in zip(data_post_votes['count2'], data_reply_votes['count2'])] }  
            data_post_votes_in = fetch_stats(session, PostVote, interval, starttime, endtime, count1=[and_(PostVote.author_id == user.id, PostVote.effect > 0)], count2=[and_(PostVote.author_id == user.id, PostVote.effect < 0)])  
            data_reply_votes_in = fetch_stats(session, PostReplyVote, interval, starttime, endtime, count1=[and_(PostReplyVote.author_id == user.id, PostReplyVote.effect > 0)], count2=[and_(PostReplyVote.author_id == user.id, PostReplyVote.effect < 0)])  
            data_votes_in = {'timestamp': [x for x, y in zip(data_post_votes_in['timestamp'], data_reply_votes_in['timestamp'])],  
                             'count1': [x + y for x, y in zip(data_post_votes_in['count1'], data_reply_votes_in['count1'])],  
                             'count2': [x + y for x, y in zip(data_post_votes_in['count2'], data_reply_votes_in['count2'])] }  
            fig = Figure()  
            axs = fig.subplots(3)  
            axs[0].set_title(f"{user.user_name}")  
            bottom = data_posts['zeros']  
            axs[0].vlines(data_posts['timestamp'], bottom, data_posts['count1'], colors="#3366CC", linewidth=2, label="Posts")  
            bottom = data_posts['count1']  
            axs[0].vlines(data_replies['timestamp'], bottom, [x+y for x, y in zip(data_posts['count1'], data_replies['count1'])], colors="#FF9900", linewidth=2, label="Comments")  
            axs[0].legend(loc="upper left")  
            bottom = [0 for r in data_votes['timestamp']]  
            axs[1].vlines(data_votes['timestamp'], bottom, data_votes['count1'], colors="#22AA99", linewidth=2, label="Upvotes")  
            axs[1].vlines(data_votes['timestamp'], bottom, [-x for x in data_votes['count2']], colors="#DD4477", linewidth=2, label="Downvotes")  
            axs[1].legend(loc="upper left")  
            bottom = [0 for r in data_votes_in['timestamp']]  
            axs[2].vlines(data_votes_in['timestamp'], bottom, data_votes_in['count1'], colors="#66AA00", linewidth=2, label="Upvotes")  
            axs[2].vlines(data_votes_in['timestamp'], bottom, [-x for x in data_votes_in['count2']], colors="#DC3912", linewidth=2, label="Downvotes")  
            fig.tight_layout()  
            fig.savefig(f"/var/lib/piefed/app/static/tmp/user_145.svg", format="svg")  
    
    
    def plugin_info():  
        """Plugin metadata"""  
        return {  
            "name": "Matplotlib Charts",  
            "version": "0.0.1",  
            "description": "An experimental plugin that generates statistics charts",  
            "license": "AGPL-3.0",                                   # Must be AGPL-compatible  
            "source_url": "https://piefed.social/post/1308113",  # Required  
            "author": "hendrik"  
        }  
    

    Optional: Create a CMS page (Admin -> Pages) called something like /statistics with the following content:

    ![](/static/tmp/activity.svg)  
    ![](/static/tmp/posts_week.svg)  
    ![](/static/tmp/users_week.svg)  
    ![](/static/tmp/instances_day.svg)  
    
    ![](/static/tmp/software.svg)  
    ![](/static/tmp/version_piefed.svg)  
    ![](/static/tmp/version_lemmy.svg)  
    ![](/static/tmp/languages.svg)  
    ![](/static/tmp/user_145.svg)  
    
    Plugin Experiment: Codeberg Crossposter v0.0.1 Discussion Experimental (palaver.p3x.de)
     

    Caution: This is not a working plugin. Just some code for further discussion within the developer community. Main issue is that we don't (yet) have much of a proper interface to hook into, so this code pokes around in the database and misuses various functions to accomplish the task of posting and replying. Probably circumventing some other code which encompasses these things in regular PieFed for good reasons.

    And then I hardcoded several magic numbers so it won't work unless those are replaced with correct instance-specific values. And no guarantee this will not end up in a some loop and post endlessly.
    Anyway: use a dedicated user for bots, set the "bot account" flag and consider using a seperate community (preferrably local-only) for testing. And make sure you have database backups.

    So: you've been warned not to deploy this "plugin".

    Description: Experimenting with the plugin interface

    Additional dependencies: None

    codeberg_crossposter/init.py

    import os  
    from datetime import datetime, timedelta, timezone  
    import logging  
    
    from app.plugins.hooks import hook  
    from flask import current_app, g  
    from app.utils import get_task_session, html_to_text  
    from app.models import User, Community, Post, Site, PostReply, Notification, CommunityFlair  
    from app.shared.post import make_post, edit_post  
    from app.shared.reply import make_reply, edit_reply  
    from app.shared.tasks import task_selector  
    from app.constants import POST_TYPE_ARTICLE, POST_TYPE_LINK, SRC_API  
    from sqlalchemy import or_  
    
    import httpx  
    from bs4 import BeautifulSoup  
    import re  
    
    PLUGIN_NAME = __name__.split('.')[-1]  
    logger = logging.getLogger(__name__)  
    
    
    @hook("cron_often")  
    def codeberg_import_loop(data):  
        """Hook that runs on a periodic interval"""  
        from app import redis_client  
        with current_app.app_context(), get_task_session() as session:  
            g.site = session.query(Site).get(1)  
            user = session.query(User).filter_by(user_name="rss_bot", id=999122630, banned=False, deleted=False).one()  
            res = redis_client.get(f"plugins:{PLUGIN_NAME}:previous_time")  
            if res is not None:  
                previous_time = datetime.fromtimestamp(float(res))  
            else:  
                logger.warning("Couldn't determine last run")  
                previous_time = datetime(year=1970, month=1, day=1)  
            if datetime.now() - previous_time >= timedelta(minutes=15):  
                #         Name,            RSS Feed,                                       post to community_id  
                urls = [("PieFed",        "https://codeberg.org/rimu/pyfedi.rss",          999846),  
                        ("PieFed-Notifs", "https://codeberg.org/PieFed/piefed-notifs.rss", 999846)]  
                for feedname, url, community_id in urls:  
                    logger.info(f"[{PLUGIN_NAME}] Fetching Codeberg RSS feed {url}")  
                    community = session.query(Community).filter_by(id=community_id, banned=False).one()  
                    response = httpx.get(url, timeout=5.0)  
                    response.raise_for_status()  
                    soup = BeautifulSoup(response.content, 'xml')  
                    items = soup.find_all(['item','entry'])  
                    for item in items[:30]:  
                        title = item.find('title').text  
                        link = item.find('link').get('href') or item.find('link').text  
                        description = item.find('description').text  
                        content = item.find(['content', 'content:encoded'])  
                        content = content.text if content else None  
                        author = item.find('author').text  
                        published = item.find('pubDate').text  
                        #pub_timestamp = datetime.strptime(published, "%a, %d %b %Y %H:%M:%S %z")  
                        if user and community and title and description and content:  
                            x_push = re.match(r"^(?P<author>\S+) pushed to (?P<branch>\S+) at (?P<repo>\S+)$", title)  
                            x_issue = re.match(r"^(?P<author>\S+) (?P<action>created|opened|closed|merged|reopened|commented on) (?P<category>issue|pull request) (?P<repo>\S+)#(?P<issue>\d+)$", title)  
                            if x_push:  
                                pass  
                            elif x_issue:  
                                author = x_issue.group('author')  
                                action = x_issue.group('action')  
                                category = x_issue.group('category')  
                                if category == "issue":  
                                    category = "Issue"  
                                elif category == "pull request":  
                                    category = "PR"  
                                repo = x_issue.group('repo')  
                                issue = x_issue.group('issue')  
    
                                if action == "created" or action == "opened":  
                                    y = re.match(r"^(?P<num>\d+)#(?P<title>.+)#$", description)  
                                    num = y.group('num')  
                                    title = y.group('title')  
                                    title = (feedname + " " + category + " #" + issue + ": " + title)[:220]  
                                    body = f"{action} {published} by {author}\n\n" + html_to_text(content) + f"\n\n(imported from [{feedname} Feed]({url}) by [rss_bot](user.public_url()))"  
                                    previous_posts = session.query(Post).filter(or_(Post.title.startswith(title), Post.url == link), Post.community_id == community.id).all()  
                                    if not previous_posts:  
                                        post_data = {  
                                            'title': title,  
                                            'body': body,  
                                            'url': link,  
                                            'nsfw': False,  
                                            'notify_author': True,  
                                            'language_id': 2,  
                                            'timezone': "Europe/Berlin",  
                                        }  
                                        uploaded_file = None  
                                        user_id, post = make_post(post_data, community, POST_TYPE_LINK if link else POST_TYPE_ARTICLE, SRC_API, auth="Bearer "+user.encode_jwt_token(), uploaded_file=uploaded_file)  
                                        session.commit()  
                                        logger.info(f"Posted {post.public_url()} {post.title}\n")  
                                    else:  
                                        for post in previous_posts:  
                                            if post.user_id == user.id:  
                                                post_data = {  
                                                    'title': post.title,  
                                                    'body': post.body,  
                                                    'url': post.url,  
                                                    'nsfw': post.nsfw,  
                                                    'notify_author': post.notify_author,  
                                                    'language_id': post.language_id,  
                                                    'timezone': post.timezone,  
                                                }  
                                                modified = False  
                                                z = re.match(r"^" + re.escape(title) + r"( (\[merged\]|\[closed\]|\[reopened\]))*$", post.title)  
                                                if not z:  
                                                    post_data['title'] = title  
                                                    modified = True  
                                                    logger.info(f"Post title edited: {post.public_url()} {title}")  
                                                if post.body != body:  
                                                    post_data['body'] = body  
                                                    modified = True  
                                                    logger.info(f"Post body edited: {post.public_url()} {title}")  
                                                if modified:  
                                                    user_id, post = edit_post(post_data, post, post.type, SRC_API, user, uploaded_file=None)  
                                                    session.commit()  
    
                                elif action == "merged" or action == "closed" or action == "reopened":  
                                    title = (feedname + " " + category + " #" + issue + ": " + description)[:220]  
                                    previous_posts = session.query(Post).filter(or_(Post.title.startswith(title), Post.url == link), Post.community_id == community.id, Post.user_id == user.id, Post.deleted == False)>  
                                    for post in previous_posts:  
                                        reply_data = {  
                                            'body': f"{action} {published} by {author}",  
                                            'notify_author': True,  
                                            'language_id': 2,  
                                            'distinguished': False,  
                                        }  
                                        previous_replies = post.replies.filter(PostReply.body == reply_data['body'], PostReply.user_id == user.id, PostReply.deleted == False).all()  
                                        if not previous_replies:  
                                            user_id, reply = make_reply(reply_data, post, None, SRC_API, auth="Bearer "+user.encode_jwt_token())  
                                            post.title = post.title + f" [{action}]";  
                                            flair = session.query(CommunityFlair).filter(CommunityFlair.flair == action, CommunityFlair.community_id == post.community_id).one_or_none()  
                                            if action == "merged" or action == "closed":  
                                                post.flair = list(filter(lambda f: f.flair != "open", post.flair))  
                                            elif action == "reopened":  
                                                post.flair = list(filter(lambda f: f.flair != "closed", post.flair))  
                                                post.title.removesuffix(' [closed] [reopened]')  
                                                flair = session.query(CommunityFlair).filter(CommunityFlair.flair == "open", CommunityFlair.community_id == post.community_id).one_or_none()  
                                            if flair:  
                                                post.flair.append(flair)  
                                                logger.info(f"flair {flair.flair} appended")  
                                            session.commit()  
                                            task_selector('edit_post', post_id=post.id)  
                                            logger.info(f"Post edited ({action}): {post.public_url()} {post.title}\n")  
                                elif action == "commented on":  
                                    x_link = re.match(r"^(?P<parentlink>\S+)(?P<commentid>#.+)$", link)  
                                    parent_link = x_link.group('parentlink')  
                                    parent_post = session.query(Post).filter(Post.url == parent_link, Post.community_id == community.id, Post.user_id == user.id, Post.deleted == False).first()  
                                    #content.removeprefix("prefix")  
                                    content = f"{link}\n{published} by {author}\n\n" + content.split("\n",2)[2]  
                                    if parent_post:  
                                        reply_data = {  
                                            'body': content,  
                                            'notify_author': True,  
                                            'language_id': 2,  
                                            'distinguished': False,  
                                        }  
                                        previous_reply = parent_post.replies.filter(or_(PostReply.body == reply_data['body'], PostReply.body.startswith(link)), PostReply.user_id == user.id, PostReply.deleted == Fals>  
                                        if not previous_reply:  
                                            user_id, reply = make_reply(reply_data, parent_post, None, SRC_API, auth="Bearer "+user.encode_jwt_token())  
                                            session.commit()  
                                            logger.info(f"Reply {reply.public_url()} {reply.body[:50]}\n")  
                                        else:  
                                            if previous_reply.user_id == user.id:  
                                                if previous_reply.body != reply_data['body']:  
                                                    user_id, reply = edit_reply(reply_data, previous_reply, parent_post, SRC_API, auth="Bearer "+user.encode_jwt_token())  
                                                    session.commit()  
                                                    logger.info(f"Comment edited: {previous_reply.public_url()} {previous_reply.body[:50]}\n")  
    
                                else:  
                                    logger.warning(f"Unknown action \"{action}\"")  
                            else:  
                                logger.warning(f"Unknown feed item \"{title}\"")  
    
                redis_client.set(f"plugins:{PLUGIN_NAME}:previous_time", datetime.now().timestamp())  
    
            notifications = session.query(Notification).filter(Notification.user_id == user.id, Notification.read == False).all()  
            for notification in notifications:  
                if notification.targets:  
                    post_id = notification.targets.get('post_id', 0)  
                    comment_id = notification.targets.get('comment_id', 0)  
                    if post_id and comment_id:  
                        print(f"Notification: {post_id} {comment_id}")  
                        post = session.query(Post).filter(Post.id == post_id, Post.deleted == False).one()  
                        if post.user_id == user.id and post.community_id in [999846]:  
                            parent_reply = post.replies.filter(PostReply.id == comment_id, PostReply.deleted == False).one()  
                            if parent_reply:  
                                reply_data = {  
                                    'body': "I'm a one-directional bot. Your replies will not be forwarded to Codeberg!",  
                                    'notify_author': True,  
                                    'language_id': 2,  
                                    'distinguished': False,  
                                }  
                                user_id, reply = make_reply(reply_data, post, parent_reply.id, SRC_API, auth="Bearer "+user.encode_jwt_token())  
                                session.commit()  
                                user.unread_notifications -= 1  
                                notification.read = True  
                                session.commit()  
                                logger.info(f"Reply {reply.public_url()} {reply.body[:50]}\n")  
    
        return None  
    
    
    def plugin_info():  
        """Plugin metadata"""  
        return {  
            "name": "Codeberg Crossposter",  
            "version": "0.0.1",  
            "description": "Experimenting with the plugin interface",  
            "license": "AGPL-3.0",                             # Must be AGPL-compatible  
            "source_url": "https://piefed.social/post/1306500",  # Required  
            "author": "hendrik"  
        }  
    
     

    The Wikipedia article says Cloudflare has been used to host hate speech, websites with illegal content and forums connected to all sorts of illegal activities. And I see them being used by a lot of decent webservices but shady ones as well.

    So my question, can Cloudflare be used for something alike "bulletproof hosting"? Does anyone know if they collaborate with law enforcement or care once someone sends a mail to the abuse contact? Or if there's a way to find information about a Cloudflare protected server for the public?

    Hypothetical question, I'm just curious and I thought maybe someone here has first-hand experience with getting their account terminated or reporting content or doing piracy via them or whatever...

    view more: next ›