Programming

26353 readers
106 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 2 years ago
MODERATORS
951
952
 
 

TLDR: I created a script that blocks accounts (bots) that mass follow other accounts.

Recently, Ive been noticing an uptick in followers to my account. Which is awesome....except they all seem to be bots. All the bots have a few things in common:

  1. They all have basically no GitHub contributions other than a couple of forks of popular projects.
  2. They mass follow people (think like 10k or more people).

Theres a couple of theories floating around on why these accounts are doing this, but here are a couple of ideas others have given:

https://www.reddit.com/r/github/comments/1dlslpj/what_is_the_point_of_github_follow_bots/

But either way, i decided to see how many of these bots were attached to my account. So I looked for accounts that had more than 5000k followers (which is about 10x times the number of follows I gave out). I found that around 20% of all accounts that followed me were bots. I then rigged up a block and vola! It removed 30 accounts first run and is set to run every night on a GH action.

In order to use you can fork, get the GH Token, and then it auto-blocks the accounts. Feel free to comment out the block if you want to see what a dry run looks like.

I hope GitHub themselves will start doing something about these accounts. But for now, my script seems to work.

Mirror is here: https://yuno.chrisco.me/git/michael/anti-mass-follow-bot in case the github link dies someday.

953
 
 

GitHub

Theia IDE is compatible with VS Code APIs and can install and use VS Code extensions. Has additional APIs for customizations not available in VS Code.

Have you tried Theia IDE? Any assessments or experiences to share?

954
955
956
 
 

Like every major GCC release, this version will bring many additions, improvements, bug fixes, and new features. GCC 15 is already the system compiler in Fedora 42. Red Hat Enterprise Linux (RHEL) users will get GCC 15 in the Red Hat GCC Toolset. It's also possible to try GCC 15 on Compiler Explorer and similar pages.

This article describes only new features implemented in the C++ front end; it does not discuss developments in the C++ language itself.

The default dialect in GCC 15 is still -std=gnu++17. You can use the -std=c++23 or -std=gnu++23 command-line options to enable C++23 features, and similarly for C++26 and others.

957
 
 

The GCC developers are pleased to announce the release of GCC 15.1.

The C frontend now defaults to the GNU C23 dialect. Some code needs porting for this. Some remaining C23 features have been implemented, as well as some new C2Y features.

The C++ frontend now implements several further C++26 features, some missing C++23 bits, and defect report resolutions. The libstdc++ library now notably experimentally supports std and std.compat modules, more algorithms usable in constexpr functions, flat maps and sets, and std::format support for containers and other ranges.

GCC now implements the Clang [[clang::musttail]] and [[clang::flag_enum]] attributes and their GNU counterparts with the same meaning for the C family language frontends. Support for new counted_by and nonnull_if_nonzero attributes has been added too.

The Fortran frontend has experimental support for unsigned integers.

GCC 15.1 has new COBOL frontend, so far supported only on a few 64-bit targets.

OpenMP support now includes metadirectives, tile and unroll constructs, interop construct and dispatch construct.

The vectorizer can now vectorize loops with early exits when array or buffer sizes aren't statically known. At -O2 can now vectorize some cheaply vectorizable loops with unknown tripcount.

Some code that compiled successfully with older GCC versions might require source changes, see Porting to GCC 15 for details.

For details see GCC 15 Release Series Changes, New Features, and Fixes).

958
 
 
959
 
 

Undefined Behavior in C and C+- is often exploited by compilers for optimization. Therefore, it is frequently believed that permitting Undefined Behaviour makes such programs faster, even if the architectures of today's hardware are wildly different from the tiny and bare-bones CPUs these languages were once developed for, fifty years ago.

This study examines whether this is the case, by disabling many of such optimizations in clang and running a wide range of "optimized" and "unoptimized" benchmarks on Intel, AMD, and ARM architectures.

The general result is that while there are differences, the benchmarks do not run significantly faster with "optimizations". A slowdown was observed on ARM - only if no link time optimization (LTO) was used. Averaged ifferences even with all "ub-based optimizations" enabled or disabled were typically below 2%, which is at the noise threshold.

There were also many cases where "UB-optimizations" made programs perform worse.

There were exceptions found to this general summary, and the causes for this were tracked down and explained.

Considering all that, the performance impact of permitting UB appears to be... a myth?

960
 
 

Some thoughts/predictions about how open source developers will be forced to choose their path with GenAI.

Full disclaimer: my own post, sharing for discussion and to find out if anyone has any brilliant ideas what else could be done. It looks like self-posts are okay here but let me know if I'm wrong about that.

961
 
 
962
963
46
Git without a forge (www.chiark.greenend.org.uk)
964
965
 
 

It seems that GitHub is being blocked in my region as well as other options from U.S. based companies (e.g. GitLab)

Where should I migrate my repos? Codeberg is an option as it’s Europe based so isn’t blocked in my region. Codeberg Pages is also nice to have. However, Codeberg seems to push for excluding proprietary software dependencies, which might limit the kinds of projects I can do.

Another option is to self-host Gitea, I could use my old laptop for that. Gitea doesn’t have a GitHub pages, but there seems to be third-party plugins that allow that. The downside with self-hosting (for me) is that it means I’m unable to collaborate with others (since it’ll be local) and I can’t easily share my projects. It will also probably be harder to set up.

What other options are there, or are these two the best options for me?

edit: decided on Codeberg, how do I make my static pages to work with Codeberg Pages? I've switched to a "pages" branch and the website doesn't work (https://username.codeberg.page/repo-name/)

How do I make static pages work with Codeberg???

966
967
968
 
 

https://github.com/thingsiplay/crc32sum

# usage: crc32sum [-h] [-r] [-i] [-u] [--version] [path ...]

crc32sum *.sfc
2d206bf7  Chrono Trigger (USA).sfc

Previously I used a Bash script to filter out the checksum from 7z output. That felt always a bit hacky and the output was not very flexible. Plus the Python script does not rely on any external module or program too. Also the underlying 7z program call would automatically search for all files in sub directories recursively when a directory was given as input. This would require some additional rework, but I decided it is a better idea to start from scratch in a programming language. So I finally wrote this, to have a bit better control. My previous Bash script can be found here, in case you are curious: https://gist.github.com/thingsiplay/5f07e82ec4138581c6802907c74d4759

BTW, believe it or not, the Bash script running multiple commands starts and executes faster than the Python instance. But the difference is negligible, and the programmable control in Python is much more important to me.


What is this program for?

Calculates the CRC hash for each given file, using Python's integrated zlib module. It has a similar use like MD5 or SHA, but is way, way weaker and simpler. It's a quick and easy method to verify the integrity of files, in example after downloading from the web, to check data corruption from your external drives or when creating expected files.

It is important to know and understand that CRC-32 is not secure and should never be used cryptographically. It's use is limited for very simple use cases.

Linux does not have a standard program to calculate the CRC. This is a very simple program to have a similar output like md5sum offers by default. Why use CRC at all? Usually and most of the time CRC is not required to be used. In fact, I favor MD5 or SHA when possible. But sometimes, only a CRC is provided (often used by the retro emulation gaming scene). Theoretically CRC should also be faster than the other methods, but no performance comparison has been made (frankly the difference doesn't matter to me).

969
 
 

Healthy open source communities don’t just form around code, but also around shared values and a vision for how their work can improve the world. The true measure of the success of open source is its impact— how the technologies we develop are leveraged to bring about positive social, cultural, and political change.

970
971
 
 

cross-posted from: https://lemmy.world/post/28442844

cross-posted from: https://lemmy.world/post/28384872

This is a showcase of combining vibe coding with the Fediverse and attempto controlled english (ace).

I'm fascinated by vibe coding, but I'm also highly critical of it. It fascinates me, because it enables people, who normally cannot code to be able to generate running code. What I don't like, is that it just isn't actual programming. It's closer to a wishing well. It fosters a quasi-magical understanding of programming and computer science, which is already too common in current society (I wrote a paper about it here: https://philpapers.org/rec/BINAKR). That's why, in my opinion, the Fediverse should set a counter-point here with something like a first-order logic language like ACE, which actually brings people closer to an actual understanding of computer science concepts like modeling and logic without hiding the complexity behind seemingly "magic", and could also result in better code.

The above demo shows a glimpse of how this could look like on the Fediverse. Imagine communities being able to form their own spaces on the social web through language! Simply using natural language will probably not be specific enough here. We always imagine everything getting much easier, but that's just the logic of digital capitalism that tries to sell us innovation as inventing yet a more easy way to get your coke handed to you, which can only lead to more and more environmental destruction. So, what will the language interface for the future digital look like? I think it will be more something like the semi-formalic language found in technical manuals, cooking recipes and judicial texts. Something like ace, in between coding, domain specific languages, modeling and natural language. And people who are experts at this and know the old technical stuff that no one understands anymore will be the new "coders". But maybe I'm wrong.

Repo: https://github.com/bluebbberry/AceCoding.social.

972
973
22
Making Software (www.makingsoftware.com)
submitted 11 months ago by who@feddit.org to c/programming@programming.dev
974
 
 

I made something to try out for "funtional webcomponents" with vanillaJs. I'm working towards a UI framework for my personal projects. It's far from finished but i thought it might be an interesting concept to share.

975
view more: ‹ prev next ›