Skip Navigation

Search

Advent Of Code @programming.dev
Ategon @programming.dev

Event Info + Post Guidelines + Code Formatting

Advent of Code is an annual Advent calendar of small programming puzzles that can be solved in any programming language you like.

Puzzles have a backstory and then a collection of different inputs with people getting a random input and needing to submit the corresponding output for the puzzle and their input to successfully complete it.

Puzzles start easy and get harder as the days go on. Every day has two different puzzles in increase in difficulty with you getting access to the second puzzle after solving the first.

Puzzles are released every day at midnight ET and can be completed anytime after they are released (but people who solve them quicker after they're been released get more points for the site leaderboard).

https://adventofcode.com/


What can I post here?

Anything relating to the event! Whether that be a meme, asking for help, sharing solutions, etc.

Every day a megathread will be posted that solutions to that day should go into. In the megathread you can post

Linux @lemmy.ml
captainkangaroo @discuss.tchncs.de

In a candid keynote chat at the Linux Foundation's Open Source Summit Europe, Linux creator Linus Torvalds shared his thoughts on kernel development, the integration of Rust, and the future of open source.

Terminal Emulators @lemm.ee
tun @lemm.ee

WezTerm - Wez's Terminal Emulator

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust

Features

  • Runs on Linux, macOS, Windows 10 and FreeBSD
  • Multiplex terminal panes, tabs and windows on local and remote hosts, with native mouse and scrollback
  • Ligatures, Color Emoji and font fallback, with true color and dynamic color schemes.
  • Hyperlinks
  • Searchable Scrollback (use mouse wheel and Shift-PageUp and Shift PageDown to navigate, Ctrl-Shift-F to activate search mode)
  • xterm style selection of text with mouse; paste selection via Shift-Insert (bracketed paste is supported!)
  • SGR style mouse reporting (works in vim and tmux)
  • Render underline, double-underline, italic, bold, strikethrough (most other terminal emulators do not support as many render attributes)
  • Configuration via a configuration file with hot reloading
  • Multiple Windows (Hotkey: Super-N)
  • Splits/Panes (Split horizontally/vertically: Ctrl-Shift-Alt-% and Ctrl-Shift-Alt-", move between pa
Terminal Emulators @lemm.ee
tun @lemm.ee

Rio Terminal

tl;dr: Rio is a terminal built to run everywhere, as a native desktop applications by Rust or even in the browser powered by WebAssembly.

Github - Homepage

As of 2024/09/01 - Web version is still WIP

Terminal Emulators @lemm.ee
tun @lemm.ee

Cosmic Terminal

cross-posted from: https://lemmy.ndlug.org/post/493535

This is cosmic-term, a very WIP project that takes the alacritty_terminal crate providing the majority of terminal code but rewrites the renderer to support additional features such as bidirectional text and ligatures. It will support both software and GPU rendering, and will have additional UI sugar provided by libcosmic as they are implemented.

cosmic-term

Gleam @programming.dev
ericjmorey @programming.dev

First impressions of Gleam: lots of joys and some rough edges

The blog post is the author's impressions of Gleam after it released version 1.4.0. Gleam is an upcoming language that is getting a lot of highly-ranked articles.

It runs on the Erlang virtual machine (BEAM), making it great for distributed programs and a competitor to Elixir and Erlang (the language). It also compiles to JavaScript, making it a competitor to TypeScript.

But unlike Elixir, Erlang, and TypeScript, it's strongly typed (not just gradually typed). It has "functional" concepts like algebraic data types, immutable values, and first-class functions. The syntax is modeled after Rust and its tutorial is modeled after Go's. Lastly, it

Programming Languages @programming.dev
armchair_progamer @programming.dev

First impressions of Gleam: lots of joys and some rough edges

The blog post is the author's impressions of Gleam after it released version 1.4.0. Gleam is an upcoming language that is getting a lot of highly-ranked articles.

It runs on the Erlang virtual machine (BEAM), making it great for distributed programs and a competitor to Elixir and Erlang (the language). It also compiles to JavaScript, making it a competitor to TypeScript.

But unlike Elixir, Erlang, and TypeScript, it's strongly typed (not just gradually typed). It has "functional" concepts like algebraic data types, immutable values, and first-class functions. The syntax is modeled after Rust and its tutorial is modeled after Go's. Lastly, it has a very l

Godot @programming.dev
Psyhackological @programming.dev

Where have you suffered some performance penalties using GDScript, and what was the fix? Was it to rewrite it in C#?

I'm curious because GDScript sounds like a very high and good abstraction for the engine.

Dynamic nature

Pros & cons of dynamic typing

GDScript is a Dynamically Typed language. As such, its main advantages are that:

  • The language is easy to get started with.
  • Most code can be written and changed quickly and without hassle.
  • Less code written means less errors & mistakes to fix.
  • The code is easy to read (little clutter).
  • No compilation is required to test.
  • Runtime is tiny.
  • It has duck-typing and polymorphism by nature.

While the main disadvantages are:

  • Less performance than statically typed languages.
  • More difficult to refactor (symbols can't be traced).
  • **Some errors that would typically be detec
GNU/Linux Gaming on Reddit @lemmit.online
Lemmit.Online bot @lemmit.online
BOT
This is an automated archive made by the Lemmit Bot.

The original was posted on /r/linux_gaming by /u/BENNYVIKS on 2024-06-07 12:17:55+00:00. *** There is a new Non EAC Server

This is for linux players, or anyone else who wants to join. Do not worry about EAC being disabled as we have multiple anti-cheat plugins, including active admins.

Because of no EAC, server must be joined through console.

Press F1 in game and type [b]connect node4.spillhosting.no:28194[/b]

2x Vanilla ++ QuickCraft Optimized Loot Active admin

Linux @lemmy.ml
boredsquirrel @slrpnk.net

List of useful BTRFS tools

The list is maintained here

::: spoiler Here is the possibly outdated state of that time

General

BTRFS CLI Interface

btrfs-progs

official userpace utilities

BTRFS Assistant

Tool for doing many BTRFS actions graphically

It requires snapper and offers a GUI for it.

butter-manager

Tool for managing snapshots, balancing filesystems and upgrading the system safetly.

Backups & Snapshots

btrbk

Code Review @programming.dev
TypicalHog @lemm.ee

Implementation of an algorithm I invented - RANDEVU

I came up with an algorithm and implemented it in Rust.
I want to ensure the code is of sufficient quality before releasing it on Crates.io and GitHub. You can also find more info about the algorithm and its purpose there.

I'm eager to hear your feedback and thoughts and am open to ANY suggestions that may help me improve the code further.
The code should be performant, clean, easy to use, idiomatic, etc.
I'm also looking for potentially better names for certain variables and stuff.

Note that some things have changed a bit since the last release (for example - the hash calculation has been changed from blake3(blake3(OBJECT) || blake3(DATE)) to blake3::keyed_hash(DATE, OBJECT) to improve performance by eliminating 2 out of 3 hash calculations), but the README is still valid (and hopefully at least somewhat decent source of info about the algorithm - I did my best trying to explain stuff, but I'm

Learning Rust and Lemmy @lemmy.ml
maegul (he/they) @lemmy.ml

Thoughts, Questions and Confusions about the Sum trait

Intro

I'm not on top of traits or generics but found myself looking some of them up anyhow, and came across the Sum trait.

Here is the Std Lib documentation on Sum (I believe).

And I guess all of the generics and/or type logic and how they interoperate has thrown me for a bit of a spin ... so I thought I'd put my thoughts here. Maybe I'll work things out in writing it or maybe someone here can help me/us out?

A bit long ... sorry


Trait Definition

From the docs and source, here is the trait's signature:

 rust
    
// core::iter::Sum
pub trait Sum<A = Self>: Sized {
    // Required method
    fn sum<I: Iterator<Item = A>>(iter: I) -> Self;
}

  

First thoughts: Defined on elements not iterators?

  • The part that confused me at first was what Self is actually. Naively, I imagined it was referring to the iterator (or type that'd implemented Iterator) ... but that clearly can't be true because the return
Learning Rust and Lemmy @lemmy.ml
maegul (he/they) @lemmy.ml

TIL: All let statements use patterns

A minor but interesting and illuminating point came up in a conversation that I thought was worth sharing, for those learning rust, in a separate post. I'm mostly just copy-and-pasting here.


TL;DR: The patterns you use in match statements and related syntax are (basically) available to you in let statements. This is how destructuring works!! And what they're for with let. But the patterns have to be "irrefutable" --- IE, they have to always be able to match the expression/value.


For those who aren't aware, here's the first section in The Book on patterns in let statements.

I think, if this is confusing, there are two points of clarification:

  1. All let statements involve patterns (as Ephera states). They're all let PATTERN = EXPRESSION.
    • For ord
Learn Programming @programming.dev
maegul (he/they) @lemmy.ml

Ownership in match statements on multiple variables

cross-posted from: https://lemmy.ml/post/13353225

Quick little confusion or even foot-gun I ran into (while working on the challenge I posed earlier).

TLDR

My understanding of what I ran into here:

  • Matching on multiple variables simultaneously requires assigning them to a tuple (?),
  • which happens more or less implicitly (?),
  • and which takes ownership of said variables.
  • This ownership doesn't occur when matching against a single variable (?)
  • Depending on the variables and what's happening in the match arms this difference can be the difference between compiling and not.

Anyone got insights they're willing to share??

Intro

I had some logic that entailed matching on two variables. Instead of having two match statements, one nested in the other, I figured it'd be more elegant to match on both simultaneously.

An inline tuple seemed the obvious way to do so and it works, but it seems that

Code Review @programming.dev
tinkralge @programming.dev

Simple predictive text review

I wrote a simple algorithm for predictive text that uses preceding words as context. Without looking at prior, it was an attempt as seeing what I could come up with.

The goal is for it to be incorporated in chorded input and pick the best candidate for the entered chord with the given context. Chorded input is the method of hitting all keys for a word simultaneously instead of hitting each key individually in expected order.

E.g you've typed "this is the worst" and hit the chord "aet", which word should be chosen? ate? tea? eta? This algorithm is there to answer that.

What I'm looking for in the code review in order of importance:

  • documentation (is it understandable? are there things missing? ...)
  • code architecture, code structure (function should be a member? composition could be changed? clarity, ...)
  • algorithm review (optimisations, improvements)
  • variable and class names (naming things is hard)
  • rust specific stuff (f64 instead of u32 maybe? dyn vs impl? ...)

The c

About Lemmit @lemmit.online
admin @lemmit.online

List of communities.

Since it's impossible to see all the communities on here without logging in (mandatory NSFW filter), and I'm the only one with an account on here, here's a list of them. This list will be a snapshot, so the subscriber count will not be up to date, but I'm sure you'll figure it out.

Ident NSFW Subscribers
1000ccplus NSFW 14
2000ccplus NSFW 8
2007scape 13
2137 41
2meirl4meirl 29
2westerneurope4u 254
3dprinting 90
80sdesign 64
90sdesign 54
AskReddit 222
[Boise](https://lemmit.online/c/Boise
Hacker News @derp.foo
haxor @derp.foo
BOT

Remove my name from the project

There is a discussion on Hacker News, but feel free to comment here as well.

Programming @programming.dev
Jerti @lemmy.world

Programming communities already exist

Hello everyone, I was wondering why did we create another programming community besides the existing ones?

programming

programmerhumor

rust

I'm sorry if this was already answered, I didn't manage to find a relevant post.

Voxel Game Dev @programming.dev
G0ldenSp00n @lemmy.jacaranda.club

GVox Reusable Voxel Model Importer

A reusable voxel model importer, written in C++ with a wrapper for Rust

Programming @beehaw.org
Gork @beehaw.org

Why code in text like a peasant when you can code using emojis

Why use pi when you can use 🥧

 undefined
    
fn main() {
    let pi_emoji = "🥧";
    let pi_value = 3.1415926535897932384626433832;

    println!("Let {} {:.28}", pi_emoji, pi_value);
}