Camille

joined 2 years ago
[–] Camille@lemmy.ml 0 points 1 month ago

La France qui jalouse la montée du fascisme aux USA et qui a décidé de speedrun nazi 100% all bosses all items.

Après, y a un monde où ils vont cramer tellement de cartouches nazies complètement dingues si vite que ça va dégoûter la masse avant 2027. Laissez-moi rêver un peu

[–] Camille@lemmy.ml 6 points 2 months ago

I've seen so many IT projects, associations, communities of minorities using discord in lieu of wikis, forums, documentation, etc. I personally know a marginalized community with a dire need of visibility, information and stuff that has everything locked behind their discord server and everything is about to be lost. It's both extremely sad and a huge "told you so years ago"

[–] Camille@lemmy.ml 20 points 2 months ago

Sounds like an old proverb lmao

[–] Camille@lemmy.ml 0 points 2 months ago

Oui bah on est Mardi quoi

[–] Camille@lemmy.ml 22 points 2 months ago

That's clearly AuDHD

[–] Camille@lemmy.ml 2 points 3 months ago (1 children)

Musk is also fucking white. Not that they didn't deport poor white people too. But the focus has long been on POC.

[–] Camille@lemmy.ml 21 points 3 months ago (3 children)

Tbh it should have been abolished right from the start, when the focus was on getting POC out of the US. It feels so late now

[–] Camille@lemmy.ml 19 points 3 months ago

Just finished season one. It's so precious, so important for many people. I had many good cries. 10/10 will rewatch

[–] Camille@lemmy.ml 11 points 3 months ago (1 children)

Back when I was a student, we had to implement the following projects to validate and I think they are a really nice set of training projects for C (memory management, handling your own types, algorithms and off-by-one traps):

  • a basic implementation of diff
  • a fully functional hashmap (subproject of diff actually)

I personally wrote the followings too:

  • a program to compress/decompress archives using only the LZ77 algorithm
  • math expression evaluator (i.e. a basic interpreter)
  • a basic garbage collector (mark&sweep, mark&copy, whatever grinds your gears)

If you are already a competent developer in other languages, these should be reasonable projects. The difficulty lies in doing them in C. For the hashmap, the evaluator and the archiver, you have to correctly manage your data and memory. this makes them excellent projects for learning what makes C... C. For the garbage collector... well... you are the memory manager. Basic GC algorithms are easy to understand but what you want to learn here is the actual management of the memory. See it as a more advanced project if you want to really grok dirty C.

Most importantly: have fun :)

[–] Camille@lemmy.ml 3 points 4 months ago

What's the problem with Skouirrelle? :^)

[–] Camille@lemmy.ml 0 points 4 months ago

Go

Well... I was about to dive into bin packing and stuff. I started by pruning the obvious candidates (those which can fit all the shapes one next to the other, without more computation) so save CPU time for the real stuff. I ran my code on the real input just to see and... what to do mean there are no candidate left? I write the number of obvious boys into the website's input box, just to check and... Ah. I understand why people on reddit said they felt dirty x)

Anyway the code:

day12.go

package main

import (
	"aoc/utils"
	"fmt"
	"slices"
	"strconv"
	"strings"
)

type shape [3][3]bool

func parseShape(input chan string) shape {
	// remove the header
	_ = <-input

	sh := shape{}
	idx := 0
	for line := range input {
		if line == "" {
			break
		}

		row := [3]bool{}
		for idx, c := range []rune(line) {
			if c == '#' {
				row[idx] = true
			}
		}

		sh[idx] = row
		idx++
	}

	return sh
}

func (sh shape) usedArea() int {
	sum := 0
	for _, row := range sh {
		for _, cell := range row {
			if cell {
				sum++
			}
		}
	}
	return sum
}

type regionConstraints struct {
	width, height int
	shapes        []int
}

func parseRegionConstraint(line string) (rc regionConstraints) {
	parts := strings.Split(line, ":")
	dims := strings.Split(parts[0], "x")
	rc.width, _ = strconv.Atoi(dims[0])
	rc.height, _ = strconv.Atoi(dims[1])

	shapes := strings.Fields(parts[1])
	rc.shapes = make([]int, len(shapes))
	for idx, shape := range shapes {
		rc.shapes[idx], _ = strconv.Atoi(shape)
	}
	return rc
}

type problem struct {
	shapes      []shape
	constraints []regionConstraints
}

func newProblem(input chan string) problem {
	shapes := make([]shape, 6)
	for idx := range 6 {
		shapes[idx] = parseShape(input)
	}

	regionConstraints := []regionConstraints{}
	for line := range input {
		rc := parseRegionConstraint(line)
		regionConstraints = append(regionConstraints, rc)
	}

	return problem{shapes, regionConstraints}
}

func (pb *problem) pruneRegionsTooSmall() {
	toPrune := []int{}
	for idx, rc := range pb.constraints {
		availableArea := rc.height * rc.width
		neededArea := 0
		for shapeId, count := range rc.shapes {
			neededArea += pb.shapes[shapeId].usedArea() * count
			if neededArea > availableArea {
				toPrune = append(toPrune, idx)
				break
			}
		}
	}

	slices.Reverse(toPrune)
	for _, idx := range toPrune {
		pb.constraints = slices.Delete(pb.constraints, idx, idx+1)
	}
}

func (pb *problem) pruneObviousCandidates() int {
	toPrune := []int{}

	for idx, rc := range pb.constraints {
		maxShapePlacements := (rc.width / 3) * (rc.height / 3)
		shapeCount := 0
		for _, count := range rc.shapes {
			shapeCount += count
		}
		if maxShapePlacements >= shapeCount {
			toPrune = append(toPrune, idx)
		}
	}

	slices.Reverse(toPrune)
	for _, idx := range toPrune {
		pb.constraints = slices.Delete(pb.constraints, idx, idx+1)
	}

	return len(toPrune)
}

func stepOne(input chan string) (int, error) {
	pb := newProblem(input)
	pb.pruneRegionsTooSmall()
	obviousCandidates := pb.pruneObviousCandidates()

	fmt.Println(pb)
	fmt.Println(obviousCandidates)
	return 0, nil
}

func stepTwo(input chan string) (int, error) {
	return 0, nil
}

func main() {
	input, err := utils.DownloadTodaysInputFile()
	if err != nil {
		_ = fmt.Errorf("error fetching the input: %v", err)
	}

	utils.RunStep(utils.ONE, input, stepOne)
	utils.RunStep(utils.TWO, input, stepTwo)
}

[–] Camille@lemmy.ml 3 points 4 months ago* (last edited 4 months ago)

JEAN-BAPTISTE
EMMANUEL
ZORG

 

Hello everyone,

I'm having a hard time formulating the question and it can be a bit confuse to me too at times, but here it is. For the context, so that you can have an idea of the shenanigans I'm used to program, I'm a PhD in compilation and did stuff related to security and performance. I have essentially worked in projects that are relatively low-level and system-oriented (compared to webdev, desktop application dev etc).

I usually code CLI tools, usually system-oriented libraries, and stuff like that. And sometimes I would like to hack simple yet cool frontends, typically a webapp to either visualize my processes/data or to manipulate the inputs or whatever. I'm not looking for a big solid webapp. What I would like to do is to write frontends that would be the equivalent of quick ugly glue Perl scripts for interprocess communication.

Typically, I could have a program I wrote doing stuff, I may add a little HTTP server feature to it as an entrypoint to its internal and then have a cute webapp to connect to it to visualize what is going on, idk.

As I said, I'm not trying to transform my applications into actual servers or microservices in order to build an entire web application on top. It is more like using a proper user interface (typically web) as a better pretty-printing/logging system/whatever.

I guess there must be frameworks, tools, architectures or whatever to suite my needs, but since I have never really done frontend projects, I'm in the dark right now.

If someone has any recommandation, it would be very nice. Thank you so much in advance!

1
submitted 5 months ago* (last edited 5 months ago) by Camille@lemmy.ml to c/matrix@lemmy.ml
 

Hello there,

I have been running a Conduwuit server for a while now but since it has been abandoned I was just keeping it alive until it becomes too outdated or that I'm too bored to keep it or whatever.

But since Continuwuity seems like a good upgrade option, I was wondering how to migrate. According to a comment I read somewhere I should be able to just change the Docker image name and run it exactly how I used to with Conduwuit but I can't find any guide or anything confirming this.

Did someone already migrate and could help me?

Thank you in advance!

EDIT: I indeed just recreated the container with exactly the same command-line, just changing the image and everything just worked as if nothing happened. Thank you for the answers and emotional support

view more: next ›