951
16

Issue and PR threads are invaluable documentation for a project, it's difficult to migrate to another code host when years of knowledge are locked into your old hosting service. So I built a couple of scripts to archive issues, pull requests, comments, and source code from github repositories, and to turn them into static sites! With the accelerating exodus away from github, I've heard from a lot of people that there aren't any good tools for archiving that knowledge in a human-readable format, so I thought this would be a useful tool to make. The initial release is ready, and just in time for github to start charging for self-hosted runners!

If you try it out, let me know what you think. There's definitely areas that can be improved on :)

952
40
submitted 8 months ago* (last edited 8 months ago) by hellfire103@lemmy.ca to c/programming@programming.dev

I have always had a great deal of respect for C, and I would like to start writing in it. However, while I am skilled in other languages, I basically don't know any C off the top of my head.

I find that I learn better and faster by attempting projects, rather than working through a book ir taking a class. For example, to learn Perl, I am working on a basic disk image writer that's coming along nicely.

So, what do you think might be a good idea for my first C project?

EDIT: Zig is also something I'm interested in learning. Same question, different language.

953
36
submitted 8 months ago* (last edited 8 months ago) by HaraldvonBlauzahn@feddit.org to c/programming@programming.dev

This is a lightweight code editor which implements a concise yet powerful subset of vim commands, and adds support for multiple selections, by adding selection-based editing commands from plan 9's sam editor. The latter is nice for refactoring larger codebases. For example, one can define a selection for a variable name, add all its occurences, then visit each match to make sure a change does not shadow another name, and then change it all at once. That's great because I am a fan of good names, and since programs evolve and change, names should be changed, too!

What makes vis nice is that - in difference to vim descendants like kakoune - it remains still largely vim-compatible, so that one can easily continue to use vim (or even learn vim better, due to vis' magnificient concise man page ;-)).

Of course, kakoune is also powerful, light-weight, vim-like, and really nice, thanks to its visual support for multiple selections. But kakoune is (because of its "selection-command" 'editing language' syntax, different from vim's "command-selection" syntax) a big step away from vim - and my own experience is that it is hard to learn several of these "large" editors well, because they contain so many details one has to memorize, and which the human brain is gleefully happy to throw out after not using them for a few weeks. And for me, vim is already a (or more precisely the) secondary editor - I use it for quick tasks, git and jujutsu commit messages, embedded system and admin stuff, but not for writing large programs. And vim is an excellent match for these use cases, since it is basically installed everywhere.

954
19
955
9
submitted 8 months ago* (last edited 8 months ago) by monica_b1998@lemmy.world to c/programming@programming.dev
956
17
957
12

Imagine a free and open source software (FOSS) developer seeking to distribute an application on Apple’s iOS or iPadOS. The developer aims to have the software curated within a non‑profit, free software‑oriented repository, similar to F‑Droid on Android. This matters not only for the developer but also for users who want to avoid a distribution model where Apple controls how software is made available.

This is, indeed, only an imaginary scenario, since this isn’t possible on iOS or iPadOS. Apple offers no option for a non-profit or community-driven FOSS app store. The company actively blocks such initiatives through steep financial requirements and tight restrictions, preventing users from freely installing software. This issue was discussed during the 2024 Article 19 Digital Markets Act (DMA) Enforcement Symposium and even led to a formal complaint submitted by civil society groups in 2025.

958
70

What os? What ide? What plug-ins?

959
37

Hi all, much of what I have read recommends Android Studio to create Android apps, but I'm a bit wary since it's developed by Google. Are there any other good alternatives that are ideally open-source?

I am currently running Fedora 43 KDE, and I use VSCodium as my main code editor, mostly Python at the moment. Are there any plugins I could use to enable Kotlin support/specific Android dev stuff in VSCodium?

960
-13
961
62
GUI library for C? (lemmy.dbzer0.com)

There are some times that I make something and the terminal isn't enough. I want to make it user-friendly and add buttons and dropdowns and stuff. I mainly write C, so I want a well-known and good GUI library for C. I have tried learning Qt but the documentation was awful and all the examples were for C++ or Python. I also am aware about libraries like imgui but it's more for debugging UIs I think and not for normal applications that end users use.

I also would like the library to be platform-agnostic, or at least just work with Linux because that's what I am using.

If you also code in C, what do you use to make GUIs? What do you suggest me to use?

Thanks in advance.

Also, if anyone suggests Electron or anything involving a browser, I will find them and remove one electron from each atom of theirs, turning them into smoke.

962
51

So I'm learning python (by doing, reading, and doing some more), and I've been wanting to automate updating the listening port in my qbittorrent docker container when the gluetun vpn container changes the forwarded port.

This is what I came up with, which I combined with an hourly cronjob to keep it the listen port updated.

(Code under the spoiler tag to make this more readable).

Tap for spoiler

import re
import os
import logging
from datetime import datetime
from dotenv import load_dotenv

import docker
from qbittorrent import Client

# FUNCTION DECLARATION #


def log(code, message):
    logFilePath = "/opt/pyprojects/linux-iso-torrents/pf.log"
    logDateTime = datetime.today().strftime("%Y-%m-%d %H:%M:%S")
    message = f"[{logDateTime}] {message}"
    logger = logging.getLogger(__name__)
    logging.basicConfig(
        filename=f"{logFilePath}", encoding="utf-8", level=logging.DEBUG
    )
    match code:
        case "debug":
            logger.debug(message)
        case "info":
            logger.info(message)
        case "warning":
            logger.warning(message)
        case "error":
            logger.error(message)


def get_current_forwarded_port():
    client = docker.from_env()
    container = client.containers.get("a40124291102d")
    logs = container.logs().decode("utf-8")
    allPortForwards = re.findall(r".+port forwarded is [0-9]{5}", logs)
    currentForwardedPort = allPortForwards[-1].split(" ")[-1]

    return currentForwardedPort


def get_current_listening_port():
    qbConfigUrl = "/home/server/docker/qbit/config/qBittorrent/qBittorrent.conf"
    with open(qbConfigUrl) as f:
        config = f.read()
        qbitListenPort = re.search(r"Session\\Port=[0-9]{5}", config)
        currentListeningPort = qbitListenPort.group(0).split("=")[-1]

    return currentListeningPort


def update_qbittorrent_listen_port(port):
    QB_URL = os.getenv("QB_URL")
    QB_USER = os.getenv("QB_USER")
    QB_PASSWORD = os.getenv("QB_PASSWORD")
    portJSON = {}
    portJSON["listen_port"] = port
    qb = Client(QB_URL)
    qb.login(f"{QB_USER}", f"{QB_PASSWORD}")

    qb.set_preferences(**portJSON)


# BEGIN SCRIPT #

load_dotenv()

currentForwardedPort = get_current_forwarded_port()
currentListeningPort = get_current_listening_port()

if currentForwardedPort != currentListeningPort:
    update_qbittorrent_listen_port(currentPort)
    log("info", f"qbittorrent listen port set to {currentForwardedPort}")
else:
    log("info", "forwarded port and listen port are a match")

There's more I want to do, the next thing being to check the status of both containers and if one or both are down, to log that and gracefully exit, but for now, I'm pretty happy with this (open to any feedback, always willing to learn).

963
10
Cryptids (wiki.bbchallenge.org)
964
4
SLIC Superpixels (www.epfl.ch)
965
16
ML-KEM Mythbusting (keymaterial.net)
966
8
Dependency cooldowns, redux (blog.yossarian.net)
967
46
968
128

Share your cool programs!

969
12
970
5
The Bet On Juniors Just Got Better (tidyfirst.substack.com)
971
15
972
24

"React is once again urging developers to update immediately, as researchers have discovered two additional vulnerabilities in React Server Components while testing the previous patch. These bugs also affect Next.js, and likely other popular React frameworks.

The flaws are not as serious as the critical “worst case scenario” bug, disclosed last week, and do not allow for remote code execution. However, they enable attackers to perform denial-of-service attacks and expose source code."

973
60
974
86
975
12
view more: ‹ prev next ›

Programming

28304 readers
406 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS