#💽Programming Chat v2

1 messages · Page 19 of 1

timid quartz
#

llllame

#

use space more efficiently

spare quartz
#

and although i don't use the u32s to their fullest i'm planning to add more stuff in the future

timid quartz
#

mf has "reserved" bits that will be reserved indefinitely

#

microsoft would like to hire you

spare quartz
#

:3

#

i also gotta make a generic package for bitfield enums

#

the PE file has approx 200 lines just dedicated to them

timid quartz
#

I gotta go destroy this exam in half an hour

spare quartz
#

i got my exam in an hour and 20 minutes :3

timid quartz
#

good luck

#

do well

spare quartz
#

looks like the memory problem got pretty bad over 24 hours (repeatedly downloading a video)

#

195 mb is unacceptable

spare quartz
#

def gonna need to unchecked_deallocate the file chunks

timid quartz
#

like rust :3

spare quartz
timid quartz
#

honestly

#

it might be faster cause it doesn't do any deallocations itself

spare quartz
#

i think its a good tradeoff even if its a bit annoying

timid quartz
#

you should leave your http server running longer

#

and let it get to like

#

1gb

spare quartz
#

im sure i could get it quickly up there by reloading a video with no cache

#

but im gonna try and use valgrind

timid quartz
#

valgrind should work

spare quartz
#

hmm

#

i could look into also implementing a circular buffer

timid quartz
#

just deallocate your memory!!!

spare quartz
#

512 kb and flush the ends to the http request..

timid quartz
#

give into the use-after-free

spare quartz
#

you can't uaf in ada

#

it'll give you an error

timid quartz
#

give into the random program crashes

#

or you could be like the guy who was programming a missile

spare quartz
#

my computer is not an explosive

#

big difference

#

OH

#

there is one thing that i know causes a lower library problem in ada though that it doesnt catch

timid quartz
#

"yeah I know there's a memory leak, but I've mitigated it enough so that by the time it becomes a problem, the missile has either exploded or has otherwise become useless"

spare quartz
timid quartz
#

you should do that in a loop

spare quartz
#

i did

#

200 times

#

but the c++ library i was using was coded well

#

and threw a use after free error

timid quartz
#

code your own badly

spare quartz
#

sure and i'll also push it to a program 9 billion companies use

timid quartz
#

:3

spare quartz
#

oh yeah

#
with Ada.Containers.Indefinite_Holders;
with Ada.Text_IO; use Ada.Text_IO;

-- see if i can't commit use-after-free by keeping a Reference_Type's anonymous
-- access value around past its holder's lifetime.
procedure break_indefinite_holders is

    type Thing is
        record
            name: String (1 .. 12);
        end record;

    package IH is new Ada.Containers.Indefinite_Holders (Thing);

    function Funny_Business return access Thing is
        use IH;
        x: aliased Holder := To_Holder(Thing'(name => "abracadabra "));
    begin
        return Reference(x).Element;
    end Funny_Business;

    p: access Thing;

begin
    p := Funny_Business;
    Put_Line(p.name);
end break_indefinite_holders;
#

you can also technically use after free with this code

#

but that's kinda called for since you're using an access type

timid quartz
#

mf

#
//! Behold, a perfectly memory-safe use-after-free!

use std::hint::black_box;
use std::io::{stdin, stdout, Read, Write};

use crate::lifetime_expansion;

/// The size of the buffer we create and then drop.
const HORRIBLE_LEN: usize = 64;

/// Get a static reference to a dropped buffer.
#[inline(never)]
fn get_horrible_buffer_mut() -> &'static mut [u8; HORRIBLE_LEN] {
    let mut buffer = black_box([0; HORRIBLE_LEN]);
    lifetime_expansion::expand_mut(&mut buffer)
}

#[inline(never)]
fn innocent_prompt() {
    print!("Give text (must be at least {HORRIBLE_LEN} chars) > ");
    stdout().flush().unwrap();
}

/// Reads data from a freed buffer, puts random data on the stack, then reads it again.
#[inline(never)]
fn innocent_read(initial_buffer_mut: &mut [u8; HORRIBLE_LEN]) {
    let mut stdin = black_box(stdin());

    println!("Buffer before writing:\n{initial_buffer_mut:?}");

    let _buffer = black_box([0_u8; HORRIBLE_LEN / 2]);
    let _thing = black_box(69_727_420_u64);

    println!("Buffer after creating random data:\n{initial_buffer_mut:?}");

    innocent_prompt();

    // "Nah, I'd win." - Rust compiler
    stdin.read_exact(initial_buffer_mut).unwrap();

    println!("Buffer after writing user input:\n{initial_buffer_mut:?}");
}

/// Create a buffer and drop it, then read from it in `innocent_read`.
pub fn use_after_free() {
    let initial_buffer_mut = get_horrible_buffer_mut();
    innocent_read(initial_buffer_mut);
}
spare quartz
#

thx for the free code

timid quartz
#

rust use-after-free

spare quartz
#

ignore weird name im using the learn adacore compiler

timid quartz
#

EXAM IN 20 MINUTES yipee (<- I am so cooked)

spare quartz
#

maomomrowemrowermoweomrwemorwe,r,,weormewor

#

i imagine i should probably be using debug info with valgrind

#

since this is all binded code.....

#

bleh don't know how to assign these to the representation 'Read and 'Write

lavish dove
timid quartz
#

15% chance I clutched up majorly to get an A in the class

#

majority chance I keep a B

lavish dove
spare quartz
#

IM BACK

#

FROM THE TEST

#

just walked a fuull hour rtrhough waist high weesd cause my phnoe was lost and i had t o walk home

spare quartz
#

one dolla multimulter

rustic vine
spare quartz
rustic vine
#

the screen is only connected to power?

#

um

spare quartz
#

it's a zebra wire thing

#

little tiny wires

rustic vine
#

am I missing the wire

#

I don't see any wires

spare quartz
#

it is the wire

rustic vine
#

oh how interesting

#

OHHH ok

#

thats sick

spare quartz
#

yeah

rustic vine
#

I wonder how much they can make that for

spare quartz
#

we love efficient miniaturization

rustic vine
#

if they can sell for a buck

#

thats super cool

spare quartz
#

even if they're beyond my understanding

rustic vine
#

I wonder how much fluke makes theirs for

#

probably 20 bucks

#

sells for 280

lavish dove
#

It was really nice

#

Didn't even feel cheap

spare quartz
#

@timid quartz funniest shit ever

#

part of the dod NIPRNet runs on java

spare quartz
#

finally got this compiled

#

now to open the PE reader and see if it works

#

the settled byteflipper is quite different

spare quartz
#

MUCH better

#

comparison

spare quartz
rustic vine
spare quartz
#

yeah

#

a lot of twitter users love thinking they can all be replaced with rasp pis

rustic vine
#

They can be, if you want uptime to go to 20 percent give or take 5

spare quartz
#

me when i replace the traffic controllers in arizona with a 3B+

#

(it destroys itself in the summer)

#

theres also people just spouting nonsense like elon/spacex/doge will fix it

rustic vine
#

Whats Elon gonna do bruh

#

It works fine

spare quartz
#

like the system we have rn is robust and stupidly repairable 😭 how can you "fix" that

#

i love twitter

rustic vine
#

The existence of an efficiency department implies the existence of inefficiency, so I propose we get rid of doge

spare quartz
#

well it isnt a real department

#

just essentially a glorified suggestion box

#

doge suggestions or EVIL doge suggestions

rustic vine
#

🙁

spare quartz
#

cat is glorwing

spare quartz
#

tbf

#

elon is also the same guy saying the F-35 is a waste

#

he'd be amazing as a chinese spy

rustic vine
#

Did he say that

spare quartz
#

yeah

rustic vine
#

Goat

spare quartz
#

multiple times

rustic vine
#

I thought f35 was banger cause it's like hella cheap compared to the 22 for what it can do

spare quartz
#

now lockheed is going on twitter and saying trump doesn't agree with that because their stocks are taking a drop

rustic vine
#

Great

spare quartz
#

i wonder if lockheed has an assassinations department like boeing

#

maybe we'll find out

rustic vine
#

HUH

spare quartz
#

🧌

spare quartz
#

finally

lavish dove
# spare quartz

Replacing this reliable thing with something that dies the second it's micro sd does is really funny

#

Also it's not easily repairable you haved to buy a new one when it breaks

#

Also Elon musk saying the f35 is shit is funny lol

spare quartz
spare quartz
#

i found an acars decoder chip

#

unfortunately it requires a serial port ( i do not ahve one )

lavish dove
spare quartz
#

i also do not have a usb port

lavish dove
#

how

spare quartz
#

full

rustic vine
spare quartz
#

💪

spare quartz
#

made a tiny stats pane and i love it

spare quartz
#

macrosoft binbows

#

made these things work

#

just gotta add the averages

spare quartz
#

are you making your own imgui clone

rustic vine
#

Ui design is my passion

rustic vine
#

And it also isn't imgui, it's reactive instead deathstare

#

Quite evil

spare quartz
#

💀

spare quartz
# spare quartz

made them use the holder color (will send video after avg is done, it impacts readability a little bit but thats fine)

rustic vine
#

99 percentile, same thing

rustic vine
spare quartz
#

if its a string its a property read directly from Stats

#

otherwise the function provides the value

rustic vine
#

Oh

#

Mixed tables deathstare

spare quartz
#

typeof <3

rustic vine
#

NOOOOO

spare quartz
#

(the averages rn are 10, but im gonna add a set of timescale buttons to configure that)

#

mixing units 💔

proud creek
#

i am not scrolling through allat

spare quartz
#

all the stats

full berry
#

homosexual stats

wraith scarab
#

anyone used pygaze?

#

fuck off yes i use python

#

before aera starts yapping

full berry
#

its so slow oml 😭

rustic vine
#

Pythons great

#

Perfect for all things scripting

#

Terrible for all things production

rustic vine
#

If someone can answer it they will, don't ask to ask

rustic vine
#

It can be fast, just gotta let stuff like numpy do all the heavy lifting

wraith scarab
#

I usually use C# but errrrr .net

#

Could use C++, did make a basic game engine in that before

rustic vine
#

There is no other language which i can just start writing and know confidently there will be a package i can pull in that does 90% of the work

wraith scarab
#

🐟

rustic vine
#

Doing linalg in python is awesome

#

Because i don't have to write a matrix implementation first

#

I can just full send

rustic vine
#

I used opencv a lot more for cv but I do remember trying pygaze

wraith scarab
#

pygaze relies on psychopy and is a bit broken in 3.12 due to removed packages

#

will try to fix but might try opencv

rustic vine
# lavish dove Imgui

Yea absolutely love imgui, but the roblox port didn't have what I wanted. Also usually prefer imgui but trying to learn a reactive ui library so now we're here

lavish dove
rustic vine
#

It's dead simple to install and get content on the screen

wraith scarab
#

I went to opencv instead

#

Pygaze is beyond fucked, incorrect docs and shit

wraith scarab
#

cmake crashed my pc somehow LOL

full berry
#

bro ran a.exe

spare quartz
spare quartz
#

feeling ..s

timid quartz
spare quartz
#

surprisingly not

timid quartz
#

if only your lang did deallocations for you..

spare quartz
#

the memory is freed here

timid quartz
#

nuh uh

#

its still leaking obviously

spare quartz
#

which means even though we're handling >1 gb throughout the progarm, only 1.9 gb is actually resident at a time

spare quartz
#

i was actually pretty wrong about memory management in ada

#

the memory does get freed, but i'm not sure how exactly yet

timid quartz
#

"just follow best practices" mf

spare quartz
#

que

#

almost to 1 billion

timid quartz
#

the ^C in question

spare quartz
#

nuh uh

#

i wonder if theres an algorithm for that

#

for a set of numbers from 1 .. 1_073_741_824, can you get the amount of characters needed to represent all numbers in that set (+1_073_741_824 for spaces)

#

since rn it only pages 1_000_000_000 characters at a time

timid quartz
#

(1 * 10) + (10 * 100) + (100 * 1000) + ...

#

probably

#

parens for clarity

full berry
#

what's the best algo or way to issue api keys for, let's say a roblox game that communitcates to an api to send/receive data from an external db

spare quartz
#

((10^n) * 10^(n+1)) + ...

timid quartz
timid quartz
#

jwt 👎

full berry
#

THATS WHAT IM SAYING

timid quartz
#

just

#

idk

full berry
#

but that one is listed everywhere

timid quartz
#

generate a uuid with no hyphens

#

or bang your head on your keyboard

full berry
#

oh yeah fair enough

timid quartz
#

and store that somewhere

full berry
#

LOL

#

yes but how would you have the middleware check it lol

#

it would be weird if it just

#

checked a db if the key exists

timid quartz
#

that's precisely it

#

how do you think it should be done

full berry
#

the only reason jwt is good is because you can check it with a private key or whatever they call it

spare quartz
#

whats a jwt

full berry
#

json web token

timid quartz
#

json web token

spare quartz
#

oh

timid quartz
#

ultra cringe

full berry
#

^^

timid quartz
#

idk if you really want you can use your own gpg key to sign it

#

and then check it in the middleware

#

but that's more trouble than it's worth tbh

spare quartz
#

or at the very simplest

full berry
#

oauth.. for a roblox http request??

spare quartz
#

request (usr,pwd) ->
<- response (1 time use key)

full berry
#

im not building a website or login im just doing api auth middleware

#

for

#

game data fetching and saving

spare quartz
#

it sounds the most similar to what you're asking for

timid quartz
#

oauth is a pain

#

and not necessary for this anyways

full berry
#

are we thinking of the same thing

#

like

spare quartz
#

what do you want

full berry
#

oauth is used to log into web apps, not backend calls

timid quartz
#

and store that in a .env file or a database

spare quartz
timid quartz
#

idfk

spare quartz
#

if they just want simple auth

timid quartz
#

poor word choice?

spare quartz
#

just use the Authorization header if thats all you want

full berry
#

yes

#

poor word choice i didnt mean to make a system to issue keys

#

just a way to check if the provided key is valid

lavish dove
spare quartz
#

just keep a copy of your user/password groups somewhere secure (encrypt if you want)

#

and send an auth header like Basic <base64 user:password>

full berry
#

i tried jwt its giga weird, they do it with like <jwt>.verify and you would pass in your secret

spare quartz
#

365,523,956

#

very low variation

full berry
#

honestly aera the db thing might be intuitive it just feels a bit weird because it would be a double call to the DB, 1 to check the key and the other to fetch/write data

timid quartz
#

you can just cache the keys in memory then

#
function mainFunction() {
  let keys = getKeysFromDatabase();
  // ...
}
#

or whatever

full berry
#

oh you mean that

timid quartz
#

or store them in a .env file

full berry
#

like do it on boot

#

yeah honestly it could work

timid quartz
#

and just don't commit the .env file to git

spare quartz
#

bleh env files

full berry
proud creek
#

i mightve done that befor

full berry
spare quartz
#

wow stdout buffering really is that slow

full berry
#

i have moved my server to ubuntu 24.04

timid quartz
spare quartz
spare quartz
#

of course YOU appear

full berry
#

didnt they make a

#

really fast mc server written in rust

spare quartz
#

yeah for a pvp server with like 10,000 people on it

spare quartz
#

10_700_048_964

spare quartz
full berry
#

what is that picture 😭

spare quartz
#

or 170,000

#

i really need to find a solution to handling that many connections at once

#

i don't think linux would be happy with 170,000 threads

full berry
#

step 1 get a good pc

#

that's the baseline

spare quartz
#

that's not the problem

#

even if i had a supercomputer it wouldn't be the most optimal strategy

full berry
#

yeah i know im just implying that

#

a craptop cant be made into the god of computers

#

you need a good setup to begin with

spare quartz
#

yes they can

full berry
#

ok buddy

#

i didnt say to get like

#

a mega computer but

#

a decent computer would be good

spare quartz
#

astro i will run your brain on a raspberry pi

full berry
#

spare quartz
#

full berry
#

i should get a raspberry pi

proud creek
#

uploading zip bomb to his neuralink

full berry
spare quartz
#

@timid quartz wormhole receive 4-aftermath-woodlark

spare quartz
#

hmm

#

need 2 fix

full berry
#

what happened to your javart.zip

full berry
spare quartz
#

it still works

#

and ik

#

you have to click on the link

#

reasoni m not using the domain is cause its HSTS

spare quartz
spare quartz
#

okay but try playing it

rustic vine
rustic vine
spare quartz
#

wha

#

this server is noneuclidean

#

i need to look at what headers discord is sending

rustic vine
#

mb I could've phrased that better LOL

#

I meant like

#

that meaning of loads

#

not

#

literally that loads

#

brah

#

english is hard

full berry
#

guys what browser is good

spare quartz
#

speak English

#

🇺🇸

rustic vine
#

e

full berry
#

i dont like arc or chrome and firefox is weird

rustic vine
#

bruh

spare quartz
rustic vine
#

should've said that before

#

asking the question

#

chrome is great

#

I have enough ram to run it so I don't care about it being greedy and otherwise it runs fine

full berry
#

doesnt chrome eat up your cpu lol

rustic vine
#

not really

full berry
#

or ram

#

or whatever

rustic vine
#

yeah but I have 64gb

spare quartz
#

it does when you have a few dozen tabs

rustic vine
#

so im chilling

spare quartz
#

but every browser does that

full berry
#

wtf do you need 64gb ram for

rustic vine
#

cpp builds

spare quartz
rustic vine
#

I consistently reach 60 (on the largest projects)

rustic vine
spare quartz
#

i could fit up to 128 gb on this board

#

unforrtunately no money at this time

rustic vine
#

I can't believe intellij is the only reasonable choice as a java ide

#

like why couldn't someone else

#

make something just as good

full berry
#

@timid quartz have you tried out the zed editor yet

rustic vine
#

everything else literally just sucks

#

same deal for python

full berry
#

on your mac i mean since you gotta build it for windows

rustic vine
#

what da flip is zed

spare quartz
#

o right

rustic vine
#

removable

spare quartz
#

i don't see the appeal in it personally

rustic vine
#

goated

#

whats the appeal

#

oh

#

well

#

whats the intended appeal

spare quartz
#

iunno wear thigh highs or something

#

you can take a look here

rustic vine
#

they made vscode with less menus

spare quartz
rustic vine
#

when I am gonna need to do this

#

good advertising point guys

spare quartz
# spare quartz

like i know these could have appeal to somewhere elsewhere but

  • vsc/intellij are fast enough as is
  • i don't really need ai
  • i don't need real-time collaboration even with a team (git/telegarm is enough)
rustic vine
#

LLMs bruh

#

its over

#

copilot wrote some faulty code for a friend of mine on a project we were working on

#

and I didn't notice until like weeks later

full berry
rustic vine
#

it mapped positive to clockwise

#

and mapped negative to ccw

#

evil, I tell you

full berry
#

you can build it from source on windows but it takes ages (at least for me)

rustic vine
#

LOL

#

greatest ide known to man

#

cuts out 90% of the market

full berry
#

their original aim was for it to be mac only

#

becuase it fits with mac more than windows or linux

rustic vine
#

at the end of the day I just be using vscode for everything except for heavy c + cpp, .net, and java + python

#

essentially just use vscode and whatever jetbrains has for the other ones

#

cause they are unfortunately just better

spare quartz
#

have you used vsc with wsl

rustic vine
#

yes

#

awesome stuff

#

the remote stuff is sick too

spare quartz
#

do you know how to make the gpg signing not break when commiting

rustic vine
#

um

#

how does it break

#

does it just not get signed

spare quartz
#

well because the key unlocking requires a password input in a tty

#

and the vsc commit button isnt a tty

#

i think it just kills itself preventing me from making a commit (other than manually doing a command for it)

rustic vine
#

huh

#

I've never tried to sign in wsl before

#

in fact almost all my commits are just unsigned usually

#

😈

spare quartz
#

evil

rustic vine
#

I got nothing

#

"it just works" on windows

spare quartz
#

probably need to change what gpg program is used to open the key

rustic vine
#

is this your issue

spare quartz
#

yup

rustic vine
#

ez

wraith scarab
rustic vine
spare quartz
#

saving this here

#

i really dont wanna make an MP3 encoder in ada rn so im gonna unfortunately write my first python server

#

actually no

#

ill just add chunked transfer**

timid quartz
#

Give me like 15 mins

spare quartz
timid quartz
#

@spare quartz

#

@spare quartz

#

@spare quartz

#

@spare quartz

#

@spare quartz

#

@spare quartz

spare quartz
#

WHAT AERA

timid quartz
#

BACK

spare quartz
#

UGH HOLD

timid quartz
#

WORMHOLE

spare quartz
#

wormhole receive 9-hemisphere-kickoff

#

annoying

#

!!1

timid quartz
#

OF COURSE

#

you send me bayachao

#

OF COURSE

spare quartz
#

watch it :3

timid quartz
#

bruh the second one

spare quartz
#

BUT IT SOUNDS GOOD RIGHT

timid quartz
#

ig?

spare quartz
#

yay :33333333

timid quartz
#

why

#

what did you do to it

#

this isn't a virus is it

spare quartz
#

it is

#

(for your brain)

timid quartz
#

fuck

spare quartz
timid quartz
#

good.

#

bayachao explodet

rustic vine
#

what in the world is wormhole

spare quartz
#

virus aera made me install

rustic vine
#

agreed

spare quartz
#

bro does not know how to make ui

timid quartz
rustic vine
#

so the better sftp

#

kinda?

spare quartz
#

uhh its basically ftp over something like ngrok

rustic vine
spare quartz
#

okay now make the ui able to be dragged outside of roblox

#

true imgui :3

rustic vine
#

TRUE

#

pop out button that just launches the cpp imgui

#

with the same data

#

that doesn't sound too hard actually

#

they can just both listen to something on localhost

#

im not doing that

spare quartz
#

if only httpservice was able to run on the client in prod

#

unfortunately then roblox would become a dos tool 💔

rustic vine
#

no it would only be used for

#

good intentions only

#

👍

#

we promise

#

pinky promise

spare quartz
#

requires ID verification TrollHD

rustic vine
#

so like

#

they can

#

LOL

timid quartz
spare quartz
#

in prod

#

localhost doesn't exist in published servers and even if it did you'd see like

#

RCCService stuff 😭

rustic vine
spare quartz
#

ohhhhhhhhh

#

so thats why roblox goes down

rustic vine
#

yeahhh

spare quartz
#

looking at this graph

#

wonder if theres a way to make (terrain) noise out of it

proud creek
#

probably

pastel tinsel
#

So everything you are asking

#

gg

full berry
pastel tinsel
#

Point it to their id

full berry
#

ok yes but that's an entire admin system i

pastel tinsel
#

Then get the key entries and check against them all

#

Or assign it based on id

full berry
#

mmm

#

i mean

#

yeah ig that works but i only really need one key right now which is the key for the game to request and send data

pastel tinsel
#

Yeah so the old system basically

#

so you shouldn’t need to worry

full berry
#

i- what

#

i'm not doing this for guardsman

#

it's for my own project i'm working on from scratch

pastel tinsel
#

oh

full berry
pastel tinsel
#

how much have you taken from v1 deathstare

#

I’m still pissed that sky made it MIT 😭

#

I’m pretty sure the in game module for external saving is done

#

isn’t GLink anymore

rustic vine
#

whats wrong with MIT

#

I assume you're talking about the license

#

also unrelated but I used to be #1 admin system lover but at a certain point I just realized its so not worth the effort

#

but kinda cool

spare quartz
#

i was peering around the voice chat service stuff and i found out thats how you make it compat with the audio api system

#

i should make a radio

#

HAHA IT WORKS

#

makes me uh

#

wonder

#

could you theoretically just capture peoples voices

#

without them knowing

#

i can plug a video into a VAC and have it show up on the graph

spare quartz
spare quartz
#

dude

#

why does the advent of code symbol look like the army

timid quartz
#

You’re either about to say AGPL or closed source

spare quartz
#

ben would go great at (Every company ever)

lavish dove
wraith scarab
#

i'm currently still continuing with my eye tracking with opencv

#

i liked the facial landmark method so i'll see if there's landmarking available for eyes

#

i tried doing threshold method and it's too annoying

spare quartz
#

this is all that come to mind with "landmark"

timid quartz
#

@spare quartz gun_you

spare quartz
#

WHAT AER A.

#

i should make a virus that plays this on your computer whenever im pinged

timid quartz
#

How about I make a virus that deletes Ada every time you open an Ada file

spare quartz
#

dew it ;3

rustic vine
spare quartz
#

how

rustic vine
#

idk if the singing entity is

#

included as part of the standard distribution

spare quartz
#

oh thats a plugin

rustic vine
#

LOL

spare quartz
#

vocaloid or something

rustic vine
#

crazy

wraith scarab
timid quartz
#

Actually real

spare quartz
#

copying factorio ui btw

rustic vine
#

disappointing

spare quartz
#

i like it /shrug

rustic vine
#

huh

#

that feels like itd be really bad ux

spare quartz
#

there are 48 buttons in that list so maybe but its not really that bad to use

#

unless you lack a scrollwheel....

#

then you're sol

#

should probably make these divisions porportional to min/max

rustic vine
#

pls drop the

#

1% lows

#

/highs

spare quartz
#

the huh

rustic vine
#

for those statistics

#

avg is a decent number to look at but

#

usually what I really care about is

#

the 1% lows

spare quartz
#

avg isn't really a finished thing rn

rustic vine
#

or highs, depending on which one is bad

#

its like looking at 1% lows for fps

rustic vine
#

with a moving window

spare quartz
#

yeah but im waiting until i add timescales to actually do more with them

#

since rn they're just hardset to an arbitrary number of samples

rustic vine
#

oh

#

cause a moving average is just a FIR filter

#

where the FIR gains are all just 1 / samples

spare quartz
#

i also need to factor in dT with the graph since it's reading every frame rather than a defined interval

spare quartz
rustic vine
#

lol

#

u get what i mean though right

spare quartz
#

yeah

rustic vine
#

then high pass and low pass are trivial

#

and also finite difference is trivial too

spare quartz
#

ill probably add an input to allow the user to set the percentile of samples to use

rustic vine
spare quartz
#

average code rn

#

averages table (none of these are at defined intervals)

rustic vine
#

that cannot be mathematically correct

#

lgtm! ✅

spare quartz
#

lemme get the link where i found it

#

it was on some math stackexchange post

rustic vine
#

oh huh

#

is that what you're doing

spare quartz
#

yeah

rustic vine
#

I think thats right

#

I didn't bother reading his proof its just vibes though

#

🙂

spare quartz
#

the Averages table is going to be used for timescaling (1s, 5s, ...) but rn it's just "how many samples do you want"

#

(which due to the problem above with dT means the averages aren't over a time... which is the polar opposite of what i want!!!)

spare quartz
rustic vine
#

yeah idk if thats the "proper" way of doing it

#

the only way I've done moving averages was either with a FIR filter

#

or by doing the convolution manually

#

I think I've used numpy.convolve for it

#

before

spare quartz
#

of course still just a wip though

rustic vine
#

I wonder if it would match the 2 other ways of calculating average I listed

#

can you try

timid quartz
rustic vine
#

if I write u an implementation

spare quartz
#

oh yeah sure

#

any lang

rustic vine
#

I just write luau

spare quartz
#

pfp checks out

rustic vine
#

TRUE

timid quartz
#

Write it in Rust make atp ultra mad

rustic vine
#

well I can do it in 1 line in python

#

but it wouldn't be very helpful

spare quartz
rustic vine
#

cause I'd just call np.convolve

spare quartz
#

;333333

spare quartz
rustic vine
#

goated

timid quartz
spare quartz
#

いなばや CHAOちゅ~る

#

?NO

#

THATS YOU

#

is that even safe for here 😭

timid quartz
#

Idk

spare quartz
#

qiad case incoming...

timid quartz
spare quartz
#

w hat

spare quartz
#

I INTENTALLY SUPRESSED IT

#

szcspsl 7000 hours itme

spare quartz
#

i died a minute after spawning :<

#

scp 939 failed to lugne attack me but i only had a pistol 😭

spare quartz
#

unfunnylad posts all artifyber content to me

#

omg do youo know what NSA xkeyscore is

timid quartz
#

Do you know what grass is

spare quartz
#

no : 3

#

i walked a few miles 2 days ago and like

#

90% of the grass outside of my school district is yellowed/dead

timid quartz
#

Did you get burnt from the sun

spare quartz
#

surprisingly no

timid quartz
#

Did you recoil in shock like a vampire

spare quartz
#

i havent gotten a sunburn in years even though im like

#

super white

#

(i dont use sunscreen)

timid quartz
#

Did you wonder what the super bright ball in the sky was

spare quartz
#

uhhh well it contributed to my blindness partially so

#

\yeah

timid quartz
#

look at this guy who stared at the sun

spare quartz
#

I WAS A SMART KID OKAY

#

i was already pretty blind genetically tho

timid quartz
#

yeah WAS

spare quartz
#

LIKE IN A MEAN WAY

timid quartz
#

still

#

WAS

spare quartz
#

okay well back then i also used to code in ts.

#

so.

timid quartz
#

and now you code in Ada

#

so yeah

#

that tracks

spare quartz
#

9 billlion times improvement

#

astro to geezer transformation

timid quartz
#

9 billion times degredation

proud creek
spare quartz
#

w hat

proud creek
#

oh i misread that

#

keys core

#

!

spare quartz
#

tz go back to moderating deez nuts .......

proud creek
#

im gonna mute you yapper

spare quartz
#

nya nya nya

rustic vine
#

@spare quartz hi I went to grab dinner

#
--!native
--!optimize 2

type Map<K, V> = {[K]: V}
type Array<T> = {[number]: T}

export type MovingAverage = {
    _average: number,
    _samples: number,
    _n: number,
    _window: Array<number>,

    compute: (self: MovingAverage, n: number?) -> number,
}

local function avg(n: number, window: Array<number>): number
    if n == 0 then
        error("not enough values in window!")
    elseif n == 1 then
        return window[1]
    elseif n == 2 then
        return (window[1] + window[2]) / n
    elseif n == 3 then
        return (window[1] + window[2] + window[3]) / n
    end

    local sum = 0
    for i = 1, n do
        sum += window[i]
    end

    return sum / n
end

local function next_avg(n: number, prev_avg: number, last_n: number, next_n: number): number
    return prev_avg + ((next_n - last_n) / n)
end

local function compute(self: MovingAverage, num: number?): number
    local average = self._average
    if not num then
        return average
    end

    local n = self._n
    local samples = self._samples
    local window = self._window
    if n < samples then
        local next_n = n + 1
        window[next_n] = num
        self._n = next_n

        local next_average = avg(next_n, window)
        self._average = next_average
        return next_average
    else
        local next_average = next_avg(samples, average, window[1], num)
        table.move(window, 2, n, 1)
        window[n] = num

        self._average = next_average
        return next_average
    end
end

return function(samples: number): MovingAverage
    local average: MovingAverage = {
        _samples = samples,
        _average = 0,
        _n = 0,
        _window = {},

        compute = compute
    }

    return average
end
#

passes tests ✅

wraith scarab
#

wow someone who actually tests

spare quartz
#

ill impl after i die

rustic vine
#

its over

#

ok

#

theres prob better ways to do it

#

but I just did what was intuitive

spare quartz
#

mathematicians trying to code part 1

#

the humble sum

rustic vine
#

I wouldn't be surprised to find out that the branching is actually slower than the loop

#

if the loop gets unrolled for n < ~10

spare quartz
#

the branch is probably transformed into a jump table so don't sweat it

rustic vine
#

there might be some funky or straight up errors if you use samples <= 2

#

I'll add a test and fix that now since you're in sl

#

nevermind it works

#

im the goat

spare quartz
#

okay i lived

#

time for anotehr round

spare quartz
#

rwemrowemroewrm

#

werm

#

owemorwermomweromwemo

proud creek
#

bro studio is actually tripping wtf

#

??????

rustic vine
#

and more tests!

rustic vine
#

if its under another child it will be constrained to the parent size

spare quartz
#

also question why do you do type Array<T> = {[number]: T} instead of ... = { T }

spare quartz
#

GA y

rustic vine
#

I like how Map<T> and Array<T> looks

spare quartz
#

i used to too...

rustic vine
#

in fact I have them aliased for the entire workspace in vscode

spare quartz
#

but now i just do plain {}s

rustic vine
#

also { and } is farther on the keyboard compared to < and > 🙂

spare quartz
#
local a = require(a)
local b = a(10)
while ...
  b:compute(value)
end
#

i imagine this is how i use it?

rustic vine
#

yes

#

well

#

it returns the average

#

you can also call b:compute() to get the average again

spare quartz
#

you should probably add the return argument to the local function decl. of compute

#

but seems simple enough

rustic vine
#

oh

#

my bad

#

its in the type

#

thats exported

spare quartz
#

yeah i see that

#

just code clarity n all

rustic vine
#

yeah I usually do

spare quartz
#

alright impling it now

rustic vine
#

I guess I forgot

spare quartz
#

nightmare

rustic vine
proud creek
#

And it’s not updating when I change the viewport size 😭

spare quartz
#

there

#

should be impled

#

OH it's on immediate sampling (0)

#

wait no same error

#

just made it skip over computing averages for 0/1/5

#

next error

#

top line in output is [Value, SampleSize]

#

ugh

#

its cause i forgot to update a var

rustic vine
#

huh

#

what

spare quartz
#

nothing just a bunch of mini problems

rustic vine
#

how is that possible

spare quartz
rustic vine
#

oh

#

gotcha

#

so not my fault 🙏

rustic vine
#

no clue

#

ui design is my passion 😅

spare quartz
#

heres 4 samples

#

left is the math exchange equation, right is yours

proud creek
#

and refusing to change

rustic vine
#

wait

#

its the same except for one of them?

spare quartz
#

the exchange equation is more "volatile"

#

it changes for every value put into it

#

yours appears to buffer

rustic vine
#

can you assert(math.abs(a - b) <= 1e-6)

#

oh

#

that'll prob fail then

#

based on what you say

rustic vine
#

the stackexchange formula takes the average at the head

#

or no, at the center

#

whereas mine takes it at the head

#

so that means spikes in the underlying data is in phase with the average for the stackexchange method

#

whereas spikes in the underlying data is out of phase (average is behind) for my impl

#

thats my guess

#

its nice that the stackexchange way means you only store 1 number

#

thats kinda cool

spare quartz
#

lemme apply the two on a more extreme stat like render tasks and record

#

here

rustic vine
#

is there a way you can graph the 2

#

and the source

spare quartz
#

uhh sure

#

do you want any specific colors

spare quartz
#

nice peak

#

and another shot

rustic vine
#

maybe my conclusion earlier was wrong

#

@spare quartz oh wait

#

I just realized

spare quartz
#

?

rustic vine
# spare quartz ?

I think the stackexchange answer is the same as sampling everything

#

so its not really a moving average

#

do you get what I mean

#

you hold onto the average forever and continuously change it

#

whereas in a moving average you only view a window of the past n samples

#

which means the average is exactly the average of the window

#

and not the average of everything to this point

spare quartz
rustic vine
#

does that make sense?

#

I think thats the actual difference

spare quartz
#

yeah that makes sense

#

i was thinking of doing the sliding window approach initially

#

but didn't wanna hold onto thousands of samples given a long timescale/many selected elements

rustic vine
#

so its not really a big deal

#

until size gets crazy

#

an optimization that could be made is to use a circular buffer instead of the array

#

that would avoid the table.move call entirely

#

I didn't want to implement a circular buffer so

spare quartz
#

[???][8 byte double]

rustic vine
#

TValue[]

#

wait

#

an element?

spare quartz
#

yes

rustic vine
#

its just a TValue

spare quartz
#

but what is that

rustic vine
spare quartz
#

t tt t ttagged

rustic vine
#

incredible

#

but yeah every single value in lua/luau is a TValue

#

even booleans are 16 bytes

spare quartz
#

what about strings

#

are they just a reference like tables

spare quartz
rustic vine
timid quartz
#

i mean you could do Vec<T>

#

that would be easier

#

rather than hashmap with usize

spare quartz
#

strings in luau are UTF-8 right?

rustic vine
#

no

#

they're arbitrary

spare quartz
#

what

#

how do you mean

rustic vine
#

well cause it doesn't matter at the end of the day

spare quartz
#

that depends...

rustic vine
#

oh ok

spare quartz
#

was gonna talk about 8/16/32 bit characters but /shrug

#

also i think utums tired themselves out

timid quartz
#

utum???

#

@utum-

spare quartz
#

yeah

#

@odd thunder

odd thunder
#

WHAT FATSO

spare quartz
#

STOP GAMBLING IDIOT

odd thunder
spare quartz
#

NO.

odd thunder
#

shut up

rustic vine
#

crippling liars table addiction

spare quartz
odd thunder
#

HEY I WON THE JACKPOT 4 TIMES

spare quartz
#

OUT OF LIKE 200

odd thunder
#

160*

spare quartz
#

your payouts a penny after all you've lost

odd thunder
#

no