Guess I'm a bit late on day one. Wound up doing mine in go, but maybe if I'm motivated I'll use something cooler later. Those elixir solutions are rad!
func main() {
b, err := os.ReadFile("input.txt")
if err != nil {
log.Fatalln(err)
}
d, err := distance(string(b))
if err != nil {
log.Fatalln(err)
}
fmt.Println(d)
}
func distance(input string) (int, error) {
var left []int
var right []int
for _, line := range strings.Split(input, "\n") {
fields := strings.Fields(line)
if len(fields) != 2 {
continue
}
l, err := strconv.Atoi(fields[0])
if err != nil {
return 0, err
}
left = append(left, l)
r, err := strconv.Atoi(fields[1])
if err != nil {
return 0, err
}
right = append(right, r)
}
slices.Sort(left)
slices.Sort(right)
var total int
for i := 0; i < len(left); i++ {
total += int(math.Abs(float64(left[i] - right[i])))
}
return total, nil
}
func main() {
b, err := os.ReadFile("input.txt")
if err != nil {
log.Fatalln(err)
}
s, err := similarity(string(b))
if err != nil {
log.Fatalln(err)
}
fmt.Println(s)
}
func similarity(input string) (int, error) {
collisions := make(map[int]int)
var left []int
var right []int
for _, line := range strings.Split(input, "\n") {
fields := strings.Fields(line)
if len(fields) != 2 {
continue
}
l, err := strconv.Atoi(fields[0])
if err != nil {
return 0, err
}
left = append(left, l)
collisions[l] = 0
r, err := strconv.Atoi(fields[1])
if err != nil {
return 0, err
}
right = append(right, r)
}
for _, r := range right {
c := collisions[r]
collisions[r] = c + 1
}
var total int
for _, l := range left {
v := collisions[l]
total += l * v
}
return total, nil
}
Had a vegan friendsgiving this year, huge upgrade
Maybe depending on how busy life gets. Been learning rust so probs stick with that despite it being really not ideal for coding puzzles lol
Reasonably okay (but maybe don't get the absolute newest model), but not as good as the others which are all excellent. I mostly put them in the list because they've got excellent build quality, good keyboard, trackpad, etc, and a very nice screen. Basically if you want a macbook with linux (for cheaper than a macbook with linux https://asahilinux.org/) they're pretty reasonable. They also support openbsd which is neat https://jcs.org/2021/08/20/matebook
The laptops I listed are in order of preference imo. Framework is definitely in a class of itself, but if they don't ship to your country or something then getting an xps with linux pre-installed is great and then finally as a backup either a thinkpad or matebook.
Yea lol sorry I dunno why I forgot to add a link. Also if you're using or planning on ever using linux I would highly recommend the new 2.8k display, it'll be a nice 2x scaling factor which is quite handy is you run any older x11 programs (games, some proprietary software, etc).
Framework for sure, specifically the 13 with the new higher res screen. It’s a perfect 2x scale which is really nice.
The older screen is fine, but some older x11 programs will be scaled wrong.
There are other nice laptops of course: dell xps, thinkpad x1c, huawei matebooks, but imo the framework laptops are better in most regards and as a bonus you can upgrade the ram, cpu, and motherboard without needing to buy a new computer. You also can buy them without a windows license which usually makes them cheaper than the others for similar specs (unless you’re going for used of course).
I have one and it’s pretty great, more expensive than a used thinkpad, but cheaper than most other new laptops with similar specs. The 3:2 screen on the 13” is the killer feature for me. I couldn’t go back to a 16:9 laptop at this point. Also not needing to pay the windows tax on the diy version is cool.
Alpine. It’s pretty lovely, but usually when I’m setting something up for someone else it’s either Debian or Fedora.
That teams client is excellent too because it just shows that you're always online lmao
https://mntre.com/reform.html
I wonder if it's going to make installing the initial f-droid apk a huge pain though. Since normally you need to just download it in your browser and install it.
If I had to take a wild shot in the dark my best guess is that your router's upstream connection settings are a bit messed up and whenever your ISP gives you a new ip dhcp is taking a long time for whatever reason. You could try to pay attention to if your outgoing ip changes whenever this happens https://www.showmyip.com/
I guess also I'm assuming you're using a router with a built-in either cable or fiber modem? If you have a separate modem you might want to see about resetting it as well.
Wow that is fucking bizarre.. this isn't using powerline networking (ethernet over your power system via little wall sockets) or anything like that is it?
I'd definitely start with a factory reset of your router. Some routers have a little pin you need to hold down with a paper clip. With others you'll have to do it from their web interface...
You can usually get to the web interface by entering your default gateway in a browser. Something like http://192.168.0.1 or http://10.0.0.1 are common. It might be written on the back of your router. You can also usually find your default gateway in your connected network settings pretty easily: on my android phone it's just called "Gateway".
Once you're in the web interface you'll probably need to put in login info which is almost always written on your router. Then navigate that hellscape until you can do a factory reset.
Also if you're in the US and have a router provided by one of the big ISPs like Comcast, Verizon, Frontier, etc you're almost certainly renting your router for like $10 a month from those bastards. So call them up and make them fix it or get you a new router if they can't figure it out. You might as well try this before spending money buying a router. I saw your other comment that you've actually bought this router yourself. Resetting it might be slightly more tricky since you might need to configure the modem settings a bit, but it's usually pretty easy. Probably worth looking up and downloading a pdf of the manual for your router before you reset it though in case you need to read it without internet.
Is it happening at consistent times? Also next time it goes out, see if you can plug an ethernet cable into the router and see if you're getting a connection over ethernet. Also is the connection like completely severed or just a very high rate of dropped packets / slowness?
running z-library
Would've actually gotten him a few votes
I don't know the current status on this, but it worked by recording your phone's mac address (or bluetooth address) when your phone scans for wifi networks. So it could track you without you even needing to join the network. AFAIK this particular tactic was countered by Android and IOS randomizing the mac address it sends out (your networking stack can simply lie about it).
Yep this is the best one by a big margin