#development

1 messages · Page 282 of 1

empty abyss
#

I made a /config command that just tells the user that config must happen on the web portal, with a link the the portal.

Any attempt to run the other commands before being configured will just say that the bot isn't configured.

warped summit
#

-# 2 cute 🥰

warm canopy
#

Ayeee approved at last ❤️

tall bay
#

wow my bot got verified so fast thanks @knotty night

knotty night
#

my pleasure

quasi lark
#

so my bot runs half on a website but does anyone know how i can run it for free?

sharp geyser
#

There is no free way to run it

prime cliff
sharp geyser
#

I mean you dont gotta respond like that

#

It's not an uncommon question

#

Especially since so many "free" options were shoved down peoples throats

delicate zephyr
deft wolf
#

And there is nothing about shared IP address? weirdsip

slender wagon
#

No promotion here, datalix and digital ocean are by far the better vps providers

#

One is a bit expensive tho

slender wagon
quartz kindle
#

google compute engine has an unlimited free tier

#

they do charge you for excess bandwidth tho

#

still, my bill is usually a few cents per month

pearl trail
quartz kindle
#

yup

pearl trail
#

interesting, what i only know is that they give $100 credit, not unlimited free

quartz kindle
#

their system is weird af

#

but yeah they do give you a "monthly" credit on certain things, effectively rendering them free up to a limit

pearl trail
quasi lark
hidden gorge
#

So i'm updating users and how i store them, does this schema look good?

#

i think ima rename flags to permissions

wheat mesa
#

Although afaik you changed it a few weeks ago

hidden gorge
wheat mesa
#

Good

hidden gorge
#

its a salted and hashed password

wheat mesa
#

But yeah I wouldn’t use flags as the name, rather permissionFlags or permissionBits

#

Flags is a bit too vague

hidden gorge
rustic nova
hidden gorge
crystal wigeon
#

do bot reviewers get paid here?

deft wolf
#

No, but I guess those who are the most active get some kind of compensation

frosty patio
crystal wigeon
#

gotcha

quartz kindle
#

they only charge for bandwidth exceeding 1gb per month

crystal wigeon
#

i believe they charge per hour

#

or did they change

#

you are talking about compute engine right?

#

cause i got billed just for having the dedicated vm

#

even when it was idle

quartz kindle
#

yes im talking about the free tier

crystal wigeon
#

ah

#

i might've used a diff machine

quartz kindle
#

yeah if you use any different settings from the above then it doesnt count as free tier

#

i have some stuff running in there for 5+ years

#

occasionally i get billed a few cents lol

deft wolf
#

Crazy advertising

quasi lark
knotty night
#

I would say, I assume you have a transcript system also for the tickets?

#

But I mean, looking at the system you currently have it seems like a really good build, love the UI. So not much I can add right now.

quasi lark
#

well its with mongodb right now and there are the messages saved

#

you can do /setup for a "notification channel"

#

but i dont know what i can add so people like it more

rustic nova
#

weirdchamp ads

quasi lark
frosty patio
#

I feel like tickets on discord are better you won't have to open the browser and look for ticket it goes straight to a discord channel where admins get pinged

zinc fable
#

@quasi lark hi luca please dont advertise here 🙏 (doesn't seem like you intended to but it does come across that way)

neon leaf
#

5x faster for just using native file copying 🙏

hidden gorge
#

there has to be a better way to do this...
-# ik i added the wrong bsonType i fixed it

quartz kindle
#

you could always use bitfields

hidden gorge
quartz kindle
#

well im guessing you have to follow that specific schema format no?

quartz kindle
#

so not really much choice there

hidden gorge
#

i just do this when it creates a new user

quartz kindle
#

do the notification types never overlap? there will never be a notification that can be sent both by push and email?

#

whats the difference between event reminder and event announcement?

quartz kindle
#

then the format looks fine

hidden gorge
#

and i wondered why user creation wasn't working....

quartz kindle
#

lmao

hidden gorge
#

yeah apparently i thought i coded it but i didnt

wheat mesa
#

Axios and express

#

Rahhhh building on an outdated tech stack on a new project 💪

hidden gorge
quartz kindle
#

pro stack = fetch + node http
extreme stack = undici + uws

hidden gorge
#

i only use express bc it was what i first used for web dev and tbh found it easy to get stuff online

quartz kindle
#

tbh using express these days is fine, because there are plenty of drop-in replacements for express that use uws under the hood

#

for example hyper-express and ultimate-express

hidden gorge
#

also this project is slowly killing me

quartz kindle
#

wanna work on mine instead? its been killing me for years

neon leaf
#

I remember doing sketchy ci modifications to remove unused uws binaries

neon leaf
#

because they were like 90MB 🙏

quartz kindle
hidden gorge
#

tbh im glad i dont host images on my vps

#

saved soooo much storage

#

expect this happens....

quartz kindle
#

just checked

neon leaf
#

yea

#

not much you can do except modify the install script to nuke unused ones

#

but that could break stuff

hidden gorge
#

do you guys think that Cloudflare R2 will be good enough for a long term use?

neon leaf
#

I use cf r2 for 1TB of garbage

#

only 25€/month

#

so yes

hidden gorge
#

anything other then that i use Mongo

neon leaf
#

wasting github runner resources to do musl and gnu at the same time 🔥

hidden gorge
#

also i very much recently learned the importance of github....

quartz kindle
#

one time i saw someone running a discord bot inside github actions

neon leaf
#

your account may not exist after doing that though

quartz kindle
#

xD

neon leaf
#

tim when star new repo(s) 🙏

prime cliff
pine willow
#

Does anyone know how I can register my slash commands as user installs on discord.py???

#

who tf are you now

#

I wont join this stupid bitcoin server

#

@harsh nova welp

#

did he got banned or did he delete his message

prime cliff
pine willow
#

???

prime cliff
#

So yes it did get deleted lol

pine willow
#

could been so "mods" wont see it and ban him

#

yk

#

because my client says he is still on this server

hidden gorge
prime cliff
#

I wont have that issue because the person helped me setup a neat package system.

:latest (Latest version release)
:v1.0.43 (Specific version)
:master (Development version)

hidden gorge
quartz kindle
#

gg github star trading

prime cliff
#

You forgot to star mine Tim mmLol

prime cliff
#

Now all i need to do to run multiple agents on servers is a quck command 😄
So much nicer than manually downloading files and compose.

docker run -d \
    -p 5555:5555 \
    --name devspace-agent \
    --pull always \
    --privileged \
    --restart on-failure:3 \
    -v devspace_agent:/app/Data \
    -v /var/run/docker.sock:/var/run/docker.sock:ro \
    -v /var/lib/docker/volumes/portainer_data/_data/compose:/var/lib/docker/volumes/portainer_data/_data/compose:ro \
    -v /var/lib/docker/volumes/portainer_data/_data/custom_templates:/var/lib/docker/volumes/portainer_data/_data/custom_templates:ro \
    ghcr.io/fluxpointdev/devspace/agent:master```
hidden gorge
#

127.0.0.1:5556:5556?

#

thats so weird

prime cliff
#

Bind to localhost (docker default opens the port to the internet)

Updated config i did the wrong one

hidden gorge
#

also i think i found a better way to handle connection notifications so i dont have to add events for every route

#

in the actual toast Notification manager i just added the event there 💀

sharp geyser
#

💀

hidden gorge
sharp geyser
#

basically 5555:5555 says bind 5555 to localhost port 5555

#

instead of exposing it openly to the internet

#

I think builderb even explained that

prime cliff
unkempt aspen
#

@steel scaffold What page on my bot web page did you visit that caused a 404 page?

steel scaffold
quasi lark
#

hi im making a bot and i wanted to ask if anyone would wanna test it for feeback

hidden gorge
prime cliff
#

You recorded your music too kek

hidden gorge
#

and i forget that i record Dekstop Audio

sharp geyser
#

Sounds like some brainrot music too

hidden gorge
lyric mountain
#

add the browser to steam to use its playback feature smirk

lyric mountain
#

steam has recording now, u can just add whatever exe to it as non-steam game and it'll be able to use it

hidden gorge
#

oh

neon leaf
pearl trail
#

epic

#

blurry pic :(

neon leaf
#

🙏

#

gcam on samsung moment

pearl trail
#

xD 🙏

sharp geyser
#

need more ram

neon leaf
#

yes actually

#

1 stick isnt being detected...

hidden gorge
#

I Can't fully remember would using a url like this: http://localhost:900/v1/users/68390942902cf413c68ed12d/update/profile.bio and calling profile.bio for my field param would that work properly?

url base: /v1/users/:userId/update/:field

sharp geyser
#

It’s not advised to use periods in a url path

#

It’s allowed yes but it can cause issues if used improperly

#

Why would you want to do it like that?

#

A typical patch request is you sending what you’re updating in the body not the url path

hidden gorge
sharp geyser
#

That still doesn't explain why you are doing this in the url

lament rock
#

Why not just PATCH a whole entire profile JSON

#

instead of a field

hidden gorge
#

idk but i did just make it so endpoints that update a user require a JWT token to be passed aswell

lament rock
#

Something like
PATCH /v1/users/:userId

{
  "name": "newname",
  "bio": "I'm pretty cool!"
}
#

And if the endpoint requires a token, could do @me for the userId param if you're allowed to edit other users to refer to the current user

sharp geyser
#

Thats what I was saying

#

Technically you could also have the @me endpoint call the /users/:userId endpoint if you wanted to save yourself trouble, but idk how that looks like with overhead and what not

#

my lazy ass would do it

#

lol

lament rock
#

Yep. editing individual fields is gonna just lead to more traffic if the user needs to bulk edit. And if you're gonna have an endpoint to edit everything in one go, basically no one will use the individual field endpoints

#

less backend traffic is important

sharp geyser
#

yerp

hidden gorge
#

i hate this...

sharp geyser
#

I hate looking at that

hidden gorge
sharp geyser
#

I can already tell you ignored us despite asking for guidance. If you want to continue doing it the way you are be prepared for a lot of problems down the road

#

The way you currently do it will get annoying to handle as you scale and get more users

#

You’ll see an increase in redundant traffic that could be fixed

hidden gorge
#

i listen to your ireas

#

ideas*

#

its just rn i'd rather get it working

sharp geyser
#

Why?

#

You’re getting something working that you’ll "later" change

#

Whereas you can spend less time just implementing it properly

neon leaf
#

rip 1 stick 💔

sharp geyser
#

You’re basically wasting time on a path that won’t be walked

hidden gorge
sharp geyser
#

I don’t understand the thought process behind it

#

But you do you man

#

Pushing an inferior product just sounds like a bad idea

#

When the fix is actually more simple then getting your version working

sharp geyser
#

Or am I reading that wrong

neon leaf
#

24 cores, 48 threads

sharp geyser
#

Ah right

#

That makes more sense

neon leaf
#

just a little

sharp geyser
#

Bout to say damn

neon leaf
#

i dont think there was ever any mobo over 8 cpus

lyric mountain
#

48 epycs would be a little overkill

sharp geyser
#

A little?

lyric mountain
#

🤏

sharp geyser
#

What are we Google

quartz kindle
#

google we are what

pearl trail
#

hey google

dusk tangle
#

hey siri

remote flicker
#

wsg yall

humble orbit
#

q jarvis

sharp geyser
#

Hey alexa

hidden gorge
#

Hey bixby

lament rock
#

Hey Cortana

hidden gorge
#

Hey IBM Watson Assistant

pearl trail
sharp geyser
#

Yeah so

#

This is almost Sayuri level shit

prime cliff
#

How is that exactly gonna work on mobile though xD

quartz kindle
#

dayum

sharp geyser
pearl trail
sharp geyser
#

Spent the last 5m wondering why my tailwind styles weren't applying

#

forgot I needed to add my fuckin app folder to the content array in the config

pearl trail
#

that must be painful, good that you realized in just 5m xD

quartz kindle
#

my vsc randomly stops showing tailwind intellisense

#

and then randomly works again for some reason

pearl trail
#

KEK that happen sometimes to my webstorm, need to invalidate cache or it'll never work again

lyric mountain
quartz kindle
#

i swear someday i will hire sayuri to make me a website

long marsh
#

😮‍💨 converted my discord bot from Python -> GO

#

Immediately saw massive performance gains.

queen needle
#

Go 💪

long marsh
queen needle
#

I've used it on a couple occasions, I really like the language

wheat mesa
#

I hate the error handling

long marsh
#

I've never agreed with try/catch

#

Always felt like a hack

wheat mesa
#

Try catch is a mess but I despise the if err != nil pattern

long marsh
#

Besides a result syntax? Which would inevitably still be if !res.ok littered throughout the codebase

#

Seems like we're on the same page, Waffle – I'm just always curious why folks hate the if err != nil pattern

wheat mesa
#

It feels so archaic

long marsh
#

That's what makes it so great - simple, boring, verbose, and to the point.

wheat mesa
#

It feels like your code is more about checking for errors than actually handling them. Bubbling them up would be a massive improvement, similar to rust’s ? operator

queen needle
#

y'all handle errors 🤨

pearl trail
willow ether
#

I don't absolutely hate the if err != nil pattern but I feel like Rust's error pattern is better.

dapper gorge
#

Im making my first bot that I wanna make public should I make ! commands or slash commands?

feral aspen
#

1Gb/s download & somehow the website's download is less than 10Kb/s.

lament rock
# dapper gorge Im making my first bot that I wanna make public should I make ! commands or slas...

message commands are deprecated and are not a valid reason to receive the message content intent. If that's all your bot needs message content for, don't bother with it. Slash commands do multiple things for you as a dev - type verification of arguments and reducing traffic from what otherwise would be message create events.

The type verification means significantly less processing command names, arguments and their types, message formatting, etc.
At scale, message create events will slow down your thread a lot depending on when you shard and how. Regardless, you should strive towards reducing how much work your thread does processing useless things

elfin helm
frigid ibex
#

I haven't got any message about my bot being reviewed

#

my bot add on link is:,

dapper gorge
frigid ibex
#

it's not unsafe , its my bot link

#

bcs im using bot in my server

hidden gorge
#

i think it needs more scripts right?

lament rock
#

No. You should actually combine your scripts and minify them automatically if you can to reduce the amount of requests and data transferred

sharp geyser
#

Yeah

#

each script tag will make a new request iirc

tacit estuary
#

"c:\Users\removed\AppData\Local\Programs\Python\Python313\Lib\zoneinfo_init_.py" is overriding the stdlib module "datetime"PylancereportShadowedImports @sharp geyser

hidden gorge
#

all scripts

sharp geyser
#

or a import from it

neon leaf
sharp geyser
#

Poorly optimized sites

hidden gorge
hidden gorge
sharp geyser
#

Why do you think its so laggy sometimes?

#

and shit takes forever to update visually

#

even after refreshing

hidden gorge
#

oh

sharp geyser
#

Here's my websites current script tag usage

hidden gorge
#

yeah i see it now

sharp geyser
#

No idea what any of em are either

#

Since they are all inserted by nextjs

hidden gorge
#

yeah thats bad on roblox

#

mines better

#

bc less data

lament rock
#

All of this

#

Becomes this

hidden gorge
#

also i almost mad a veryyyyyy big mistake

lament rock
#

just 1 js file minified and it's great

hidden gorge
#

i was accidently leaking the main API key on each websocket message to all clients 💀

lament rock
#

How do you manage that

hidden gorge
#

i just did this to fix 💀

neon leaf
hidden gorge
#

huh?

hidden gorge
neon leaf
#

sse would probably be enough

hidden gorge
pearl trail
#

ws but 1 way

neon leaf
hidden gorge
#

oh

#

i plan to use WebSockets more in the future so i'll think about it

neon leaf
#

since cloudflare limits active websockets

queen needle
hidden gorge
#

i was gonna use WebSockets to send live location updates and incident locations

neon leaf
#

yeah thats good for sse

queen needle
#

Like for bug handling?/error catching?

hidden gorge
#

i have an interactive map system

#

and its used for incident logging and more

queen needle
#

ohh

#

Still sounds like sse

hidden gorge
#

i need to update calls, car locations and more live

queen needle
#

unless you update it, for everyone to see

hidden gorge
#

we do

neon leaf
#

even then, if its not often, you can simply use a seperate http call

hidden gorge
#

it live updates to everyone connected to the screen

neon leaf
#

many services also simply skip ws/sse entirely and just update data on an interval

hidden gorge
#

also i accidently made black icons on a black backround 💀

queen needle
#

http polling is also an option if that wasn't what you were describing

hidden gorge
#

okay let me run an example of what im gonna do

#

each icon is a call location, as soon as a dispatchers creates a call it would update across all connected clients to our live map and would create an icon and read out the call data

neon leaf
#

sse

hidden gorge
#

okay

#

also idk why i made it so detailed

radiant kraken
#

@tacit estuary what are your warnings?

tacit estuary
#

"c:\Users\tails\AppData\Local\Programs\Python\Python313\Lib\random.py" is overriding the stdlib module "random"PylancereportShadowedImports

#

The entire code works perfectly fine, but the yellow lines are just there.

pearl trail
#

wait

#

oh

#

nvm it works

radiant kraken
pearl trail
#

sorry

#

🙏 🙏

frosty patio
radiant kraken
#

you're goat at C!

pearl trail
#

nah, thank you <3

radiant kraken
#

i could refactor your C code if you want!

pearl trail
#

thank you! but it's an assignment so,, yeah. i won't be using it after i submit it

radiant kraken
pearl trail
#

afraid the lecturer see someone make a pr, tho they maybe don't care

#

:(

radiant kraken
#

i saw your C code, you've done a pretty great job!

#

even for my standards haha

#

i'm sure your lecturer will give you a satisfying score, as your other grades have been looking

queen needle
#

I have one C project, it's horrible, but I don't use c so it's okay

pearl trail
radiant kraken
#

and an honor to be besties with a web pro!

pearl trail
radiant kraken
#

implementing algorithms and data structures in C is so fun

queen needle
#

Nu huh

#

No data structure implementation is fun

radiant kraken
#

most of it is fun at least

quartz kindle
#

sveltekit with bundleStrategy: "single"

quartz kindle
#

how do they even manage to make it that bad

#

thats what happens when you have huge teams throwing crap on top of crap without caring about what other teams did and how the stack even works

queen needle
#

this is what im at rn

neon leaf
#

saving those 7 bytes 🔥🔥

quartz kindle
#

i wouldnt be surprised if they had multiple different systems that do the same thing running at the same time

hidden gorge
#

like mine is almost 3 MB

#

but i have high quality images rendering

quartz kindle
#

ye thats not bad

#

if its images and you absolutely need them in high quality then its fine

#

i like to compress and optimize mine

hidden gorge
quartz kindle
queen needle
quartz kindle
#

for static images, i make them all 1280x720 (if they are full screen), or close to their real size if they are smaller
and then i run a bunch of optimizers on them

hidden gorge
neon leaf
#

you can definitely compress those alot

hidden gorge
#

and they are like in the 20 - 30 MB ramge

neon leaf
#

they are blurred

quartz kindle
#

i've been using this for years, its pretty cool

queen needle
#

you could run what's it called

hidden gorge
queen needle
#

the one algorithm that generates the like blurry image for preview

quartz kindle
#

blurhash, placeholderimage, etc

queen needle
#

Yeah that would work for backgrounds like that where they're already blurry, and keep the resources down

quartz kindle
#

also thumbhash

queen needle
#

thumb hash is the one i was thinking of

quartz kindle
#

theres also one called "Potato WebP"

#

lmao

#

thumbhash seems to be the better one though

neon leaf
#

why did noone tell me I can do this

[profile.dev.package."*"]
opt-level = 3

[profile.dev]
debug = false

[profile.release]
opt-level = "z"
lto = true
#

compile deps in release mode and app in debug ??

#

1s builds that are fast

#

cheat code

quartz kindle
#

hax

neon leaf
#

I can finally do a 50mb sha1 in 100ms instead of 500ms in debug mode 🙏

queen needle
#

LMAO

sharp geyser
#

You guys know those websites that like offer services for colleges and such

#

They have a "Find your campus" that it then redirects you to the login page for that campus to authorize yourself and then you are brought back

#

Is that normal oauth or what? Can you do that without the colleges consent?

#

What im basically asking is, do you have to partner with the university(s) to be able to have them login directly with their credentials and be brought back or is it just using microsoft/google oauth and targeting a specific organization in the request

spark flint
#

you have to get the college to allow the oauth app for the entire organisation

sharp geyser
#

I just figured that out

#

Have you gone through the process of getting a college to allow it

#

Who'd you talk to?

spark flint
#

head of IT

sharp geyser
#

Is it good on google's side then for colleges who use workspace?

spark flint
#

i had to get permission from them with proof of what it does, how it stores data, where it stores data and an example data export of their user data as proof

sharp geyser
#

I mean I dont think its super urgent right now

#

since I can use personal accounts

#

but this is something I didn't consider

#

Stupid of me not to

wheat mesa
willow ether
#

I hate everything about HTML Canvas.

quartz kindle
broken zenith
#

is it possible to make a command like /votes and see how many times you voted for the bot

pearl trail
#

of course, save a counter for a user in db and increase it everytime a user voted via topgg vote webhook

willow ether
#

Just converting x,y coordinates from the user's plane to a zoomed/rotated/scaled element is asinine because of the way css works

quartz kindle
#

are you zooming via css or rescaling the actual canvas?

#

are interacting directly between css coordinates and canvas coordinates?

neon leaf
#

how is this even possible

#

all other jobs are done 🙏

willow ether
#

I hate it

quartz kindle
willow ether
#

Canvas already does line art and crap using vectors.

#

I just have to manually set scaling factors for stroke and dimensions (did I mention I hate canvas?)

quartz kindle
#

an svg layer could be manipulated without having to redraw pixels

#

especially so for an interaction layer that has css effects like hover

willow ether
#

yes

crystal plover
#

Need a bot reviewer

#

I just made mine and need some tips for advancement

compact condor
sharp geyser
#

What exactly are you asking

#

I personally see nothing wrong with how you are currently implementing it

compact condor
sharp geyser
#

yeah no it all looks rather clean and straight cut

#

Though I do wonder about the excessive use of String

#

Null can correct me if im wrong here but String isn't exactly needed here

compact condor
#

I'm also asking since I'm new to rust and this project is to understand it and learn from it

sharp geyser
#

Yeah

#

From what i picked up of my year of using rust

#

&str is much more advised here

#

It isn't an owned type, it is cheap to copy if need be, and there's no memory allocation from what I recall

#

Also its better for read-only strings since you can't modify it

#

String -> if you need mutable text
&str -> if you need read-only text

compact condor
#

ic, will look into it and modify it using &str, thanks for the advise onionpray

sharp geyser
#

But again I can always be wrong so I still recommend waiting for null before changing anything :p

compact condor
#

whoops I'm a bit too hasty

sharp geyser
#

One thing I do remember null always yelling at me for is not using &str more often ahaha

#

I used String so much

#

😭

#

null is currently asleep sadly, cause I am also curious to know if im right 😭

sharp geyser
#

Anywayy, good luck matey and hopefully I wasn't too confusing

neon leaf
#

you can use a Cow<'a, str>

sharp geyser
#

Well yeah you can't exactly copy a &str in the formal sense

compact condor
sharp geyser
#

👍

#

Well im off to try and continue implementing stripe iara2_pain

neon leaf
#

string slices are not Sized

#

you cannot do anything with them except share them and read them

#

same as a normal String struct

willow ether
#

Don't worry about &str vs String too much, you won't notice a lick of difference on hardware and premature optimization is bad

#

Just get it working, get it right, and then make it fast if you need to

radiant kraken
#

yes!

#

since you can't really store &strs in serde serialize/deserialize structs

#

i guess you could store Cow<'a, str>s but that would be too much work, just go with Strings

#

though i suggest you use a String instead of &str for arguments here, since it saves users from reallocating the same String through to_string() if they already have a String

    pub fn new(label: String, style: ButtonStyle) -> Self {
        Self {
            component_type: ComponentType::Button,
            label,
            style,
            custom_id: None,
            url: None,
            disabled: None,
            emoji: None,
        }
    }

    pub fn with_custom_id(mut self, custom_id: String) -> Self {
        self.custom_id = Some(custom_id);
        self
    }

    pub fn with_url(mut self, url: String) -> Self {
        self.url = Some(url);
        self
    }
neon leaf
#

wouldnt Into<String> be an option?

#

existing Strings wont change

radiant kraken
#

yeah, that works too

neon leaf
#

&str are still accepted

#
    pub fn new<S: Into<String>>(label: S, style: ButtonStyle) -> Self {
        Self {
            component_type: ComponentType::Button,
            label: label.into(),
            style,
            custom_id: None,
            url: None,
            disabled: None,
            emoji: None,
        }
    }

    pub fn with_custom_id<S: Into<String>>(mut self, custom_id: S) -> Self {
        self.custom_id = Some(custom_id.into());
        self
    }

    pub fn with_url<S: Into<String>>(mut self, url: S) -> Self {
        self.url = Some(url.into());
        self
    }
radiant kraken
radiant kraken
neon leaf
#

shhh I only have 2 published crates rn

#

im not doing much libs

#

I dont usually use Into<String>

frosty gale
#

i try to keep my rust as barebones as possible so i never get into stuff like templates, traits or stuff like that

#

only impl so that i can continue with my beloved oop pattern

neon leaf
#

oop 👎👎👎👎👎

radiant kraken
#

there's nothing really wrong with using too much generics

radiant kraken
#

generics are so cool

frosty gale
sharp geyser
#

Has anyone every expressed how painful integrating stripe is?

compact condor
frosty gale
#

especially the zero cost abstractions like classes (if you code them correctly)

neon leaf
neon leaf
radiant kraken
#

yuuhhh!

quartz kindle
#

missed opportunity to template it as <T, F, Uck>

radiant kraken
#

well you can

frosty gale
#

that sounded overly aggressive

quartz kindle
#

:^)

neon leaf
#

oh yes my beloved ts generics

#

my longest one was 14 lines

#

of pure type

radiant kraken
#

i remember having to write four generics in one function in rust

frosty gale
#

in ts i just use any or unions for anything with variable types i think id get sick trying to use templates

quartz kindle
#

i tried making a c++ template for all possible type combinations on a key value store (ie, <int, int>, <string, int>, <int, string>, etc)

#

it took ages to compile and the binary was almost 100mb

neon leaf
#

oh or my ts middleware system that had to carry types throughout my entire webserver

radiant kraken
#

💀

frosty gale
neon leaf
#

300mb

#

🔥

radiant kraken
#

ugh hate how drastically rust binaries inflate once you add a dependency

#

like i'm talking 300kb -> 5mb

quartz kindle
#

is there no tree shaking?

frosty gale
#

rust's cargo is basically node modules in nodejs

neon leaf
#

I just set my optimization to z for my github releases

neon leaf
#

if you use a high enough optimization

neon leaf
#

ye

quartz kindle
#

z for dragon ball z

neon leaf
#

z is basically max perf (except vectorized loops) + minimal size

radiant kraken
#

what about --release?

neon leaf
#
[profile.dev.package."*"]
opt-level = 3

[profile.dev]
debug = false

[profile.release]
opt-level = "z"
lto = true
radiant kraken
#

oohhhh

#

never knew that lmfao

#

thankies!!

neon leaf
#

np

radiant kraken
neon leaf
#

I love the first part

#

it compiles ur deps in release mode

#

but app in debug

radiant kraken
#

what's the opt-level for --release then

neon leaf
#

default 3 i think

radiant kraken
#

oh

neon leaf
#

lto is like a level 4 but not

#

The lto setting controls the -C lto flag which controls LLVM's link time optimizations. LTO can produce better optimized code, using whole-program analysis, at the cost of longer linking time.

#

(5x slower)

sharp geyser
#

Yo ima be so for real

neon leaf
#

but doesnt matter in a workflow

sharp geyser
#

This is all cool and shiii but did you guys see the new minecraft movie

radiant kraken
#

no

quartz kindle
neon leaf
#

bruh

#

theres s

#

i hate myself

sharp geyser
#

minecraft movie is the bomb

#

little corny

radiant kraken
#

i skipped it when it got released in theaters

sharp geyser
#

but otherwise good

neon leaf
#
   Compiling api v3.6.6 (/root/projects/mcjars/www/backend)
    Finished `release` profile [optimized + debuginfo] target(s) in 13.76s
root@remotedev:~/projects/mcjars/www# ls -lh target/release/
total 147M
-rwxr-xr-x 2 root root 147M Jun  4 23:49 api```
#

tiny

radiant kraken
#

saved my money to watch sinners instead

#

worth it

neon leaf
quartz kindle
#

lmao

radiant kraken
#

me too

neon leaf
#

didnt know u could have vectorization and size optimization

quartz kindle
#

It is recommended to experiment with different levels to find the right balance for your project. There may be surprising results, such as level 3 being slower than 2, or the "s" and "z" levels not being necessarily smaller. You may also want to reevaluate your settings over time as newer versions of rustc change optimization behavior.

neon leaf
#

yeah my opt-level 3 binaries are 24M, z are 18M

quartz kindle
#

new workflow -> compile with all different levels, performance test them all, select fastest and/or smallest and publish it

neon leaf
#

just release debug mode binaries atp

neon leaf
#

I need the debug symbols for sentry

#

without them its more like 30M

quartz kindle
#

fastest way to calculate how many bits a given number occupies

neon leaf
#

...

sharp geyser
quartz kindle
#

x doubt

neon leaf
#

Math.random() ?

sharp geyser
quartz kindle
#

Math.random() is much slower

sharp geyser
#

I will tell you in depth right now

neon leaf
sharp geyser
#

Simply just don't. If you don't do it theres no need to time it

quartz kindle
#

:^)

#

this one is for unsigned

neon leaf
#

mhmh

neon leaf
#

imagine ur lang not having a fast u128 smh

quartz kindle
#

i decided to give it another try at my binary serializer

sharp geyser
#

Imagine having a lang

quartz kindle
#

playing around with it for a bit

neon leaf
#

Ive optimized it very far

#

smaller than tar.gz and zip

quartz kindle
#

quality typings

neon leaf
#

why jsdocs 🙏

sharp geyser
#

Looks about average for a project like it

quartz kindle
#

better than ts

sharp geyser
#

bah

neon leaf
sharp geyser
#

ts will always be better

radiant kraken
sharp geyser
#

I'd sooner shoot myself in the foot than use js

#

nah java types are worse

radiant kraken
#

great job!

quartz kindle
sharp geyser
#
public static <
    T extends Comparable<? super T> & Serializable,
    K extends Map<? extends List<? super T>, ? super Set<? super T>>,
    V extends Function<? super K, ? extends Collection<? super T>>
> Optional<? extends Entry<
    ? extends List<? super T>,
    ? extends Map.Entry<
        ? super K,
        ? extends V
    >
>>```
radiant kraken
#

EWW

#

NUH UH

#

get that away from me

neon leaf
#

Im not sure if any other archive format actually does "directories" like I do

neon leaf
#

mine are literal directories with entries

#

zips are just entry arrays, no directories with content

sharp geyser
#

I dont even know what it does

queen needle
sharp geyser
#

I just searched up cursed java generics

#

💀

neon leaf
sharp geyser
#

What is that

#

why does it exist

#

Guys

#

Have I ever said how much I hate stripe

#

cause I really hate stripe

neon leaf
#

I was held at gunpoint

sharp geyser
#

like my fucking god why do they make shit so complex with 250+ webhook events

radiant kraken
neon leaf
radiant kraken
#

sometimes i get confused at my old code

neon leaf
#

(never happened)

radiant kraken
quartz kindle
sharp geyser
#

I mean

quartz kindle
#

i like being able to copy paste the source and run it as is

sharp geyser
#

you can execute ts code

#

tsnode

neon leaf
#

or just node 23+

quartz kindle
#

not if i copy paste into a browser

neon leaf
#

or whatever

sharp geyser
#

Well thats your fault tim

#

ts isn't meant for the browser

quartz kindle
#

i often copy paste my code into dev tools for testing

sharp geyser
#

L

quartz kindle
#

i wanna be a multiplatform js dev

#

not node-only

neon leaf
#

become multiplatform assembly dev

quartz kindle
#

im making all my shit run in bun/deno/browsers

sharp geyser
#

Make your own browser that can run ts code tim

#

make bank

quartz kindle
#

exdee

#

btw

sharp geyser
#

Pretty sure its a thing already tbh

quartz kindle
#

isnt js gonna officially support partial ts syntax?

#

like type annotations

sharp geyser
#

yeah

queen needle
#

Yes

sharp geyser
#

I saw it in a proposal

#

on reddit

queen needle
#

I was trusting aaron's message

neon leaf
#

give it 8 more years

#

then maybe

sharp geyser
#

lmao

#

I saw it in a proposal

#

but there was mixed opinions on it

queen needle
#

I just want the |> proposal

sharp geyser
#

Some hated the idea

#

some liked it

#

others didn't give a fuck

#

💀

radiant kraken
#

i am indifferent with it

sharp geyser
#

tbh I could care less

radiant kraken
#

people's muscle memories could get used to writing |>

sharp geyser
#

I hardly use js or ts anymore

#

this project is the most i've used it

#

💀

neon leaf
#

what do you use now

sharp geyser
#

C#

quartz kindle
neon leaf
#

ew

sharp geyser
#

you use js

#

dont talk to me

neon leaf
queen needle
#

i use typescript elixir or go

sharp geyser
#

elixir is a lang I could never get behind

#

Cool in concept

radiant kraken
#

i've never tried elixir

sharp geyser
#

but the syntax is confusing

queen needle
neon leaf
radiant kraken
#

looks pretty cool tho

neon leaf
#

I use rust

radiant kraken
#

BASED

sharp geyser
#

What is |>

radiant kraken
#

BASEDDDDD

#

rust gang

sharp geyser
neon leaf
quartz kindle
sharp geyser
#

but before you hopped on the rust bandwagon you used js / ts

radiant kraken
sharp geyser
#

C# is a much nicer language

neon leaf
sharp geyser
#

Also I see PHP in there

#

🤢

quartz kindle
#

well, waste of space but sure

#

xD

neon leaf
neon leaf
queen needle
# sharp geyser What is `|>`
// Status quo
return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list);

// With pipes
return fn
  |> (typeof % === 'function' ? _xwrap(%) : %)
  |> xf(%)
  |> _reduce(%, acc, list);
radiant kraken
#

oh fairs

neon leaf
#

99% of applications are on linux

sharp geyser
#

YOu earn money on php?

queen needle
#

example from the proposal

neon leaf
#

I make pterodactyl addons

sharp geyser
#

Oh right

#

Fair enough

#

cant fault a guy for chasing the bag

#

I do it too

#

just in a much slower and annoying way

radiant kraken
sharp geyser
#

I was thinking of picking python back up for data analyst jobs

radiant kraken
#

since in python you need to do things like len(' '.join(list(filter())))

sharp geyser
#

but I also cant be asked

queen needle
#

I want it for syntax sugar, and readability

sharp geyser
#

Honestly just >> or << :))

radiant kraken
#

like WHY CAN'T YOU JUST CHAIN METHOD CALLS

#

it's so annoying when you're writing in a repl

sharp geyser
#

Wanna know what else is annoying

radiant kraken
#

what

#

stripe?

sharp geyser
#

That I know later on ima have to rewrite the api endpoints in nextjs to C#

#

but I cant be asked

#

:))

radiant kraken
#

😭

neon leaf
#

I rewrote my prod nodejs app from ts to rust in 1 week 🔥

sharp geyser
#

Honestly may just not

radiant kraken
#

BASED

#

BASEDDDD

neon leaf
#

(sentry was full of errors after but ignore)

#

(I used too much unwrap)

sharp geyser
#

wasm no ty

radiant kraken
#

doesn't matter as long as you get the 🚀

neon leaf
neon leaf
#

I dont know how some people genuinely think rust for websites is a good idea

radiant kraken
sharp geyser
#

It's not

neon leaf
#

like ok buddy let me load my 8MB wasm rq

sharp geyser
#

nodejs is perfectly fine for it

#

keep the jsx syntax

#

god damnit I was thinking of rust and wrote rust

#

I find it funny people are trying to say nextjs is dead and that no one should use it anymore

radiant kraken
#

nextjs is literally everywhere

sharp geyser
#

Right

radiant kraken
#

like name a full-stack dev that doesn't have nextjs in their stack

sharp geyser
#

I saw 3 reddit posts about nextjs dying and how start or solid is a better option

radiant kraken
#

LMAO

sharp geyser
#

you aren't fullstack

#

you are psuedo-fullstack

neon leaf
#

pseudo?

sharp geyser
#

however you spell it god damn

#

Im too fuckin stressed for this

#

😭

queen needle
#

sudo duh /j

neon leaf
#

opt-level = z

#

opt-level = s

sharp geyser
#

virtually no difference

neon leaf
#

ye but s uses vectorization

#

so my sha1 hashes are 0.01% faster

radiant kraken
#

what's vectorization?

sharp geyser
#

💀

neon leaf
#

it turns ur loop into simd instructions

#

when applicable

radiant kraken
#

ooooo pog

#

lemme try applying it to my project

#

since it heavily exports lots of binaries 💀

#

like i'm talking

neon leaf
#

???????????????????????????????????????????????????????????????????????????????????????????????????

sharp geyser
#

not even a mb in sight

neon leaf
#

are you compiling for the wii too ??

#

(powerpc)

radiant kraken
#

yes

#

gotta care for those people who use the wii

neon leaf
#

realistically you can nuke the gnu binaries

#

musl can be used on gnu

#

just slightly bigger

#

(they include all deps)

radiant kraken
#

wait what 😭

neon leaf
#

yes

#

thats why alpine uses musl

#

no additional deps

#

outside of the binary

radiant kraken
neon leaf
#

(unless you force rust to)

sharp geyser
#

One of those is a jar file

neon leaf
#

(and musl works on older Ubuntu properly)

sharp geyser
#

and the other is for some obsucre linux distro

neon leaf
#

(if you build gnu on Ubuntu 22, you need Ubuntu 22+ to run)

#

But eh

#

Just don't bother

neon leaf
#

Yeah

#

They all make it slower

radiant kraken
neon leaf
#

But your app will be blazingly fast

#

And debug build speeds stay

radiant kraken
#

BLAZINGLY FAST 🚀

neon leaf
#

Just initial build a bit slower

radiant kraken
sharp geyser
#

yes

neon leaf
#

Yes

sharp geyser
#

oh shit I was right

#

💀

neon leaf
#

You can override that tho

sharp geyser
#

troll failed, knowledge success

neon leaf
#

Either per dependency or for all

radiant kraken
#

😭

#

i wanna decrease my binary size

#

but without making it slower

neon leaf
#

Look at my config again

#

First part to be precise

radiant kraken
#

ohhhh does [profile.dev.package."*"] apply to every dependency?

neon leaf
#

Yes

radiant kraken
neon leaf
#

When building in debug mode

radiant kraken
#

you could specify specifics right

#

thats so COOL

neon leaf
#

It is

radiant kraken
#

😭

radiant kraken
#

😭😭

quartz kindle
neon leaf
#

So that I can write file data while I'm building an index

#

It allows me to never need to seek

#

So I can stream the raw archive into an http body for example

quartz kindle
#

does that make it hard to do anything about it without downloading the entire file?

neon leaf
#

Correct

quartz kindle
#

idk if thats a tradeoff i would pursue

neon leaf
#

Well, zip is not much different

quartz kindle
#

yeah ik, thats why i asked

neon leaf
#

And tar is out of the picture Anyway

quartz kindle
#

many formats do it

#

i find it strange, but i guess they were invented in an age where seeking actually mattered

#

aka hdd age

#

xD

neon leaf
#

Mmm

#

Well I still seek, but only when reading

#

I seek to end, then seek to offset

#

Then seek for each file read

quartz kindle
#

yeah but with modern ssd's seeking is pretty much a non-factor

neon leaf
#

Ye

#

Realistically I still use tar if I need to stream files over http

#

Since it allows me to instantly decompress incoming files

#

Instead of waiting for an index

#

My format is mainly meant to be stored locally

#

Currently it's used to store chunk ids of where to find file data

quartz kindle
#

how much of a difference does it make to append to a large file vs prepend to it?

neon leaf
#

No clue but prepend requires moving all data manually

#

For no real benefit

quartz kindle
#

ye i can see why writing the index at the end is better for performance

#

since you cant know how big the index is gonna be beforehand

neon leaf
#

Yea

quartz kindle
#

unless you use tree

#

and store the index along the data

neon leaf
#

Well

#

That was version 0 but I need a really fast index

#

No compromise

quartz kindle
#

that would be a very weird hybrid tree

#

xd

neon leaf
#

Current format is sometimes faster at listing files than the actual ls command

quartz kindle
#

wasnt there a format that had multiple indexes along the stream? so the stream could be checkpointed

neon leaf
#

🤷

quartz kindle
#

i think i remember something like that

#

rate my utf8 encoder

neon leaf
#

I mean

#

I guess that is the fastest way

quartz kindle
#

its faster than both TextEncoder and Buffer.write up to a certain number of chars

neon leaf
#

Up to?

quartz kindle
#

about 16-32 depending on environment

#

on chrome for some reason its still faster than TextEncoder at 500+ chars

neon leaf
#

Hmm

quartz kindle
#

but might be some weird optimization

neon leaf
#

I've grown to hate dynamic language params so much

#

I wasn't able to tell that target was a mutable array

quartz kindle
#

target is Uint8Array

neon leaf
#

Ye

#

&mut Vec<u8>

#

🙏

quartz kindle
#

xD

#

textencoder and buffer.write pretty much scale logarithmicaly

#

naive js functions scale more linearly

#

from 2 to 1024 chars

willow ether
#

Gets a decent performance bump when compiling to wasm too.

quartz kindle
#

wasm is slow af

willow ether
#

*was

quartz kindle
#

its only worth it if you're working on big data

willow ether
#

Also wasm is slow when you compile some languages into it because then you have to load the GC into wasm as well as your application.

quartz kindle
#

wasm/napi/ffi all have a significant initialization cost as well as data transfer cost, they are only worth it for either data bigger than a certain amount, or cpu-bound functions heavier than a certain cpu-time cost

#

all of which is pretty much on a case-by-case basis and also depending on the system/environment

#

wasm is good for image/video editing on the web, thats for sure

#

but good luck using wasm to process small websocket messages

sharp geyser
#

Im sending a nuke to stripe's headquarters

radiant kraken
#

is it worth it? what do you guys think

quartz kindle
#

yes

sharp geyser
#

Im so out of touch with js

#

I dont know how to handle promises outside of using async/await

#

but I can't use async/await here

quartz kindle
#

lmao

quartz kindle
#

you can always promise.then(result => ...)

sharp geyser
#

nextjs client components

quartz kindle
#

uhh... do they even support async?

sharp geyser
#

they do not, but you can still call async functions in them

#

you just can't use await

#

so you can do

#
export default function Page() {
  async function Something(){}
}
#

you just can't do await Something later on

#

unless you can somehow make an async function environment

#

since the top level function can't be async

quartz kindle
#

cant you do ```js
export default async function Page() {}

#

or this ```js
export default function Page() {
return new Promise(async (resolve, reject) => {

})
}

#

or does the Page function have to return something synchronously

sharp geyser
#

no you can't do the first one

#

Nextjs client components cannot be async

#

only server components

#

and they also can't return a async element

#

They have plans to allow it sometime in the future afaik

queen needle
#

Is it just one function you need to await

sharp geyser
#

but right now its only possible in server components

#

Well I am integrating stripe right now

#

so I need to make A LOT of api calls