Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)G
Posts
34
Comments
35
Joined
3 yr. ago

  • A context manager: Create a context manager that handles the connection and cursor creation, as well as closing the connection when done. This way, you can use the with statement to manage the connection and cursor in your functions.

     python
        
    import sqlite3
    
    DB_FILE = "your_database_file.db"
    
    class DatabaseConnection:
        def __enter__(self):
            self.conn = sqlite3.connect(DB_FILE)
            self.cursor = self.conn.cursor()
            return self.cursor
    
        def __exit__(self, exc_type, exc_val, exc_tb):
            self.conn.commit()
            self.cursor.close()
            self.conn.close()
    
    def insert_post_to_db(issue: Issue, lemmy_post_id: int) -> None:
        with DatabaseConnection() as cursor:
            cursor.execute(
                "INSERT INTO posts (issue_url, lemmy_post_id, issue_title, issue_body) VALUES (?, ?, ?, ?)",
                (issue.url, lemmy_post_id, issue.title, issue.formatted_body),
            )
    
      
  • This is so cool. It's exactly what I had in mind when thinking of a modern bash alternative.

  • Github style:

     
        
    > If you need to find a post, don't use search engines or indexers, use lemmy's own search page, which allows you to filter by community if you wish. Its been a concious decision from the beginning to not favor SEO over simple urls.
    > 
    > *Originally posted by @dessalines in [#839 (comment)](https://github.com/LemmyNet/lemmy-ui/issues/839#issuecomment-1304368786)*
    
      

    Result:

    If you need to find a post, don't use search engines or indexers, use lemmy's own search page, which allows you to filter by community if you wish. Its been a concious decision from the beginning to not favor SEO over simple urls.

    Originally posted by @dessalines in #839 (comment)

  • I don't care about the Bible, it's just an expression. I think.

  • Books @lemmy.ml

    Non-fiction books that are like the Bible to you? Books that you've checked to remember some facts a few times as opposed to reading them for pleasure.

  • No Stupid Questions @lemmy.world

    Non-fiction books that are like the Bible to you? Books that you've checked to remember some facts a few times as opposed to reading them for pleasure.

  •  
        
    > *[@username](profile_link)* said:
    >
    > > Original quote from the person
    >
    > Source: [Link to the source](source_link)
    
      

    For example:

     
        
    > [@GodOfThunder@lemm.ee](https://lemm.ee/u/GodOfThunder) said:
    >
    > > How would you quote someone using CommonMark markdown syntax?
    >
    > [Source](https://lemm.ee/post/1063209)
    
      

    Result:

    @GodOfThunder@lemm.ee said:

    How would you quote someone using CommonMark markdown syntax?

    Source

  • No Stupid Questions @lemmy.world

    How would you quote someone using CommonMark markdown syntax?

  • Open Source @lemmy.ml

    Seeking an Open Source Alternative to Element Chat for Cross-Platform Communication

  • Let's all sit down and wait, cross our fingers and do nothing. That will probably fix everything.

  • You are simply anthropomorphizing AGI. Superintelligence will be highly capable, but it is unlikely to possess consciousness, values or its own goals, similar to humans. Once given a goal, if it requires extensive resources and the AGI is not properly aligned, it may inadvertently cause harm to humanity in its pursuit of gathering the necessary resources to achieve its objective, much like humans constructing roads without concern for ants.

  • Singularity | Artificial Intelligence (ai), Technology & Futurology @lemmy.fmhy.ml

    Will Superintelligent AI End the World? | Eliezer Yudkowsky | TED (video 11.07.2023)

  • .

  • Linux @lemmy.ml

    Why are we stuck with bash programming language in the shell?

  • Which is why we should make the implementer's job easier by providing only the relevant information instead of wasting their time with a flood of comments on the issue tracker.

  • Shower Thoughts @kbin.social

    Moving Issue Discussions to Lemmy would Enhance Collaboration and Prioritization

  • Showerthoughts @lemmy.world

    Moving Issue Discussions to Lemmy would Enhance Collaboration and Prioritization

  • Android @lemmy.ml

    Which Phones Similar to Xiaomi Mi 9T Are Likely to Get Lineage OS Updates Many Years After Launch?

  • Singularity | Artificial Intelligence (ai), Technology & Futurology @lemmy.fmhy.ml

    What will GPT-2030 look like? (07.07.2023)

    bounded-regret.ghost.io /what-will-gpt-2030-look-like/
  • I think Israel has too much of an upper hand there to ever leave. It's only a matter of time before they make smaller and cheaper drones that they can release as a swarm.

  • I think Israel has too much of an upper hand there to ever leave. It's only a matter of time before they make smaller and cheaper drones that they can release as a swarm.

  • I think Israel has too much of an upper hand there to ever leave. It's only a matter of time before they make smaller and cheaper drones that they can release as a swarm.

  • World News @lemmy.ml

    Unveiling the Dystopian Israeli Suicide Drone Lanius: Company Elbit Systems Markets 'Battle-Tested' Lethal Weapons Against Palestinians (video)

  • World News @lemmy.world

    Unveiling the Dystopian Israeli Suicide Drone Lanius: Company Elbit Systems Markets 'Battle-Tested' Lethal Weapons Against Palestinians (video)

  • So use NewPipe.