#development
1 messages Β· Page 298 of 1
i know they have absolutely zero value (except if you sell your account with a rare badge maybe) but its just an irrational sort of attachment
I don't have problem with badges personally, I have a problem with people chasing them like crazy 
Badges are definitely an addition to your profile but not so important that you have to do everything to get as many of them as possible
@tasks.loop(minutes=30)
async def update_topgg_stats(self):
await self.wait_until_ready()
if not self.topgg_token:
return
url = f"https://top.gg/api/bots/{self.user.id}/stats"
headers = {
"Authorization": self.topgg_token,
"Content-Type": "application/json",
}
data = {"server_count": len(self.guilds)}
try:
# use only a single session urs was creating sessions everytime
if not hasattr(self, "topgg_session"):
self.topgg_session = aiohttp.ClientSession()
async with self.topgg_session.post(url, headers=headers, json=data) as resp:
if resp.status == 200:
print(f"[TOP.GG] Posted server count: {data['server_count']}")
else:
error = await resp.text()
print(f"[TOP.GG ERROR] Status {resp.status}: {error}")
except Exception as e:
print(f"[TOP.GG EXCEPTION] {e}")
async def setup_hook(self):
# start loop once only.
if not self.update_topgg_stats.is_running():
self.update_topgg_stats.start()
await self.tree.sync()
print("[DEBUG] setup_hook running")
then u can add like a function to close the session pool or something
try , if it works, it was a loop issue
Thanks ill try a bit later. Kinda have rebooted the bot 500 times now so ima stop
piled up many requests
67th amendment of the united states says that an active government shall not infringe on the people's right to a badge (its true)
i do genuinely wonder if some of the mods in the discord dev server get paid or are they just doing it for free
i see some borderline glaze from some of them
I think there volinteer
Someone said that they are paid iirc
Also RIP faceboy, he was banned 
(not for that question)
Did not fix it today but could also be on some daily limit. Ill dm you tmr if it still is
yeah or worse case you actualy try on a different IP , shared IPs have a tendency to actually get rate limited by discord
rip the badge finally left
Ma7ybe i have no way to change ip tho without risking performance so ye
@quartz kindle bad news for the ampere
the ram in my epyc is 4R, which is not compatible with ampere altra 1/2R
so will be stuck on 16gb for now :c
wtf
or in theory you can route ur requests through a proxy ?
I have too much stuff to try and proxy rn
trying to debug aoc day 4 and it just looks cool cant even be mad
figured out solving it
bro's literally generating a minecraft world
LMAO yeah basically
how'd you do a visualization?
I did this
fn get_char_rep(c: char) -> char {
if c == '@' {
return 'β';
} else if c == 'x' {
return 'β'
} else {
return 'β';
}
}
for i in &iter {
let s: String = i.iter().map(|&b| get_char_rep(b as char)).collect();
println!("{s}");
}
before anyone says I can just do the cast in get_char_rep. Yes but i kept it like this to spite yall
Ohhh okay
gotta love stack overflows https://github.com/calagopus-rs/panel/commit/945aa6fb8fe117720625974bb4fd753fc7643849
i see the problem
it's that you're using rust!!!!!!
whatthefuckeryisthis?!
https://support-dev.discord.com/hc/en-us/articles/10113997751447-Active-Developer-Badge
Active Developer Badge - No Longer AvailableThe Active Developer Badge has been decommissioned and is no longer available to earn. Any Active Developer Badges that were previously displayed on user...
day6 is not for the weak(me)
happiest moment of my life
Both parts run in 6ms
And I'm not even attempting optimizations
Oh!!!!!!! I should run it using iron
is it just me or my browser or did chromium add a border around every page??
it looks terrible
ok disabling this fixed it
thank goodness
chrome now have split tab view
Indeed
Zen has rounded corners too but I kinda vibe w it
I used so many tokens that it cant even display the cost π
type TranslationRecord = {
[k: string]: string | TranslationRecord;
};
type DefinedTranslations<
O extends TranslationRecord,
P = UnionToIntersection<PathImplObj<O>>,
> = {
raw: O;
paths: keyof P;
mapping: P;
use<K extends keyof P>(
key: K,
// @ts-ignore this is perfectly fine
values: Record<GetPlaceholders<P[K]>[number], string>,
): string;
};
export type UnionToIntersection<U> = (
U extends unknown
? (k: U) => void
: never
) extends (k: infer I) => void
? I
: never;
type PathImplObj<T> = T extends TranslationRecord
? {
[K in keyof T]: T[K] extends TranslationRecord
? PathImplObj<T[K]> extends infer Nested
? {
[P in keyof Nested as `${K & string}.${P & string}`]: Nested[P];
}
: never
: {
[P in K]: T[K];
};
}[keyof T]
: never;
type GetPlaceholders<S extends string> =
S extends `${string}{${infer W}}${infer RE}`
? [W, ...GetPlaceholders<RE>]
: [];
how I love typescript
?
!
a list of people to not trust to on Discord
- default Discord pfp's
- no pfp's
ty
Turning out pretty nice π
Spent last night creating a bunch of branding material for around 2 hours
Here's one of the new logo
My implementation of server selection is pretty unique π
looks very neat
though the sidebar/navbar kinda looks like this were the docs (just from the looks) lol
i like it love a nice set of graphs
amazing, i really like the design and the color scheme
never wouldve known this existed unless you did that, but I now know it exists, so now I am using it
only feedback I have is that I don't like the join servers for you when you login to the dashboard
It wont exist for much longer, i plan to remove it at around 50 members. I just need a small audience so that i can build up a strong support forum
people join > report bugs > bugs get fixed > documentation
but thanks π
most people see join servers for you and think scam, so just bear that in mind
and the top.gg invite link makes it so that it doesnt make a role btw
The bot has no major commands, it doesn't need any permissions, hence the lack of a role
other than message history?
no need
thats odd, i must have a mismatch on my dev portal haha
ill check it out now
but this is what i mean!! users discover things
my mistake, on top.gg it SHOULD have a role
for read message history
its been a long day
fixed.

I'll also remove autojoin for the time being
alright
Did you do AoC today?
not yet
Part 2 is straight from the devil
lmao
this was a funny mindfuck lmao
It took me a couple hours
I had to rewrite my logic from part 1, and then I used my new part 2 to make part 1 better, and then that new part 1 to make part 2 befter
How tf
I struggled because I didn't understand what had to be done
And still kind of don't
For part 2
took me a little while to understand too
gotta learn how to read Cephalopod math
:^)
function transformProblem(problem: string[]): (string | number)[] {
const numbers = problem.slice(0, -1);
const operator = problem.at(-1)!;
const output: (string | number)[] = []
for (let i = operator.length - 1; i >= 0; i--) {
let column = "";
for (const num of numbers) {
column += num[i] ?? " ";
}
output.push(Number(column));
}
output.push(operator.trim());
return output;
}```
This is the code of my part 2
core*
originally my parsing for the input into [
[...column]
[...column]
]
Etc was just for(length of line){ part = split line by " " for (number of part){ if(problems[index(number)]) push else create array for column } }
"pseudo" code lmao, I'm on mobile
xD
But for some reason the right logic for transforming wouldn't work with that input parsing system
Because I wasn't dealing with the white spaces needed
what was your solution?
also keep in mind the last line is truncated, not of equal length as the other lines
so if you base everything off of operator.lenght, you might get wrong results
in my case the operator line was 2 characters smaller than the number lines
due to whitespace?
when I finally got my code working I forgot one spaxe in the example input
it ends there
Which caused me to be off by 4, that took like 30 minutes to fix
that was one of the things that caused me to get wrong results
i did console.log the lengths of the lines and got this: [3763, 3763, 3763, 3763, 3760]
3 characters less in the last line
my amazing code:
function LOL6v2(input) {
let total = 0;
const lines = input.trim().split("\n");
const width = Math.max(...lines.map(x => x.length));
let n = [];
for(let i = width-1; i > -1; i--) {
const col = lines.map(x => x[i]);
const op = col.pop()?.trim();
const num = col.filter(x => x.trim()).join("");
n.push(Number(num));
if(op) {
let toadd = n.shift();
for(const xyz of n) {
switch(op) {
case "+": toadd += xyz; break;
case "*": toadd *= xyz; break;
}
}
total += toadd;
n.length = 0;
i--;
}
}
return total;
}
thats for lazy people lmao
I used a reduce
this was part 1:
function LOL6(input) {
let total = 0;
const lines = input.trim().split("\n");
const ops = lines.pop().split(/\s+/);
const numbers = lines.map(x => x.split(/\s+/));
for(let i = 0; i < ops.length; i++) {
const op = ops[i];
const nums = numbers.map(x => Number(x[i]));
let toadd = nums.shift();
for(const num of nums) {
switch(op) {
case "+": toadd += num; break;
case "*": toadd *= num; break;
}
}
total += toadd;
}
return total;
}
pretty similar
So I might be dumb
But you get the longest line and use that as your loop, but how does that get the column?
lines.map(x => x[i])
yeah but wouldn't that just be a number m
wdym? its all numbers in that column
lines is all lines, including the operators line
lines = [numbers, numbers, numbers, numbers, operators]
lines.map(x => x[i])
is the same as [numbers[i], numbers[i], numbers[i], numbers[i], operators[i]]
I sound stupider than I am I swear
Gimme a second
ohhhh
So like at 0 it gets the first of all of them, which is a column
I get it now
[1234]
[8472]
[4582]
[4850]
[*___]
i = 2
3
7
8
5
_
How does it turn it into the weird format that it wanted?
thats the format they wanted, read the numbers from top to bottom
yeah because you using width -1 as your start for the for loop right?
start at the end of the lines, because they want it from right to left
and then from top to bottom on each index
xD
"You pick an algorithm for part 1, and then one of the other algorithms is revealed as a bad choice for part 2. Do you switch or keep your original choice?"
Sounds about right
xD
I hope tomorrow isn't as bad
the issue with your idea is that splitting by " " makes no sense for vertical numbers, they are not the correct boundary
I just have trouble understanding what a problem asks for most of the time, not the actual implementation
It works (somehow)
you go the long way of doing corrections and transformations to fix it
That method preserves whitespace (along with the line under it)
btw did you measure performance? xD
my old way for parsing was literally just
const problems = []
for(let h = 0; h < lines.length; h++){
const line = lines[h].split(" ");
for(let j = 0; j < line.length; j++){
if(problems[j]) problems[j].push(line[j])
else problems[j] = []
}
}```
probably a little off but
6ms for part 1 and 2 separate
thats pretty good
yeah that works for horizontal bounds, where you can split by space and get the correct number
it was the only way I could think to parse just looking at it
and then I realized I could write a tokenizer
but for vertical numbers it doesnt work
Thankfully I didn't
like part 2?
ye
yeah unfortunately
@low marten what timezone is most active hours based on?
GMT
holy shit today's AoC was hell
usually you can get away with many different methods and still complete it, but this time good luck lmao
hey again guys, i'm currently working on the backend for VC / User VC statistics, in the mean-while, i could use some help on where to actually display these stats, do i create new charts, or use existing ones, and append them with the VC info?
for example, Instead of message volume, it's activity volume, with 2 respective line charts, for 'messages' and 'minutes' minutes obviously accounting for VC
What was your solution
made yesterday's today because had no time
will do today's tomorrow probably, hate that kind of day honestly
what was yours :^)
Part 1
Part 2
yup thats the proper way to solve it
What'd you do lmao??
i tried the other ways first and got demolished hard
this was my version, but the solution is pretty much the same
function WHATTHEFUCK(input) {
const lines = input.trim().split("\n");
const beams = Array(lines.length / 2).fill().map((_,i) => Array(lines[0].length).fill(0))
beams[0][lines[0].indexOf("S")]++;
for(let i = 2; i < lines.length; i += 2) {
const line = lines[i];
const b = (i - 2) / 2;
for(let x = 0; x < beams[b].length; x++) {
const beam = beams[b][x];
if(beam > 0) {
if(line[x] === "^") {
beams[b+1][x-1] += beam;
beams[b+1][x+1] += beam;
} else {
beams[b+1][x] += beam;
}
}
}
}
return beams.at(-1).reduce((a,t) => a + t, 0);
}
my other solutions were a recursive function and a "always go left" maze solver thingy with backtracking
both would take hours/days if run until the end
all though these days are getting to the point where I have issues and may not be able to solve them, so I might be tapping out soon
for example ```js
function WHATTHEFUCK(input) {
let total = 0;
const lines = input.trim().split("\n").slice(0, 50);
go(2, lines[0].indexOf("S"));
function go(line, beam) {
if(line >= lines.length) { total++; return; }
if(lines[line][beam] === "^") {
go(line + 2, beam - 1);
go(line + 2, beam + 1);
} else {
go(line + 2, beam);
}
}
return total;
}
this takes 20 seconds if i truncate the input to 100 lines, and 200 seconds if i truncate it to 110, god knows how long it would take if i let it run for the full 140 lines
i spent hours trying to debug it because i thought it was getting stuck in an infinite loop
When it turned 12am I didn't have my laptop I looked at the problem and my first thought was count the ^ and minus one, and then I realized that not every splitter splits twice and such
but no, it just takes days if i use this method lmao
this was my other attempt (the first one actually)
function WHATTHEFUCK(input) {
let total = 0;
const lines = input.trim().split("\n").slice(0, 100);
let currentLine = 2;
let currentBeam = lines[0].indexOf("S");
const path = [];
while(true) {
if(currentLine >= lines.length) {
total++;
const prev = path.pop();
if(!prev) { break; }
currentBeam = prev[0] + 1;
currentLine = prev[1] + 2;
} else if(lines[currentLine][currentBeam] === "^") {
path.push([currentBeam, currentLine]);
currentBeam--;
currentLine += 2;
} else {
currentLine += 2;
}
}
return total;
}
I just have issues dissecting what the problem asks for, but if it's explained to me like very basic I usually can do it
elf magic confusing you
Wtf
yes
This method with my input returns someone else's answer
Lol
I haven't been able to time my solution but my.giess is 1.5s
i hate tree based/backtracking algorithms so much in programming
i only had a legitimate use for one once when i needed to solve the subset sum problem for some function
my solution was: a little 'text > voice' switch on the Re-chart cards, i think its good enough π
@quartz kindle first time using protobuf wish me luck
going to use it to give the user a signed hmac ticket to the user that looks like a token but authorizes some backend action
json slow
have you tried messagepack? but yeah give protobuf a try
or roll your own custom
if you're gonna use it for something specific and not general purpose messages, rolling your own encoding should be easy
was thinking about it but im using rust which im not too great at so wouldnt know how to (safely) deserialize a struct and serialize it back again
doesnt messagepack also include field names? for this protobuf is perfect because the data is creates/serializes will only ever be handled by the application itself so it already knows all the fields
also it includes potentially variable string lengths so if i wanted to implement my own id have to handle that case which could be a whole rabbit hole
for variable string lengths just utf8 encode xd
the spec does, but there are implementations that offer options to remember/cache fields
idk if the rust implementation does that
protobuf should be fine, the only thing i dont like about it is that its schema based
yeah i dont like that either but in this case the library im looking at supports just defining the protobuf structs as regular language structs so i dont have to use the schemas
although im not a fan of the extra dependency, maybe ill just stick to json which is already in my stack and since its a tiny object protobuf likely wont have any noticeable performance improvement anyway
but then the waste of using json, such pain, those 10 cpu cycles i could save
xD
i can recommend bincode
if its rust-to-rust
doesnt include field names
only pure bytes, and is serde compatible
aight time to catch up
supports serde too :o
looks a bit lighter than protobuf
looks pretty good, will probably use that, thanks
oooooo @queen needle now I see what the drawing is
it's the map of the facility
Oh yeah
Today was hard
Likely won't be able to do tomorrow, I know I'm nearing my end of being able to do aoc
funny to write a visualization of day 7
Day 7 had the best visualization I think
Well day 1 someone made an awesome visualization
nah there is always a way
Yeah i almost couldn't find the way today
day 7 part 2 is more difficult than I expected
I'm prolly just approaching it wrong
had to read today's part 1 for a long time lmfao
before i finally understood
i think i understood at least
I solved it and I still don't understand it

I just realized day 7 is just a variant of pascals triangle
Also I just heard of kruskals algorithm, and realized I naively implemented it for today's solutions
Kruskal my goat
I haven't looked at day 7, is it graph theory?
I'm assuming something about minimal spanning trees
Literally just took an exam on that stuff 30 minutes ago
Day 8 is
day 7 idk what the like CS term for it is
yeah figured a few moments ago it was pascals
feeling the same after solving part 1
google gave me graph shit, i implemented 1-to-1 as wikipedia writes on the article
today's part one was annoying, i had to re-read it a bunch of times to understand what they actually want
part 2 seems to be even more annoying,i dont understand it at all
how did you code it if you didnt understand xD
kinda just kept trying things
But also my part 1 and 2 are very similar
Thankfully
i couldnt figure out what the hell they wanted me to do
part 2:
function STUPIDELVES(input) {
const lines = input.trim().split("\n").map(x => x.split(",").map(Number));
const distances = [];
const groups = new Map();
for(let i = 0; i < lines.length; i++) {
for(let i2 = i + 1; i2 < lines.length; i2++) {
const item1 = lines[i];
const item2 = lines[i2];
const dx = item2[0] - item1[0];
const dy = item2[1] - item1[1];
const dz = item2[2] - item1[2];
const dist = Math.sqrt(dx ** 2 + dy ** 2 + dz ** 2);
distances.push([dist, item1, item2]);
}
}
distances.sort((a,b) => a[0]-b[0]);
let nextid = 1;
let last;
for(const pair of distances) {
const item1 = pair[1];
const item2 = pair[2];
if(item1[3] && item2[3]) {
if(item1[3] !== item2[3]) {
const old = groups.get(item2[3]);
groups.delete(item2[3]);
groups.get(item1[3]).push(...old);
old.forEach(x => x[3] = item1[3]);
if(groups.size === 1) last = [item1, item2];
}
} else if(item1[3]) {
item2[3] = item1[3];
groups.get(item1[3]).push(item2);
if(groups.size === 1) last = [item1, item2];
} else if(item2[3]) {
item1[3] = item2[3];
groups.get(item2[3]).push(item1);
if(groups.size === 1) last = [item1, item2];
} else {
const id = nextid++;
groups.set(id, [item1, item2]);
item1[3] = id;
item2[3] = id;
}
};
return last[0][0] * last[1][0];
oh wow
zero optimization went into this, i just wanted it to work
Similar solutions
ye
I don't think there were many unique solutions for today tho
That's the issue I have, dissecting the provlems
i asked chatgpt to help me with understanding what they want
didnt help much
actually made it worse and sent me in wrong directions
lmao
Lmaoooo
this was part 1 lmao:
function STUPIDELVES(input) {
const lines = input.trim().split("\n").map(x => x.split(",").map(Number));
const distances = [];
const groups = new Map();
for(let i = 0; i < lines.length; i++) {
for(let i2 = i + 1; i2 < lines.length; i2++) {
const item1 = lines[i];
const item2 = lines[i2];
const dx = item2[0] - item1[0];
const dy = item2[1] - item1[1];
const dz = item2[2] - item1[2];
const dist = Math.sqrt(dx ** 2 + dy ** 2 + dz ** 2);
distances.push([dist, item1, item2]);
}
}
distances.sort((a,b) => a[0]-b[0]);
distances.length = 1000;
for(const pair of distances) {
const item1 = pair[1];
const item2 = pair[2];
if(item1[3] && item2[3]) {
if(item1[3] !== item2[3]) {
const old = groups.get(item2[3]);
groups.set(item2[3], []);
groups.get(item1[3]).push(...old);
old.forEach(x => x[3] = item1[3]);
}
} else if(item1[3]) {
item2[3] = item1[3];
groups.get(item1[3]).push(item2);
} else if(item2[3]) {
item1[3] = item2[3];
groups.get(item2[3]).push(item1);
} else {
const id = groups.size + 1;
groups.set(id, [item1, item2]);
item1[3] = id;
item2[3] = id;
}
}
return [...groups.values()].map(x => x.length).sort((a,b) => b-a).slice(0, 3).reduce((a,t) => a*t, 1)
}
also, i did day 1 yesterday which i hadnt done before
for (let t = 0; t <= 1000; t++) {
const { a, b } = edges[t] as Edge;
unite(a, b);
if (t === 1000) {
const componentSize = new Map<number, number>();
for (let v = 0; v < N; v++) {
const root = find(v);
componentSize.set(root, (componentSize.get(root) ?? 0) + 1);
}
const sizes = Array.from(componentSize.values()).sort((a, b) => a - b);
const result = sizes.at(-1)! * sizes.at(-2)! * sizes.at(-3)!;
console.log(result);
}
}```
only difference In my part 1 vs part 2
Why do you set the length?
Or more so why does setting the length do anything
some annoying shit, i kept getting stuck because i was accidentally counting one zero too much
let me find lol
Bros gotta hit the up arrow in the js console
part 1:
function Day1Lol(input) {
const lines = input.trim().split("\n");
let dial = 50;
let total = 0;
for(const n of lines) {
const num = Number(n.slice(1));
const dir = n[0];
if(dir === "R") {
dial = ((dial + num) % 100 + 100) % 100;
} else {
dial = ((dial - num) % 100 + 100) % 100;
}
if(dial === 0) total++;
}
return total;
}
part 2:
function Day1Lol(input) {
const lines = input.trim().split("\n");
let dial = 50;
let total = 0;
for(const n of lines) {
const num = Number(n.slice(1));
const dir = n[0];
if(dir === "R") {
const r = dial + num;
total += Math.floor(r / 100);
dial = r % 100;
} else {
const r = (dial === 0 && num > 0 ? 100 : dial) - num;
total += -Math.floor(r / 100);
dial = (r % 100 + 100) % 100;
if(dial === 0) total++;
}
}
return total;
}
lmao thats exactly what i was doing
i did this while debugging why it was not working:
function Day1Lol(input) {
const lines = input.trim().split("\n");
let dial = 50;
let total = 0;
for(const n of lines) {
const num = Number(n.slice(1));
const dir = n[0];
if(dir === "R") {
dial += num;
while(dial > 99) { total++; dial -= 100; }
} else {
if(dial === 0 && num > 0) { dial = 100; }
dial -= num;
while(dial < 0) { total++; dial += 100; }
if(dial === 0) total++
}
}
return total;
}
Bro wtf
I mean if it helped you get to the solution
my debugging looks like 100 console logs
not really but i did eventually figure it out
my debugging = putting console logs inside loops and letting it log 273982749 times
maybe
let dial = 50;
let password = 0;
for (const line of lines) {
const direction = line[0];
const value = parseInt(line.slice(1));
const sign = direction === "L" ? -1 : 1;
dial = (dial + sign * value + 100) % 100;
if (dial === 0) password++;
}
console.log(password);```
Pretty basic part 1
part 2 I just added another loop
for (let i = 0; i < value; i++) {
dial = (dial + sign + 100) % 100;
if (dial === 0) password++;
}```
nicenice
So are you all caught up for this year?
did all 8 days so far yes
Are you going to finish it out
@lyric mountain did you ever get today's/yesterdays?
idk, 4 days remaining
you think its gonna be too hard?
how bad are the days so far
Yeah only 4 more days, how much more difficult can it get
are they like standard DSA or more involved
Idk, I think you'll be able to solve it as long as you can dissect it, I personally think I'll fall short a little but
Today was just like a copy paste kruskals algorithm
idk i wanted to pull my hair out a few times the past 2 days
yeah im lowkey not tryna do MST anymore
I'm just struggling because I have never taken a CS course so idk any of these fancy algorithms and things
me neither
That's fair, maybe we can help each other with solutions lmao
might be worth grabbing and reading CLRS
you can skip a lot of the proofs but the explanations about graph and tree algorithms are pretty thorough
I mean it'd be nice knowledge to have, but I just program for fun and make simple websites and such I don't do much, the only algorithm I've ever had to make is minimax lmfao
not planning on doing SWE?
i hate trees in general
nah, I plan to be a french teacher
I just like programming for fun, I think if I pursued a job in it I would grow to hate it
quite possibly plus a french teacher would be more rewarding
only tree I like is AST
I find it fun and interesting which is exactly why I'm gonna go into software
forever grateful that my prof skipped red-black trees and b trees
what would a red black tree even be used for?
no clue
kruskals is DSUF where you greedily add the lightest edge lengths that make a change yeah?
yes
im locked in
Day 7 I still need to figure out part 2
Day 8 didn't start yet
What are you having trouble with in part 2?
Finding the correct way to deal with it
Tried using a pascal pyramid but didn't test yet, gonna do it tomorrow
not even 2 weeks after hitting 100 guilds and I'm coming up hot on I passed 200
Today's AOC isn't hard logically, but my part 2 takes forever to run that idek if it works
@quartz kindle when you do it im going to need you to bust out optimizations
i run in like 2s
ughhh ok day7 is a pita
@queen needle I dont get wtf I'm supposed to do on day 8
what are you stuck on? im stuck on day 9 part 2 right now xd
I have to do a assignment for class, if you dont get it by the time im done i can try and help
didnt even start coding, I just dont know what I have to do
ik I need to connect the closest boxes, but then it mentions separate groups but what's the threshold for separation?
do I have limited cord? the cords have a limited length?
its basically like this:
A is closest to B therefore A-B
C is closest to B thereforce C-B, but since A-B now you have A-B + B-C = A-B-C
then X is closest to Y, so now you have A-B-C X-Y
polygons
ugh, ok I think I get it now
@quartz kindle
lmao
how you doing on it
playing league rn
i'll get back to it later
i have a general idea of what i want to do, just implementing it is annoying
real
welcome to the club
took me like half an hour to even understand what it wants from me
I must be doing smth wrong cuz I get 2x4, 3x2 and 7x1 circuits after 10 connections
the 5-box group only appears at 11th
i guess today's part 2 is complex because part 1 was
let positions: Vec<Point2> = aoc_rs::input::read_file(aoc_rs::input::get_path(9, test))
.iter()
.map(|l| aoc_rs::regex::coord(l).unwrap())
.collect();
positions
.iter()
.flat_map(|a| positions.iter().map(move |b| a.covered_area(b)))
.max()
.unwrap_or(0)
okay yeah this sounds like a pain
oh found the issue, nvm
are the red tiles guaranteed to be in the same order?
Yes
like, 1 links to 2,2 links to 3,3 links to 4, etc.
well
makes it less painful
Yes
because it just says that the last and first are linked
The red tiles are not affected from part 1 to part 2
well you only need two corners
In your list, every red tile is connected to the red tile before and after it by a straight line of green tiles.
ah nvm
less painful then 
yeah part 1 is just computing areas of every possibility
unless there's some nerdy math solution
The hardest part of part 2 is time complexity
I haven't seen one yet from the solutions thread
my first approach ran in 25s
my current one runs in about 2.5s
i don't know any further optmizations
maybe using ASM
i even saw like 10s+ c++ solutions
sum progress
I want to make so people can open a thread ticket, but like if I ping someone there they get addedβ¦
yippie
probably over-engineering it
i now do part 1, but check if any tile is not X or #
ahh
is this not normal thread behavior?
is your solution done then?
not yet, sounds like for a grid of 100000-100000 it takes some time
i guess it's not a smart idea
i thought it was really funny that the example is like: 11,7 9,10
and then the first line was just under 100 thousand
always these grids & trees problems are a pain
Yes but how do servers do it then?
yeah but making the grid so far takes over a min
then ctrl+c-ed
π§
yeah i printed the grid, not too smart
i tried making a 2d array grid
crashed from OOM
Someone used this method
Going to implement that it's so much faster
probably because of the starting tile i choose to fill from
oh wow
this solution runs so much faster
way less math and logic
still getting some value that is too low π§
Havenβt even looked at the problem, but if someone is using AABB then this sounds like a good use case for quadtrees
LMAO
ooh ill have to look those up
Woot got members, invites and bans all done
Making awesome progress
Is there any special/proper way to ensure a guild bot can DM specific members when needed? I don't know if Discord ever fixed the "allow DMs from others" to exclude bots and allow them by default.
Try it and catch the exception if it fails
Optionally cache if you can or cannot DM that user for a specific amount of time
eh if it's going to be hit or miss I'm not even going to bother tbh.
Good plan. DMing users from a guild channel isn't great. Let the user DM your bot unless you are generating something private
anyone know how to add vote linked to a command?
Same question
What do you mean by "vote linked to a command"? Like someone need to vote before they can use a command?
lmao
this is some picasso shit
it's funny that day 9 was made for java
there's a literal suite of poly processing in stdlib
how do you all have the energy to do aoc... I come from work and the last thing I want to do is spend even more time on the computer π€£
Almost every part 2 for today uses a library called z3
I really want to try and get a solution without an external lib
To add to this, ephemeral messages are really good if you wanna avoid dms altogether as theyre like private messages within a server
i feel you, its time consuming and exhausting, i have no energy left for anything else if i spent my day on it
I don't have anything else, it keeps me busy and entertained for a little bit
Or for today a lot a bit
hell yeah, visualization
Day 8?
Most inputs are a circle for day 9
but yep, algo still worked
How did you create the visualization?
funny that they added an indent JUST to fuck up with boundary detection 
I built the boundary poly then used jframe to create a window I could draw to
Ahhh okay
My thought was just converting each range to a point system and scaling it, and then just drawing pixels for all ~400 lines/~800 points
think I'll commit with the visualization
Only limited to app commands unfortunately
bro I'm starting to hate elves
@solemn latch heard u wanted money
I always want money
FREE MONEY?
just finished reading it, this one gonna be nasty
didn't start it yet, but that puzzle concept itself is complicated even without code
i don't understand today's part 2
@queen needle am i understanding right that the [] is irrelevant for part 2?
like you start like before, at 0 everywhere and you need to hit the {} by pressing the least buttons where each button press add 1 to the item
Yes
so the same as part 1, but instead of hitting 1 for the # - you gotta hit the values in {}
Good luck
brute force through part 1 go brrrrr
kind of same except im not too big into code challenges
last time i did a few was when i did google foobar a few years ago
prefer working on my own stuff and just bashing out features
I don't know why but my Discord webhook for APPLICATION_AUTHORIZED keeps double/triple firing at times when added to guilds. Anyone else that uses this webhook have that happening? If it were a minute or two apart I'd assume that they kicked and re-added, but these are a few seconds apart when it happens, and it's happened to me before too even so idk..
One happened earlier today with a 6 second difference. I find it hard that the user added the bot twice that fast, or that it's happening that often...
probably not sending a 200 back quick enough
I mean I think half a second is pretty quick lol
Day 11 is scary easy
Both parts?
Quickly skimmed through part 1 description and seems fairly easy
But just like the recent part 1
Hey everyone, Iβm running into an issue with Discord.py and could use some help.
Iβm trying to log global avatar changes, but on_member_update() only gives me the guild avatar, not the global one. I tried using on_user_update(), but that event doesnβt include any guild context, so I canβt tie the change back to a specific server for logging.
Does anyone know the correct way to detect when a user updates their global avatar and still access the guild information? Iβve been stuck on this for a while and canβt find a reliable method.
Any help would be greatly appreciated!
That's a limitation
Keep some cache or something to know in what guild the user is in I guess
yes thx im working on it
if anyone needs more compatible valkey/postgres docker images, Ive made some for amd64, arm64, ppc64le, s390x and riscv64
https://github.com/calagopus-rs/valkey
https://github.com/calagopus-rs/pgautoupgrade (still working on this one rn)
@queen needle bro wtf I had the answer to part 1 right in my face this whole time
still quite bruteforcing, but bro how come I never thought abt using bitwise to generate non-repeating unique combinations that progress naturally from smallest to largest combos
now onto part 2
yep, I'm clueless on this one
I saw people for java using Z3
Yeah sadly I'll have to resort to libs
have you confirmed it's discord that's sending the double requests?
it sounds like you may have somehow set up multiple listeners
aight, done, hate that it was mostly a math puzzle instead of a logical one
the first part was hard but doable with some logic
part 2 wasn't a programming puzzle, that shit was uni-level linear algebra
part 2 took me so long because I was adamant on not using a library
real
so was I, not proud of the solution to that one
well, lets see wtf the elves are doing at 11th floor
dude 11 is so easy
Makes me scared for tomorrow
but if this works like normal advent of code tomorrow only has one part
because the last day is usually part 1 and then part 2 is you have all the previous stars
imo
this reminds me of this
doing it atm
Day 10 type shit
Googled, looked at solutions, and still took like 6 hours
I pretty much agree with this ranking though
hm ok, day 11 p1 is basically node traversal
yes
i don't think so, my code doesn't worry about that
Or well I memoize
Yeah I memoize already seen things so I think a loop is possible?
cuz going svr -> out is taking a hella long time using dfs
Do you cache?
no
try adding caching
cache what, exactly
const k = d + "|" + (f ? 1 : 0) + "|" + (c ? 1 : 0);
if (k in memo) return memo[k] as number;```
That makes no sense out of context
indeed it doesnt 
i did cache it still took ages lmao
mine ran in like 5ms π
probs the way i cache
like, I'm passing down a tuple on every jump, which contains the name + both conditions
It won't let me copy code pn mobile
pathing from "you" goes pretty fast, but I'm starting to suspect "svr" has a loop
I know some people had issues with it from the sub reddit
idk I'm just scared for tomorrow
Linear algebra into basic graph theory makes me think tomorrow is going to be something devastating
gained 0.4ms because i used a hashset rather than a vec
i always forget hashset exists
@solemn latch bro is a bot
way too fast + always just sends that
diff of all 3 messages was less than 900ms for the first and 400ms for the second
won't get any lower
definitely
But like I did everyday up to it so I gotta do tomorrow
Tomorrow we're going to have to make a esolang
yeah, memo worked
now to wait for the final boss
but yk, today might be helpful to get some more performance for my bot's dungeon crawler
I havenβt even got day 6 yet π been so busy with finals I havenβt had the time
I need to path through nodes to find which are accessible to the player, gonna use memo now
dw, day 10 will take 5x longer than the entirety of days 1..9 
Multiple listeners for a web endpoint? I doubt that's the case. Although Cloudflare Workers does run in multiple datacenters all around, no reason it would be triggering twice unless they received it twice..?
it could happen anywhere in the communication layers, you should verify if discord actually sent two identical requests
if not, it may be a cloudflare worker quirk
I know they'll retry if no response is received within 5 seconds, but it's very intermittent when this happens.
cloudflare workers wouldnt duplicate requests, only way is if you receive 2x requests
strange issue though do you have any logging setup in the worker to see if it is indeed 2x different requests?
π₯π₯
i wanted to do holidays
wtf
meh "Source Code Exposure" not that too deep
π
DoS as well as shell access in such a short timespan isnt looking good for react
Glad I never adopted
glad im sane
π DMs and Groups
What all do you have left
Well i have barely worked on message stuff at all or per-channel permissions
I build Discord bots, latest one builds out a whole server, channels, roles, sorts permissions, welcomes people anti raid etc etc usese ai and asks quesions with free input option and pretty much does it all, now i have no idea where to get people to test this, its mainly for brand new servers and hopefully helps those with not too much knowledge on how to setup servers... well... set em up haha
but yea if anyone here wants to test ? or has suggestions for me on where i can get people who want to test that would be super helpful
didnt veld or oliy build something like that too
and that got spammed?
Dont you mean they tried using Guilded?
And it got bot spammed so they had to lock it
Wanna try a demo of it Aurel?
Nah
There was a chat app
There was hu?? π
web client isn't there apparently
good ol days
that's dangerously close to discord
at last, aoc done
OH GOD
that's a fire logo tho
@prime cliff do u want my logo, I will pass the torch 
web = desktop client btw
btw you guys can't see this 
Woooooo
hell nah 100 hours π
what are you doing
100 hours is fine then
oh really? 
oh, fair enough
the remaining time now become 113 hours xD
guess i'll wait till tomorrow to see if the remaining time still adds up or not
dotnet supremacy
Funny you should mention that my chat app backend is C# too and the client is C# Avalonia :p
how is avalonia? I've been meaning to try building UI in dotnet, been eyeing Uno
Avalonia is a bit more mature than Uno and i had issues installing Uno due to some .NET SDK stuff.
If you need a more complex app then Avalonia is much better but both work either way.
dann
dam*
damn*
wtf iphone
wont that destroy the hdd lifetime tho?
hmmmm, some sources on internet says doing that will tell the hddβs firmware which sectors are bad and mark them.. you might be right, my hdd started βfailingβ when i tried to recover 2tb of lost data because windows installer formats the whole disk
If it's indeed writing to the hdd then it'll burn the sectors very quickly
Tho hdds are more resistant than ssds in that matter
Did u try checking the drive's smart report?
It usually reports any failure detected
in certain cases it is a good thing to zero out an hdd, there are cases where you may be able to "correct" bad sectors by repeatedly attempting to write to them
but in other cases it helps wear it down even further
the hdd's firmware will indeed only mark bad sectors when write+read fails multiple times, and doing that preemtively just offsets the problem so it doesnt get stuck retrying them during normal operation
yeah i tried, smart report already showing 0% health, tells me to backup immediately because the hdd will fail in few hours, it said
0% health lmao
but then, before i leave it to sleep, i tried using manufacturer's software , andd holy god it's back
yeah 0% = trash bin
the health went from 0% to 50%
so i guess yeah, zeroing won't always fix the issue
that complete drive test took 7 hours
looks like it doesnt have any actual realocated sectors, but it does have pending ones, those are gonna cause slowness and freezeing until the firmware decides to actually reallocate them
wdym it doesn't have any actual realocated sectors?
the no. 5 smart says the value is 200,,
depends from drive to drive, and the meaning of the values needs to be interpreted by the firmware, but from what i remember 200 is the initial value
140 is the threshold
and the value goes down as it gets worse
if it goes below 140 = bad
ohhh, what about pending sectors? it should be 200 too?
ye
back in the day i used to play with HDDRegenerator
this is what they claim:
Almost 60% of all hard drives damaged with bad sectors have an incorrectly magnetized disk surface. We have developed an algorithm which is used to repair damaged disk surfaces. This technology is hardware independent, it supports many types of drives and repairs damage that even low-level disk formatting cannot repair. As a result, previously unreadable information will be restored. Because of the way the repair is made, the existing information on the disk drive will not be affected!
last time i used it as like 15 years ago xDDD
and it as also a pirated copy
in some disks it did help a bit, in others didnt make a difference
xDD
afaik they just do a very aggressive cycle of read+write+read multiple times on every sector
Electricity go brrrrrr
yup
i would leave it running for 24-36 hours on 80gb hdds
For user agent, are URL/versionNumber supposed to be something specific? Mine? Discords?
https://discord.com/developers/docs/reference#user-agent
Build games, experiences, and integrations for millions of users on Discord.
Also wild that when I tried to markdown embed that same link it got blocked lmao
holy shit wolke
So just a URL to your bot and your bot's version number? That's what I was assuming, but I never got blocked for not providing this (yet) lmao.
I've been maintaining his Discord stuff for a while now
Realistically, you could use anything, but if you use your link and your lib grows large, then they provide stats for how many use your lib and allegedly get a section in the official ddevs server
I haven't talked to him in a while. He included me as an employee in a company he owned for building out apps for clients, but that server with other employees has been dead for a while. He occasionally pops around when I ask for some guidance. But he seems to be doing alright and moderately successful
If you have a connection to him, he'd probably value reaching out to him
I see he is a mutual
Oh, yeah that's irrelevant. This is all mostly custom coded lmao
O well let them have some stats ig lmao
hey guys
Hey
doesnt rust already perform small string optimization on strings?
that sounds basically like it
i dont think so for dynamic data
from 2018
We guarantee that we will never perform this optimization for Vec: https://doc.rust-lang.org/std/vec/struct.Vec.html#guarantees. I donβt think the same is explicitly documented for String, but String is simply a wrapper around Vec so it still holds there at least in practice.
thats odd, i was under the impression it did
its basically expected to happen for strings in many languages because it offers massive speedups when dealing with strings
my day is officially ruined because of that
afaik its to simplify the std so unsafe code is safer
imagine trying to do raw pointer shit if every vec was optimized to nirvana
well time for me to switch most of my strings to this
yeah i guess that does make sense in theory, but is it really worth having every string equal an allocation?
same, in fact ill do it now
keyword most
if i know a string has a 95% chance of being longer than 24 bytes, no point in changing
man i was just trying to find the vec based kvmap crate i forgor the name of
although, this crate says it can store 24 bytes max on the stack, but thats the size of the string struct itself? where is it storing a size/boolean that determines whether this is heap allocated or stack allocated? since the struct itself will act as a union to achieve the stack storage, unless it does something else
that is very clever
this crate is basically a free rust performance boost considering it doesnt already do this for strings
yes
and finally fixes my 1.5gb unused heap problem
it also lowers string allocation rate
from 2x to 1.5x
nice addition imo
although this only works really well in rust because it validates that any bytes are utf 8 before they are stored in a string, in a lang like c++ a string is literally just a bunch of bytes which could be any value from 0 to 255, so unless you enforce that same runtime safety check for bytes that rust does for utf8, you cant achieve that otherwise
youd have to sacrifice one or more bytes on the stack for tracking the state/length otherwise
so youre sort of trading performance for compactness in this case, but rust already verifies all strings are utf8 so in the rust world youre technically not paying anything extra
but still incredibly clever way to leverage the fact that strings are guaranteed to be utf8 in rust
why though
utoipa
nvm i have genius idea
ill make a submodule
and implement utoipa for it myself
the beauty of open source
ah
--features serde
nice
although doesnt seem to support rusqlite sadly
perfect
.as_str()?
ah wait fromsql
rip
although may be worth porting to another sqlite3 lib? been thinking about it for a while since i eventually want to support other dbs as well not just sqlite
sqlx, trust
rusqlite is fast but a bit annoying to work with
lol
i have one of my ci/cd checks run on a very low powered x86 oracle server simply because i pity it, this is the only check it can run without shitting itself and still it takes 5-10 minutes to finish
might just kill that server alltogether and move that final check to run on my arm server but might come in handy some day for an x86 only project
Pog audit logs and webhooks
we have discord at home
Hey
π
let bro build his chat client π π
Hello
realest shit
'for no particular reason' π
We have veld chat at home
I'm thinking of parallel hosting soon, Flask or Quart π€
10/10
wait this is kinda goated
Dont forget to add the Nitro paywalls
Already got a bunch of stuff added yea, gonna work on mobile compatibile UI now π i can do android adb
You want to see a live demo of it Veld π
yes please
DM π
Any chance I could π
Sent π
Awesome thank you
very cool 
I agree
Thanks β₯οΈ it's actually my first time using avalonia since 2 months ago so i need to learn how to design it better.
I also want to add more customized features like full user profiles (how guilded works), calendar type channel, more split permissions and other stuff.
Maybe even have like customized component channels for bots a bit like slack
@prime cliff dm?
Why
I have to ask something
How we can deploy our bot after coding
And how am i supposed to know what language or tools you're are using?
You need a host
How
Python
You can either buy a server ($3 month) or use a free hosting service (not recommended) such as:
https://render.com/
Pella.app, bot-hosting.net and WispByte
Thnx
For hosting I'd recommend northflank- Thats what I use for a bot thats in 50+ servers atm. They can be a-tad expensive. But they have a "free plan" for like 3 months and they aint on a fix rate. Its all depending on how much the bot is used.
Example for me its around $15 per month for a bot in 50 servers
so if its a 1 bot you might even be able to get away with free
but even as free they are good
damn veld moment
$15 for 50 servers seems a bit excessive π
just get contabo since you donβt really care about performance πΏ
That also includes built-in health checks, Database and storage.
For host on its own its like $5-7
Still overpriced
Eh i mean if they want extra stuff then sure it's worth it
Hetzner β¬3.49 for 4gb ram and 40gb ssd
Install database on there
Health checks can be done for free with https://betteruptime.com
Yeah this is super expensive. For that price you could buy a raspberry pi for the price of 4 months of hosting and be able to host pretty much forever
I wouldn't say that now with ram prices xD
topgg devs, How do you verify that a user is actually the owner of a bot before adding it? Is this manual? If not, how do you do this in a programmatic way?
I'm desperate for a solution to check the owner applications programmatically.
They don't afaik
jeez
I never tried it because I didn't see the reason for it but I saw some people complaining that their bot was added by someone else
YO I actually found a way. Application owned emojis are a way.
it includes the user field and I can verify the asset as well
The user object refers to the bot user
I know no bot that allows users to upload to application emojis since there are only 2k
So it could be a bot user
Alright. I know a few people upload them programmatically
if it way uploaded via a command, then yes.
well for verification you have to go to the dev portal and do it manually.
that is a neat way I think.
What if a team is already at the emoji limit and they're unwilling to upload a new emoji
Would you support an existing emoji
nevermind, there is a better way with oauth2
if the user matches, yes
also, 2k emojis is a VERY high limit
its an acceptable edge case
builds are a different thing from bots
the app devs would have to submit builds to Discord to show on the now dead Discord games library
no, this scope allows you to fetch a route and get a status code apparently which indicates owenership

Asking on ddevs > searching docs
I did many things lol
I now made a discussion on GH
https://github.com/discord/discord-api-docs/discussions/8035
lmao
a system where you invite a topgg bot and your bot into a server and make it output a specific string would be a cool verification method
albeit complex so maybe just in the bots bio
adding dyno to my profile as we speak
You can't access bio via API afaik
yes, sadly
Heya guys quick question:
if (config.topggToken) {
try {
const poster = AutoPoster(config.topggToken, client);
poster.on("posted", (stats) => {
console.log(
`π Posted stats to Top.gg | ${stats.serverCount} servers`
);
});
poster.on("error", (err) => {
console.error("β Top.gg AutoPoster error:", err);
});
console.log("β
Top.gg AutoPoster initialized");
} catch (error) {
console.error(
"β Failed to initialize Top.gg AutoPoster:",
error.message
);
}
} else {
console.warn(
"β οΈ Top.gg token not found in config - AutoPoster disabled"
);
}
returns:
β Failed to initialize Top.gg AutoPoster: Unsupported client on my raspberrypi5 server
But it fully works in windows10
Are you sure your client is initialized? I imagine that if client is null it would be problematic
Found the issue
My node packages had a conflict and for some reason it didn't load correctly
I reinstalled packages and got it to work 
$ rm -rf node_modules package-lock.json
$ npm install
Probably stupid but I just learned a fun way to swap integers without a variable being a middle man:
https://discord.mx/i/pVtv7gl2UA.png
Yeah thatβs xor for you
yeah i knew like a^b^b == a but i never correlated that
because im used to python or js where i just do, a, b = b, a
it is indeed stupid
a temp is generally faster
faster like code execution wise?
id suspect this to be faster since it's just doing bit operations but I don't know much about C languages
yes
the xor trick messes up CPU pipelining
i would be lying if I said I knew what that meant
afaik its also just straight up more instructions anyway
and realistically if it were faster than swapping then it would be implemented by optimizing compilers
ah yeah that's true
my general advice is that you should only focus on optimizations at the macro level until you know you need them at the micro level
focus on structuring your code in a sensible way
I knew I wasn't crazy -_-
π
yoo awesome
I think embeds should suffice for now time to work on message replies next with a max of 3 π
bawesome
https://www.threads.com/@githubprojects/post/DSS_0HYkrQG?xmt=AQF0JD5lS5v9rTXwKLpwC13tnMi0sb9XPTws3FC8uI21AvCbauuKliD9w-gqat8tB6Qf5uI8&slof=1 lmao this is funny
actually a good idea xD
Just round robin your website so half the people land on the fake error page 
you dont need to fake one, real ones happen often anyways
I really like the vscode one
the go one π

