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/)SH

To share AI output.

Members
2
Posts
16
Active Today
1
Created
2 yr. ago
  • ShareGPT @lemmy.fmhy.ml
    GodOfThunder @lemm.ee

    who popularized breakfast

    The history of breakfast is a complex one, with different foods and customs evolving over time. Here are some key points from the search results:

    • In Ancient Egypt, peasants ate a daily meal, most likely in the morning, consisting of soup, beer, bread, and onions before they left for work in the fields or work commanded by the pharaohs[1].
    • Prior to the 16th century, breakfast in Great Britain typically included bread, cold meat or fish, and ale. Tea, chocolate and coffee were introduced to Great Britain in the 16th century, and by the 1550s, there were multiple sources that claimed breakfast was an important meal[1].
    • Historian Ian Mortimer suggests the Tudors invented modern breakfasts in the 16th century as a side-effect of inventing the concept of employment. As people increasingly came to work for an employer, rather than working for themselves on their own land, they lost control of their time, and had to work long, uninterrupted days without sustenance. A big breakfast allow
  • ShareGPT @lemmy.fmhy.ml
    GodOfThunder @lemm.ee

    Why is the "I have nothing to hide" argument flawed?

    1. Privacy is about protecting information: Privacy is not just about hiding information, but rather about protecting it. Even if you think you have nothing to hide, there may still be information that you would like to keep private, such as personal conversations, financial transactions, or medical records[1].
    2. Data can be used against you: Even seemingly insignificant pieces of personal data can be used in ways you may not anticipate. Companies can use your data to build detailed profiles about you, which can be used for targeted advertising, price discrimination, or even manipulation[1].
    3. Potential for abuse: When your data is collected and stored by companies or governments, there is always the risk of it being misused or falling into the wrong hands. Data breaches and leaks are common, and your personal information could be exposed, leading to identity theft or other forms of harm[1].
    4. Chilling effect on freedom: Mass surveillance and the erosion of privac
  • ShareGPT @lemmy.fmhy.ml
    GodOfThunder @lemm.ee

    vscode enforce python type annotation

    To enable Python type checking in Visual Studio Code, you can use the Microsoft extension Pylance[1]. Pylance provides a set of useful features powered with Pyright, the Microsoft static type checking tool. With the extension installed and enabled, you should now have better IntelliSense with typing information when you are calling some package function, for example. For the type checking analysis, it is not enabled by default, you need to configure it by yourself. In your settings.json file, add a new line with the following setting:

     json
        
    { "python.analysis.typeCheckingMode": "basic" }
    
      

    The default value for this line is off, meaning the type checking is disabled. You can also set the value to "strict" or "off" depending on your needs[1].

    Alternatively, you can use the Python Type Hint extension from the Visual Studio Marketplace[2]. This extension provides type hint auto-completion for Python, with completion items for built-in types, classes, and the typing module. It also

  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    Tingling and palpitations spreading throughout the body

    The tingling and palpitations that have been spreading throughout the body can be caused by several conditions. Here are some possibilities based on the search results:

    • Episodic Neurologic Symptoms: Patients with this condition usually complain of severe apprehension, dizziness, chest discomfort, palpitations, or fear of "losing control." The onset is usually under age 40[1].
    • Heart Attack or Panic Attack: Both conditions can cause chest pain, shortness of breath, dizziness, sweating, passing out, tingling, or a sensation of impending doom. These shared symptoms of heart and panic attack may also be caused by other serious conditions such as blood clots, lung infection or collapse, or tear in the large vessels of the chest for patients with certain pre-existing risk factors[2].
    • Atrial Fibrillation: The most obvious symptom of this condition is heart palpitations, where the heart feels like it's pounding, fluttering, or beating irregularly, often for a few seconds or
  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    How to download a website for offline browsing using wget?

    To download a website for offline browsing using wget, you can use the following command:

     bash
        
    wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains example.com --no-parent http://www.example.com
    
      

    Replace example.com with the website you want to download. This command will download the entire website, including all the elements that compose the page (images, CSS, etc.), and convert the links so that they work locally and offline[1].

    Here's a brief explanation of the options used in the command:

    • --recursive: Download the entire website recursively.
    • --no-clobber: Don't overwrite existing files.
    • --page-requisites: Download all the elements required to display the page properly (images, CSS, etc.).
    • --html-extension: Save files with the .html extension.
    • --convert-links: Convert links so that they work locally and offline.
    • --restrict-file-names=windows: Modify filenames so that they wor
  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    limit python requests to 1.39 requests per second

    To limit your Python requests to 1.39 requests per second, you can use the time.sleep() function from the time module to introduce a delay between requests. You can also use third-party libraries like pyrate-limiter, requests-ratelimiter, or ratelimiter to achieve rate limiting.

    Here's an example using the time module:

     python
        
    import requests
    import time
    
    urls = [...]  # List of URLs to send requests to
    
    for url in urls:
        response = requests.get(url)
        print(response.status_code)
        time.sleep(1 / 1.39)  # Introduce a delay to achieve 1.39 requests per second
    
      

    Alternatively, you can use the pyrate-limiter library:

     python
        
    from pyrate_limiter import Duration, RequestRate, Limiter
    import requests
    
    rate_limit = RequestRate(1, Duration.SECOND / 1.39)  # 1 request per 1.39 seconds
    limiter = Limiter(rate_limit)
    
    urls = [...]  # List of URLs to send requests to
    
    for url in urls:
        with limiter:
            response = requests.get(url)
            print(response.status
      
  • ShareGPT @lemmy.fmhy.ml
    GodOfThunder @lemm.ee

    How to Get a List of All Issues for a Repo from the GitHub API using a Personal Access Token?

    To get a list of all issues for https://github.com/LemmyNet/lemmy from the GitHub API, you can use the following steps:

    1. First, you need to obtain a personal access token from GitHub. You can follow the instructions given in this link to create a personal access token: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
    2. Once you have obtained the personal access token, you can use it to authenticate your requests to the GitHub API. You can use any HTTP client library to make requests to the GitHub API. In this example, we will use the requests library in Python.
    3. To get a list of all issues for https://github.com/LemmyNet/lemmy, you can make a GET request to the following URL:
     undefined
        
    https://api.github.com/repos/LemmyNet/lemmy/issues
    
      
    1. You need to pass the personal access token as a header in the request. The header should be of the form:
     undefined
        
    Authorization: Bearer <personal-access-token>
    
      

    Here's an example

  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    How to avoid defining sqlite3 conn and cursor in many functions across the code?

    To avoid defining the sqlite3.Connection and sqlite3.Cursor in many functions throughout your code, you can use the following approaches:

    1. Use 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 (?, ?, ?, ?)",
                (is
      
  • ShareGPT @lemmy.fmhy.ml
    GodOfThunder @lemm.ee

    Write script to repost github issues on lemmy

    Use pythorhead (https://github.com/db0/pythorhead) to write a python script to write every github issue from https://github.com/LemmyNet/lemmy and https://github.com/LemmyNet/lemmy-ui to https://lemm.ee/c/issue_tracker

    Follow this template for the posts

    URL: https://github.com/LemmyNet/lemmy-ui/issues/number

    Title: [UI][Feature Request] Title

    Body: Use CommonMark markdown to quote the body and add a line saying:

    Originally posted by user in #1930

    Edit: the fixed script is here

  • ShareGPT @lemmy.fmhy.ml
    GodOfThunder @lemm.ee

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

    Bash-like scripting has become ubiquitous in operating systems, and it makes me wonder about its widespread adoption despite lacking certain programming conveniences found in other languages. While it may not be the ideal choice for large-scale software development, the bash shell possesses unique features that make it well-suited for interactive command-line processing, including pipelining, text manipulation, and file handling. Why isn't there an alternative that combines the best of bash's command-line capabilities with the robustness and scalability of traditional programming languages. Why do even new operating systems, such as Redox OS, opt for a similar syntax rather than a completely different programming language?

    Here are some of the limitations I find in Bash compared to other programming languages:

    1. Syntax and Expressiveness:
      • Bash has a relatively simple syntax compared to other programming languages. It lacks some advanced language features such as object-oriented
  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    Price of insulin in China, Cuba, Laos, North Korea, and Vietnam?

    Information on the price of insulin in China, Cuba, Laos, North Korea, and Vietnam is not readily available in the search results. However, there is information on the cost of insulin in some other countries. According to the World Population Review, the cost of insulin varies widely by country, with the United States having the highest prices[1]. In 2018, RAND Corporation reported that the manufacturer price for any given type of insulin averaged five to ten times higher in the United States than in all other OECD countries[1]. Novo Nordisk, a major insulin manufacturer, has recently slashed the price of insulin in the United States[3].

    A study published in PMC in 2019 examined the prices, availability, and affordability of insulin in 13 low-income and middle-income countries. The study found that median procurement prices of human insulins across the countries ranged from $4.56 to $5.30, with large price variations seen across the countries[4]. The highest prices were found in two

  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    Find fast Lemmy instances

    To improve the given script using asyncio, you can use the aiohttp library for making asynchronous HTTP requests. Here's the modified version of the script:

     python
        
    #!/usr/bin/env python3
    import json
    import asyncio
    import aiohttp
    import time
    
    from typing import List, Dict
    
    TIME_BETWEEN_REQUESTS = 5
    TIME_TOTAL = 60
    
    
    async def get_latency(session, domain):
        try:
            start = time.time()
            if not domain.startswith(("http://", "https://")):
                domain = "https://" + domain
            async with session.get(domain, timeout=3) as response:
                end = time.time()
                return end - start
        except asyncio.TimeoutError:
            return float("inf")
        except aiohttp.client_exceptions.ServerDisconnectedError:
            return float("inf")
    
    
    def add_latency_to_domain(domain, latency, latencies):
        if domain not in latencies:
            latencies[domain] = []
        latencies[domain].append(latency)
        return latencies
    
    
    async def measure_latencies_for_domains(sessio
      
  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    Enhancing the Lemmy Experience: Weighted Community Preferences for a Better Subscribed Feed

    As a frequent user of Lemmy, I've noticed an issue that affects my browsing experience, particularly in my Subscribed feed. Currently, the platform does not allow users to view more content from specific communities they prefer over others. This limitation forces users to unsubscribe from larger communities to see more content from their favorite ones[1].

    To improve the user experience, I propose the implementation of weighted community preferences. This feature would enable users to assign a weight to each community they are subscribed to, allowing them to see more content from their preferred communities in their Subscribed feed. By doing so, users can enjoy a more personalized browsing experience without having to unsubscribe from larger communities.

    This feature would address the issue of larger communities dominating the Subscribed feed, which has been reported by other users as well[1]. By giving users the ability to control the prominence of specific communities in the

  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    ELI5 Dead Internet Theory

    The Dead Internet theory is an online conspiracy theory that suggests that the internet is now primarily composed of bot activity and algorithmically generated content, which marginalizes organic human activity[0]. It is believed that intelligent bots are being used to manipulate algorithms and boost search results, ultimately influencing consumers. This theory emerged in the late 2010s or early 2020s and gained traction among technology enthusiasts, researchers, and futurists who were concerned about the increasing complexity and potential risks associated with our reliance on the internet[0].

    The origins of the Dead Internet theory are difficult to pinpoint, but some attribute its emergence to a thread titled "Dead Internet Theory: Most Of The Internet Is Fake" on the forum Agora Road’s Macintosh Cafe in 2021[0]. The theory gained more attention through coverage on various YouTube channels and an article in The Atlantic titled "Maybe You Missed It, but the Internet ‘Died’ Five

  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    Balancing Scores on Lemmy: Exploring Options for Fairness and Relevance

    Hello fellow Lemmy users and enthusiasts!

    Today, we want to dive into the topic of balancing scores on Lemmy and discuss some of the different options that have been proposed. We'll cover the suggestions mentioned in the official GitHub repository[^1026], as well as some additional ideas that could contribute to a fair and relevant scoring system.

    1. Affinity to Admin: One of the proposed options is to increase the weight of votes based on the user's affinity to the admin[^1026]. This means that the content of the instance would be most relevant to the admin, incentivizing self-hosting Lemmy. This approach aims to prioritize the preferences of the admin, potentially resulting in a more tailored and focused community for that particular instance.
    2. Score Posts based on Community Size: Another suggestion put forward in the GitHub repository is to score posts based on the community size at the time of voting[^2794]. This approach takes into account the number of users in a community w
  • ShareGPT @lemmy.fmhy.ml
    InternetPirate @lemmy.fmhy.ml

    Write a script that reposts all my youtube subscription videos with above average popularity on lemmy using Python

    To repost all your YouTube subscription videos with above-average popularity on Lemmy using Python, you'll need to follow these steps:

    1. Get a YouTube API key[1].
    2. Use the YouTube API to fetch your subscription videos[2].
    3. Determine the popularity threshold (e.g., average views, likes, or comments).
    4. Filter the videos based on the popularity threshold.
    5. Use Pythorhead to interact with Lemmy and post the filtered videos[3].

    Here's a sample Python script to achieve this:

     python
        
    import requests
    from pythorhead import Lemmy
    
    # Replace with your YouTube API key and Lemmy credentials
    YOUTUBE_API_KEY = 'your_youtube_api_key'
    LEMMY_USERNAME = 'your_lemmy_username'
    LEMMY_PASSWORD = 'your_lemmy_password'
    
    # Fetch your YouTube subscription videos
    def get_youtube_subscriptions(api_key):
        # Replace with your YouTube channel ID
        channel_id = 'your_youtube_channel_id'
        url = f'https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&channelId={channel_id}&maxResults=50