#development

1 messages ยท Page 213 of 1

lavish drift
#

uhh i think the cheapest is east cost

sharp geyser
#

US central

#

But anyway

#

you have 16gb of ram

#

You will 100% not overload your server

#

python may be very memory intensive in some cases, but you wont reach anywhere near that amount, let alone your webserver.

sharp geyser
lavish drift
#

i have no idea whats going on

#

top left is my stripe listen. bottom left is my triggering termincal. top right is my django server. bottom right is the proxy

sharp geyser
#

you did something wrong

lavish drift
sharp geyser
#

right

#

your listen is wrong

#

you did domain.com/webhook

#

your nginx is setup so /webhook is at root

lavish drift
#

which doesnt exist

sharp geyser
lavish drift
#

right

sharp geyser
#

change it and try again

#

:)

lavish drift
#

holy shit

sharp geyser
#

?

#

work?

lavish drift
#

this has gotta be resume worthy

sharp geyser
#

good job

sharp geyser
#

yea see

#

you are using 380mb

lavish drift
sharp geyser
#

you have a db running as well right?

lavish drift
#

yes

#

i hope

sharp geyser
#

thats all at idle

lavish drift
#

it should be running somewhere

sharp geyser
#

Granted when it starts getting used it will spike up

#

but no where near 16gb

lavish drift
#

i cant believe it worked

sharp geyser
#

congrats you are one step closer to accepting payments

lavish drift
#

now i need to switch all of my keys around ithink

#

and i believe the stripe dashboard has a real test ping

#

that simulates an actual one. if THAT works. Then all i need to do is make sure this shit is safe and then add the python / SQL to automatically add it to the db

sharp geyser
#

Well good luck

#

Ima head out now

lavish drift
sharp geyser
#

๐Ÿ‘

lavish drift
#

im getting This error means that the URL you have entered is redirecting, which isn't supported in webhooks. You'll need to enter a URL that the data can be sent to without that URL redirecting. error from stripe. will keep digging around but not sure where it would be redirecting

sharp geyser
#

herm

#

Might be a proxy issue

sharp geyser
lavish drift
#

im now getting

#

so im getting the error in my django server now. but its yelling at me bc its redirecting

#

but i figured out SSL

#

i think its because for some reason the post says its using HTTP/1.0. I think that needs to say HTTPS

sharp geyser
#

if you are using cloudflare

#

it redirects HTTP -> HTTPS

sharp geyser
#

which means a temp redirect

lavish drift
#

stack overflow says i can get that error if i have incorrect stripe API codes

lavish drift
sharp geyser
#

what in the fuck

lavish drift
sharp geyser
#

what does your cloudflare dns look like

#

also show me your nginx config again

sharp geyser
#

alright

#

what about nginx

lavish drift
#

i forget the command to edit its config

sharp geyser
#

nano

#

nano /etc/nginx/sites-available/configfile

lavish drift
#

is it not sudo nano /etc/nginx/nginx.conf?

sharp geyser
#

you dont need sudo unless you are going to write to it

#

you can read it freely iirc

lavish drift
#

im just making sure we are talking about the same file

#

sudo nano /etc/nginx/nginx.conf is the only one ive ever used

sharp geyser
#

uhm, you should not be editing the nginx.conf file

#

or at least adding to it

lavish drift
sharp geyser
#

you should not be editing it

#

you should be making a new configuration file in sites-available

lavish drift
#

i added that server {

#

let me remove it

#

        listen 443;
        ssl     on;
        server_name stockevaluatorbot.com;

        ssl_certificate /etc/ssl/certs/stockevaluatorbot.crt;
        ssl_certificate_key /etc/ssl/certs/stockevaluatorbot.key;
}
#

ok removed and restarted

sharp geyser
lavish drift
sharp geyser
#

I recommend watching this

lavish drift
#

why would i place server { in the sites-available config?

thick sequoia
#

waht up hatties

sharp geyser
#

cause nginx.conf config is for global configurations

lavish drift
#

right

#

so i get why we dont touch that one

sharp geyser
#

You don't want that here.

lavish drift
#

but im not sure the rhyme or reason for sites-available specifically

sharp geyser
#

sites-available is where you place the configs for the sites you make.

thick sequoia
#

pp

lavish drift
#

gotcha

#

and thats the site for port 443

thick sequoia
#

poo poo

sharp geyser
#

you then symlink sites-available to sites-enabled

#

allowing you to easily break that symlink if you decide you no longer need it

lavish drift
#

so this is right then

sharp geyser
#

Its better to watch that video

#

it explains nginx in better ways than I can

lavish drift
#

i get it

#

now at least

#

each server { can listen and do something to a different port

sharp geyser
#

Right, but the key thing is

#

You listen on the same port for everything

#

So say you had another web api

#

you'd make a new conf file in sites-available and listen on port 443 still

#

you'd just proxy_pass something different

lavish drift
#

i cant help but notice the config i just maade doesnt have a proxy pass

sharp geyser
#

indeed it does not mmLol

#

80 is for http, 443 is ssl (https)

lavish drift
#

ahh

#

so i dont need one

sharp geyser
#

well...in some cases you will need both

#

here I think its fine tho

lavish drift
#

how do i symlink them again?

#

i saved that new config

#

so i gotta link sites avail and sites enabled

sharp geyser
#

ln -s target destination

#

or in your case

#

sudo ln -s /etc/nginx/sites-available/whateverconfig /etc/nginx/sites-enabled/

#

oh right

#

need to use sudo

sharp geyser
#

thats odd

#

I think its a cloudflare thing tbh

#

cause its definitely not nginx

lavish drift
#

i need to find whatever logic is controlling adding /webhook/

sharp geyser
#

let me see you stripe listen again

lavish drift
#

ahh

#

too many commands hold on i gotta google it

lavish drift
frosty gale
#

webhook ception

lavish drift
#

i would say its a loop kekw

frosty gale
#

yep exactly what i said

#

it does a permanent redirect

#

not sure why though

lavish drift
#

i havent changed much since last night when it was working

frosty gale
#

how does your nginx config look

lavish drift
#

which one

#

the main big one?

frosty gale
#

sure

lavish drift
#

and i have this new one

frosty gale
#

how is /webhook handled

#

whats the server at the end of it

lavish drift
#

im not sure

frosty gale
#

if you even handle it at all

lavish drift
#

idk what file that would be in

sharp geyser
#

didnt you have a file earlier that handled port 80 in nginx

#

I could of sworn you did

frosty gale
#

ah django

sharp geyser
#

that one was the one that proxy passed your localhost webhook endpoint

frosty gale
#

what does the code look like

#

not sure why it'd be redirecting since nginx config has nothing with redirects

lavish drift
#

i was using this i think

frosty gale
#

so youre either doing something weird in the django server or some cloudflare setting is broken

sharp geyser
#

well he had another one im pretty sure

lavish drift
#

i remember listen 80;

#

not sure why it got taken out. Prob when i was messing around with the listen 443

sharp geyser
#

could that be causing the loop?

frosty gale
#

why would it be adding a new /webhook at the end

#

it looks like more complex logic is at fault

sharp geyser
frosty gale
#

django possibly

lavish drift
#

all of them?

sharp geyser
#

whatever file is running the webapi

lavish drift
#

webAPI i named myself

sharp geyser
#

show webapi first

lavish drift
#

thats my personally named one

sharp geyser
#

its...the same code

lavish drift
#

i dont think its using webAPI

frosty gale
#

no redirects here, is there anything else in your code

sharp geyser
#

how are you running this django api

frosty gale
#

or references to /webhook

sharp geyser
#

you have to run it somehow

frosty gale
#

it looks like some code is running something like
redirect(request.url + "/webhook")

lavish drift
sharp geyser
#

show how you are running this api

#

those are just functions

#

they wont work on their own

lavish drift
#

i wish i knew

sharp geyser
#

๐Ÿ’€

frosty gale
#

god forbid

lavish drift
#

bro i told you i was lost

sharp geyser
#

you wrote the code bro

#

or copied it

#

idk

frosty gale
#

youre trying to setup a reverse proxy and you dont even know how the server works

lavish drift
#

i think i found the problem

sharp geyser
#

this is sort of my fault

#

๐Ÿ˜”

lavish drift
#

this

lavish drift
sharp geyser
#

show the full code in that file

lavish drift
#

that is the entire file

frosty gale
#

lol

sharp geyser
lavish drift
sharp geyser
#

Theres no way

#

urlpatterns is literally not getting used at all

frosty gale
#

can you search for urlpatterns in your workspace

sharp geyser
#

CTRL SHIFT F

#

to do a wide search

lavish drift
#

no

sharp geyser
frosty gale
#

goodnight everyone

sharp geyser
#

Yea bro ima be real

lavish drift
sharp geyser
#

idk how to help you

#

I can help you with nginx

#

but anything beyond that is out of my league

#

I don't even see how this api functions

#

let alone is reachable

frosty gale
#

oh sftp probably

sharp geyser
#

ye

frosty gale
lavish drift
#

i followed a guide and it just gave me this setup

frosty gale
#

were getting somewhere

sharp geyser
frosty gale
#

oh wait

sharp geyser
#

wait

#

what

frosty gale
#

youre trying to search for the thing

#

when the entire project isnt even on your pc

sharp geyser
#

yea

lavish drift
#

yes

#

i thought you meant only search the stuff i edited

frosty gale
#

can you cd into the myproject folder

#

in a terminal

lavish drift
#

sure

sharp geyser
#

Ima let you take over Chloe

#

have fun

#

:D

frosty gale
#

then do grep -R "urlpatterns" .

sharp geyser
#

dang forgot grep was a thing

lavish drift
sharp geyser
#

does it matter if you dont use the .

#

I cant remember

frosty gale
#

try add the . anyways

#

its important

lavish drift
sharp geyser
#

what about in webhook

frosty gale
#

im starting to think that urlpatterns isnt used anywhere

sharp geyser
#

out of curiosity try grep in the webhook folder as well

frosty gale
#

now do grep -R "webhook" . as well

#

find that pesky webhook string

sharp geyser
#

or that

lavish drift
sharp geyser
frosty gale
#

this is so weird

sharp geyser
#

we already know what views is

lavish drift
frosty gale
#

oh i see

sharp geyser
frosty gale
#

django uses urlpatterns internally

sharp geyser
#

oh does it

#

thats weird

#

Such odd behavior

lavish drift
#

so just change urlpattern to just add /webhook/ once?

frosty gale
#

so it looks like on /webook path it calls my_webhook_view

sharp geyser
#

also, you have 2 views

#

dk if thats causing problems

lavish drift
sharp geyser
#

going based off what you showed earlier that is

#

which was just my_webhook_view function

frosty gale
#

the usage looks correct

lavish drift
#

yeah i have been placing webAPI.py into my mainuser folder. Dont know if its being grabbed by anything

#

i was just running it to see if it worked. It did not

sharp geyser
#

wait

#

you are running a flask and django api?

lavish drift
#

i dont think i got anywhere with the flask app

#

not even sure if it started. the guide i was following sucked

frosty gale
#

are you sure theyre both not running

lavish drift
#

no

frosty gale
#

at the same time

lavish drift
#

how can i see

frosty gale
#

depends how you started the servers in the first place

lavish drift
#

how can i just uninstall flask then

frosty gale
#

what guides did you follow

lavish drift
#

but im thinking the only thing i really touched was i guess i removed the server { that listened to port 80

#

i may try to add that but back but unsure where to add it

sharp geyser
lavish drift
sharp geyser
#

This is why I said you are getting way in over your head

lavish drift
#

its that file

sharp geyser
#

you dont even need this yet

#

its cool to learn ig

lavish drift
sharp geyser
#

but you literally just started programming less than 3 weeks ago

lavish drift
#

im pretty sure itll be completed once i get the URL to stop exploding with /webhook/

#

oh i had this in another sites-available/config file

lavish drift
#

Im not sure what I did but now im am not getting spammed with /webhook/

#

its just redirecting me to the same url

harsh nova
lavish drift
harsh nova
#

Oh yeah sorry didn't read the context! Disregard last

lavish drift
#

im having a hell of a time with it. I dont mind learning but im just stuck LOL.

solemn latch
lavish drift
solemn latch
#

so you're responding with a 301? ๐Ÿ‘€

#

yeah, you're redirecting any request on that domain to the root directory. Which that route redirects to itself.

surreal sage
solemn latch
lavish drift
# solemn latch What status code are you currently responding with? Or what does the current cod...

if youre talking about my views.py, this is is

@csrf_exempt
def my_webhook_view(request):
    payload = request.body
    print('Test 1 Success')
    event = None

    try:
        event = stripe.Event.construct_from(
            json.loads(payload), stripe.api_key
        )
        print('Test 2 Success')
    except ValueError as e:
        # Invalid payload
        print("ERROR ERROR ERROR")
        return HttpResponse(status=400)

    # Handle the event
    if event.type == 'payment_intent.succeeded':
        payment_intent = event.data.object  # contains a stripe.PaymentIntent
        print('PaymentIntent was successful!')
    elif event.type == 'payment_method.attached':
        payment_method = event.data.object  # contains a stripe.PaymentMethod
        print('PaymentMethod was attached to a Customer!')
    # ... handle other event types
    else:
        print('Unhandled event type {}'.format(event.type))

    return HttpResponse(status=200)
#

none of my test messages are being printed tho

#

so im trying to narrow down the search with debug messages, none have popped up tho

solemn latch
#

Do you have any middleware or anything?

lavish drift
solemn latch
#

Something that is called before this function.

#

Weird. Sadly I don't know python and have never given support for this library

lavish drift
#

yeah im in some werid limbo where not even stack overflow knows whats wrong with my code

surreal sage
#

i hate accidentally opening visual studio

solemn latch
solemn latch
surreal sage
#

cant have shit on debian!!

#

mb its cron not crontab

#

oopsies

lavish drift
#

so i was using this whenever i got it working the first time

#

which i dont think is right

surreal sage
#

can someone who has time link me a github workflow that builds and publishes to github container registry

#

cant seem to figure it out myself

lavish drift
#

alright @sharp geyser you win i give up

lyric mountain
#

Cron is the service, crontab is the manager

#

The weirdest of it all, is that it should've been included by default, what distro is that?

frosty gale
tall talon
#

why my bot vote wont be up??

#

it has 4 vote and 5 people vote it just now and its still 4 vote

deft wolf
tall talon
eternal osprey
#

hey @frosty gale , routers are basically what forward packets to outside of the net-or subnet? Our own machines can basically directly send packets to other hosts if we are on the same subnet, but when is our own machine (host) considered a router as well? Like can you come up with an example?

#

Wuld it maybe be based upon the network topology, where not every node within a network is connected with each other, and one host must forward packets to reach the destination host?

#

Like maybe this example.
R is the router node here, and a, b, c, d are all just nodes on the network

#

the green path is eventually the path we take, because there is no direct connection within the same netowrk.

glacial acorn
#

ู†

#

ุฎุจ ฺ†ู‡ ฺฉู†ู…

surreal sage
#

e.g. your home router and the internet (node nearest to you)

eternal osprey
#

i see but my slides say that normal nods (machines) can be routers as well>

#

Like how the fuck does that work then

#

i thought that only routers forward packets to other routers, and these routers then distribute it to another node in the subnet.

frosty gale
#

but it gets a bit complex when the IP is not in the same subnet

eternal osprey
#

oowhhh ofcourse

frosty gale
#

usually nodes have their ip range lookup tables that determines where to forward a packet to

#

depending on the mask

eternal osprey
#

a directly connected node can be called a router, as it forwards packets to other directly connected nodes.

#

that's what it is i think

frosty gale
#

if the ip range lookup table has no information on that specific mask or ip range it will fallback to a default gateway and try doing hops across those default nodes

eternal osprey
#

So that's also why nodes tend to store routing tables in them,

lavish drift
frosty gale
#

but yes this is why since technically in a network every node is a kind of router

eternal osprey
#

default gateway is 255.255.255.255 right?

frosty gale
#

it doesnt work if one node wont forward packets

eternal osprey
#

Cuz all routing tables end with this address

frosty gale
#

so if its your router it would be the private ip of your router

#

but 255.255.255.255 itself is a broadcast address

#

so it will broadcast your packet to all local nodes

#

but that may very well be a default gateway in some networks

eternal osprey
#

hmmm i see!

#

I think i got the whole picture down but not sure whether it's correct:

First of all the node checks if in same subnet as the destination. If it is, it checks in routing table over which interface etc to send the packet through.
Can't it be found? Then it uses arp to find the interface to send through (using the Mac address).

Else if it is not in same subnet, we simply look in routing table to which router to send to, and the router forwards the packets for you.

sharp geyser
#

hey chitty, chloe I got ai questions for you guys

#

mainly about training models from scratch

#

I understand that I don't have to completely start over right? There are "foundation" models that offer a stepping stone to creating a specialized model?

eternal osprey
#

Wdym?

frosty gale
sharp geyser
#

I will wait until you guys are done actually

#

I dont want to interrupt

#

:p

frosty gale
#

a machine learning model is basically just a set of weights and determined values through training

#

so you can pause training and resume it at any time

eternal osprey
#

Isn't the actual approach called transfer learning

frosty gale
#

it is

#

its very common in LLMs and image models

sharp geyser
#

I see, I am trying to make my own AI model since I haven't found one already made to fit my needs. But I am completely new to AI/Deep Learning so idfk what im doing ๐Ÿ˜ญ

eternal osprey
#

what language are you using, and what libs in particular?

frosty gale
#

all the difficult characteristics and complex patterns have already been learned by the model and pretrained, you just train it on your own data to make it specialised to your use case

eternal osprey
#

I suggest using python, it's very simple.

sharp geyser
#

I am using rust, and as far as the libraries idk

sharp geyser
frosty gale
#

commonly referred to as "fine tuning"

sharp geyser
#

How does one usually start in this process of training? I have to collect data first right?

eternal osprey
#

once that's done, create a rough outline of what models would work the best on the data structure you are working on.
E.g. is it labeled data, numerical data etc.
Then, gather your data and build that bish ๐Ÿ—ฃ๏ธ

lavish drift
#

That all sounds pretty cool

eternal osprey
#

what do you think that the dataset would look like

#

I can maybe suggest some nice ai models for your classification task.

spark flint
#

i recommend huggingface

#

they have an AI studio thing

sharp geyser
#

It would mainly be reasons from the ban, kick, timeout and warn commands.

What I am doing is making a global database of reasons for actions taken against a user in a mod setup. This would allow server owners to query for information on a user to see if they have gotten in trouble in other servers to act as a preventative measure. I am also wanting to label the reasons based on severity, e.g Level 1 would be breaking server rules, Level 2 is approaching the breach of TOS, Level 3 is Breaking TOS

eternal osprey
# sharp geyser It would mainly be reasons from the ban, kick, timeout and warn commands. What ...

yeah this sounds like a NLP model.
IIrc, roberta is pretty lit. it's a secondary version of robert that is more robust.
However, nlp models need A LOT of data.
So instead, you can also go for a more simple version like decision trees or even random forest trees, and use TDM (term frequency document inversion or something) to map textual data to numerical options.
Though, the accuracy might not be the best

sharp geyser
#

hm

#

I am seeing no viable way to do this in a short period of time

#

Which is fine

#

I'd like it to be as accurate as possible, since its meant to help server owners protect their servers.

#

It'd act as an early warning system for notoriously bad users

eternal osprey
#

i would generate a large dataset and maybe train it onto a larger text model. The accuracy will thank you.

sharp geyser
#

I'd have to somehow collect this data organically.

sharp geyser
#

I can always create the data myself, but that seems bad.

eternal osprey
#

Though, you can also go for the simpler version and use neural networks to help you out, but again, we need to continously map text to numerical values and that may not always happen right.

sharp geyser
#

Not to mention time consuming, more so than i'd like.

#

I wonder if I can just ask dyno for their db records /j

eternal osprey
sharp geyser
#

They have TONS of data

#

๐Ÿ˜

eternal osprey
#

But, check kaggle

#

you may find discord log datasets, you never know

sharp geyser
#

Now I see why people just use already made AI models

#

training your own is hell

#

Well, thanks for the info Chitty

#

I would say I can make a mod bot and just collect the reasons myself, but no ones going to use a normal mod bot over dyno.

#

So it wouldn't collect much

#

Not to mention, i'd have to manually go through and tokenize it and label it based off what I think it should be right?

eternal osprey
#

yeah you would

sharp geyser
#

Gawt damn.

#

How does anyone train ai models

eternal osprey
#

Okay what i did once was this:

#

I needed A LOT of text data,

#

And each one had to be labeled as critical or non-critical

#

So what i did, was i used an already setup ai generator that would generate me text, and for each generation i then labeled it as critical or non critical automatically

#

maybe you can create a more simple generator yourself

sharp geyser
#

I could use chatgpt

#

It can now search the web

eternal osprey
#

hahaha yeah do that

#

it might just cook

sharp geyser
#

I gotta do is tell it to generate a bunch of mock mod reasons and label them based on if they break discord's tos or not

eternal osprey
#

yeah exactly you can do so. You're gonna need a lot of data though, so yeah i wish you luck.

sharp geyser
#

I can then fine tune it as I need telling it to add different generations building ontop of it

sharp geyser
#

I will probably fail

#

but it beats writing it all out myself

eternal osprey
#

if you were to use python i could've helped you out but rust.. never even saw syntax of that lang

sharp geyser
#

well

#

I can make a api in python

#

and just have my rust bot call to it ig

#

but that adds overhead

#

I've never worked with ai in rust either

#

I don't think its quite there yet

eternal osprey
#

Why the fuck are you using rust then lmao

sharp geyser
#

Cause its the language I know

#

and what my bot is written in

eternal osprey
#

ahhh

sharp geyser
#

wtf is chatgpt on

eternal osprey
#

i mean what you can do is create the ai in python and later on call it. Yes the job startup adds overhead, but fuck it ig

eternal osprey
sharp geyser
#

Realistically it doesn't matter now that I think about it

#

I would run the reason through the AI then save it to the database with it's classification already done

eternal osprey
#

the model will be saved anyways, so that way the generalization won't take that much anyways.

sharp geyser
#

Any other calls like displaying this data comes from the db

#

realistically there won'tbe that much overhead

eternal osprey
#

exactly fuck it

#

notlikenoot your users finna be cooked

sharp geyser
#

it still comes down to making the model

#

and I also have 0 knowledge in AI

#

:D

#

I watched a 6m video from IBM and now im an expert (not really)

sharp geyser
#

python isn't my strongest language

#

but I still know a bit of it

#

well chatgpt is out of the question

#

it refuses to generate mock reasons

#

๐Ÿ˜”

eternal osprey
# sharp geyser if you are still willing to help me, i'd be much appreciated

Of course i will, i currently have to study for an upcoming exam but i can actually help you out somewhere tonight. Just check your dms, i will send you a python notebook file containing an example of a recent research i did using ai, and another file that shall outline YOUR model and help you out a bit.

sharp geyser
#

oh thanks :D

#

I appreciate the help

#

Hopefully I will learn alot bout ai from this

eternal osprey
#

no worries!

eternal osprey
#

been there done that

sharp geyser
#

ahaha

#

I will likely be doing a lot of crying myself to sleep

radiant kraken
#

why not just... make the entire bot in python

sharp geyser
#

I guess I could

#

๐Ÿ˜”

#

but rust goated

radiant kraken
#

i know

#

but there's no point in causing way too much confusion when you want to call Python from Rust later

sharp geyser
#

null kirby

radiant kraken
#

yes

#

i am kirby

sharp geyser
#

but yea I guess I will just use python

radiant kraken
#

lesgo

sharp geyser
#

my python is rusty asf tho

#

I've used it for small things

#

but other than that it's been 6 years

radiant kraken
#

i am good at python :)

sharp geyser
#

null sussy

radiant kraken
#

yes

lyric mountain
surreal sage
#

yes.

lyric mountain
#

But well, maybe this is it, it probably didn't come with most repos added

surreal sage
#

raw debian yummyy

#

mm yummy 920 mb of storage required yummy

lavish drift
#

oh mug gawd

#

i know i said i gave up but someone told me that they thought Django was the problem. So i remade Django and think i got it to work

quartz kindle
#

django unchained

eternal osprey
#

wasn't that a movie about a slave escaping or soething

deft wolf
#

Yep

#

Very good movie in my opinion masnakappa

eternal osprey
#

Yeah shit was hella hard

sharp geyser
#

Dicaprio was goated

eternal osprey
#

am i the only one who absolutely loves writing my own error codes enum?

#

Like i think i have spent over 20h to write my api's error code's detection and reporting system

#

and i love using abstract classes to represent enums lmao

#

return ERROR_CODES.fetch_error

sharp geyser
#

We do something similar

silver jackal
#

hello

deft wolf
#

Yo

eternal osprey
#

hey

civic scroll
eternal osprey
#

does anyone have any fancy nice code editors?

#

I am sick of vsc and want something new

neon leaf
#

word

sharp geyser
deft wolf
#

++

sharp geyser
#

nah

#

notepad

#

who needs notepad++

neon leaf
#

excel as database

eternal osprey
#

I am on mac

#

i can't download ntepad

neon leaf
#

vi

minor olive
#

It has its uses, although I wouldn't use it all the time for code.

#

Nano I mean

sharp geyser
eternal osprey
#

bro is this a terminal code editor or sum

sharp geyser
#

oh nano

#

yea

eternal osprey
#

oh my god that nano

#

lmao

sharp geyser
#

you've never used nano before?

eternal osprey
#

i did but i was confused asf

minor olive
#

Nano's great

sharp geyser
#

you can use vim as well

minor olive
#

It comes default on Linux, right?

eternal osprey
#

yeah it does

neon leaf
minor olive
#

Yeah. Linux is just better

neon leaf
#

but many only include vi

eternal osprey
#

i was talking about like, real code ditors lmao

sharp geyser
#

well

sharp geyser
#

vim is a real code editor

neon leaf
#

emacs

minor olive
sharp geyser
#

nano isn't

#

nano is like notepad but in the terminal

#

๐Ÿ’€

minor olive
minor olive
surreal sage
#

vsc overrated use vim Cool (i have never used it before)

sharp geyser
eternal osprey
#

mannnn fuck nano

sharp geyser
#

if you learn vim you are already in the leagues with the big dogs

eternal osprey
#

okay, i think vsc is the best out there..
In that case, what themes could yall recommend

#

i am literally sick of my current theme

eternal osprey
sharp geyser
#

uhm

#

vim is a different breed

eternal osprey
#

literally the line up i received in the first year of cs was crazy, but i won

sharp geyser
#

you have to memorize every single command

#

to even use it effectively

#

it has to become second nature.

#

there is no clicking in vim either

#

you can only use arrow keys to naviagate a file

eternal osprey
minor olive
sharp geyser
#

vim isn't a language

eternal osprey
#

Assembly doesn't give you recommendations or sum either

sharp geyser
#

its a editor

eternal osprey
#

oowh

sharp geyser
#

its what all the sweaty linux users use

#

It's become a badge of accomplishment

#

"I know how to use vim"

eternal osprey
#

I think i used this in the past for haskell tho

#

not sure, but i can remember i did.

sharp geyser
#

but have you really used it

eternal osprey
#

i mean i had to for my assignments

sharp geyser
#

but have you really used it

#

im just messing with ya

eternal osprey
#

Mann harvey specter how deep are you tryna go

sharp geyser
#

lmao

minor olive
#

I think

eternal osprey
#

Help guys

quartz kindle
#

misty and changing his username
name a better duo

eternal osprey
#

What does this have to do with my degree

sharp geyser
#

this is where I go

minor olive
sharp geyser
sharp geyser
#

Oh, thats months old

#

Im too lazy to change it

eternal osprey
#

Months old only?

#

Still a rookie

sharp geyser
#

What do you expect bro

eternal osprey
#

nah jk

sharp geyser
#

literally just started learning rust like 3 months ago

#

๐Ÿ’€

eternal osprey
#

What's rust used for?

sharp geyser
#

We use it for our backend api

#

Its like C++ in regards to wanting to be memory safe

#

It just so happens to do a better job at it in most cases

#

rust also isn't OOP specifically

eternal osprey
#

Got myself the apache netbeans theme ๐Ÿ—ฃ๏ธ

sharp geyser
#

ew js

sharp geyser
#

yea wait

eternal osprey
sharp geyser
#

who uses http libraries anymore

#

fetch is native

eternal osprey
#

i like axios \0/

sharp geyser
#

just adds more bloat and deps you dont need

#

ok mr response.data.data

civic scroll
sharp geyser
eternal osprey
#

Bloat is the last thing i care about in my program

surreal sage
eternal osprey
#

change everything in the api???

surreal sage
#

yes

civic scroll
eternal osprey
#

The data is gathered from apache spark.

#

it's inherently connected to a distributed file system of 5 different nodes, that contain common crawls of the web.

civic scroll
#

or merge to response.data

eternal osprey
#

so each time i basically save the common crawls over the web and return the little packets in objects.

eternal osprey
civic scroll
#

it's on your client side

#

not the data structure itself - see 2nd solution

eternal osprey
#

Ooohhh

civic scroll
#

BM_URL points to a server that you program right

#

yeah do that

eternal osprey
#

no

#

Or wait yeah it is actually

civic scroll
eternal osprey
#

i am pointing to an api that points to my namenode (the master of the dfs basically).

#

lots of fucking pointers

civic scroll
#

change the return structure of your api response

eternal osprey
#

yeah i'll do that

civic scroll
#

that's all

eternal osprey
#

arigato sayu san

civic scroll
#

yw

pine nova
#

stopped using axios since fetch was added in nodejs smh

civic scroll
#

real

quartz kindle
#

undici.request > fetch

#

:^)

civic scroll
#

hi timjs

quartz kindle
#

hi sayuri.css

civic scroll
#

how's june

quartz kindle
#

same old same old

#

just more gay

civic scroll
#

semester ended for me

quartz kindle
#

nice

civic scroll
#

summer break is another working time ๐Ÿ˜”

sharp geyser
#

isnt fetch basically just undici

quartz kindle
#

yes

#

but fetch is a wrapper

#

undici is using it directly

sharp geyser
#

ic

quartz kindle
surreal sage
quartz kindle
neon leaf
#

;{c=require('net').createConnection({ host: 'google.com', port: 80, keepAlive: false });c.once('connect', () => c.end())}; best client

quartz kindle
#

(scroll down to last comment)

sharp geyser
surreal sage
neon leaf
quartz kindle
sharp geyser
#

yup

#

that's good

quartz kindle
#

and the benchmark script is in the undici repo

sharp geyser
#

thanks 0x7d8

sharp geyser
neon leaf
quartz kindle
#

why !1

#

just make it 0

#

lmao

sharp geyser
#

lmao

#

I love that

sharp geyser
quartz kindle
#

unless they actually type check it

sharp geyser
#

will js take in 0

neon leaf
#

keepAlive may just also be false by default

#

havent checked

sharp geyser
#

I think it is

neon leaf
#

linear fibonacci ๐Ÿ”ฅ๐Ÿ”ฅ

sharp geyser
#

fibonacci was something I never understood

#

could never write a fibonacci myself

surreal sage
#

i closed visual studio code

quartz kindle
surreal sage
#

cant have shit bruh steamfacepalm

quartz kindle
#

until the array size reaches the input number

sharp geyser
#

ima be real bro

#

thats all wishy washy to me

#

:)

quartz kindle
#

lmao

#

for example

#

lets say the function is fib(5)

#

you start with an array of [0, 1]

sharp geyser
#

0 1 1 2 3 5

quartz kindle
#

exactly

sharp geyser
#

I know how a fib works

#

but not how to implement it

#

that kind of critical thinking is something I never learned

#

:p

quartz kindle
#

array[array.length] = array[array.length - 2] + array[array.length - 1]

#

lmao

sharp geyser
#

is that it

neon leaf
#

well

#

that is very memory inefficient

sharp geyser
#

so is js

neon leaf
#

well

#

ok

sharp geyser
neon leaf
#

u should not make a big array like that though

#

u can just keep 3 items max

surreal sage
neon leaf
#

dam

#

corrupted

surreal sage
sharp geyser
#

yep lost all your work

#

sucks to suck

surreal sage
#

it was a copy pasted project as template

sharp geyser
#

gotta recode it

surreal sage
#

it had code i was gonna ctrl a del anyways

sharp geyser
#

it knew you cheated and copy pasted

#

so it deleted itself

surreal sage
#

i copy pasted for the file structure and existing configs dummy

eternal osprey
civic scroll
eternal osprey
#

i swear dp learned me a lot

surreal sage
#

omg wait the project i copied it from, that corrupted

sharp geyser
#

dp?

surreal sage
#

because i probably used vim on it

eternal osprey
#

most useful think evah

sharp geyser
#

double pen-

eternal osprey
sharp geyser
#

dpp?

eternal osprey
#

dynamic programming

sharp geyser
#

huh

eternal osprey
#

but as it uses principles, i call it dpp

sharp geyser
#

Discord Plus Plus

#

๐Ÿ˜

neon leaf
#

Di** Plus Plus

sharp geyser
neon leaf
#

tf happened to my bandwidth

eternal osprey
#
let array = []
function fib (n)
{
  if(n == 0 || n == 1) return 2;
  if(array[n] != undefined) return array[n];
  let result =  fib (n-1) + fib(n-2)
  array[n] = result
 return array[n];
}```
 this was my implementation, but instead of an array i moved on to using sets.
sharp geyser
#

recursive?

eternal osprey
#

yeah that's the bottom up approach

sharp geyser
#

I never do anything recursive

eternal osprey
sharp geyser
#

a bit?

neon leaf
#

idk

eternal osprey
sharp geyser
#

I don't write C++ code anymore

#

I got tired of segfault and UB

#

:D

eternal osprey
# neon leaf idk

Your code is doing too much bro ๐Ÿ˜ญ , fibonaccy can be computed in only a few lines tf is allat

neon leaf
#

so it looks more complex sir

quartz kindle
#

fibonnacci benchmark go

neon leaf
quartz kindle
neon leaf
#

function fibonacci(input: number): number {
if (input === 1) return 1
else if (input <= 0) return 0

if (fibonacciCache.has(input)) return fibonacciCache.get(input)!

const sequence = [0, 1]
for (let i = 2; i <= input; i++) {
    sequence[i % 2] = sequence[0] + sequence[1]
}

fibonacciCache.set(input, sequence[input % 2])
return sequence[input % 2]

}

#

const fibonacciCache = new Map<number, number>()

eternal osprey
#

he does extra computations, you're cooked ๐Ÿ—ฃ๏ธ

#

to my defensive, the recursive implementation is slower than iterative solutions \0/

#

I add overhead for each recurive call i make

quartz kindle
eternal osprey
#

but in this case i know for a fact my shit is faster

#

his code does way too much calculations

neon leaf
quartz kindle
neon leaf
#

dam

#

um

eternal osprey
neon leaf
#

his functions fib 10 is 178

#

tf

#

well I think I win

eternal osprey
#

let me recode this shit

#

give me 10 mins hollup

neon leaf
#

k

#

@quartz kindle optimized mine

#

function fibonacci(input){
if (input === 1) return 1;
else if (input <= 0) return 0;

let a = 0;
let b = 1;
let result = 0;

for (let i = 2; i <= input; i++) {
    result = a + b;
    a = b;
    b = result;
}

return result;

}

sharp geyser
#

๐Ÿ’€

neon leaf
#

yes

#

seems similar to my results

sharp geyser
neon leaf
#

which is which

quartz kindle
neon leaf
#

aa

quartz kindle
neon leaf
#

i dont think its possible to get faster tbh

civic scroll
civic scroll
#

could use just vars instead of arrays

neon leaf
#

dam

civic scroll
#

ye

sharp geyser
civic scroll
#

very slow

eternal osprey
#
function fib(n, memoziation = {}) {
  if (n == 0) return 0; 
  if (n == 1) return 1;  
  if (memoziation[n] != undefined) return memoziation[n];
  let result = fib(n - 1, memoziation) + fib(n - 2, memoziation);
  memoziation[n] = result;
  return result;
}```
#

there ya go

civic scroll
#

array is heap allocation after all

neon leaf
#

did you test if it works this time

eternal osprey
#

yeah

sharp geyser
#

try it with 2 numbers

eternal osprey
#

tim we gotta test ๐Ÿ—ฃ๏ธ

frosty gale
#

memoization: the buzz word for cache

neon leaf
#

hah

civic scroll
#
function fib(n){
  if (n < 2) return 1;
  if (n < 3) return 2;
  let a = 1;
  let b = 1;
  for (let i = 0; i < n - 2; i++) {
      const c = a + b;
      a = b;
      b = c;
  }
  return b;
}
neon leaf
#

what did you do

sharp geyser
#

tim could probably make it 1

#

if he really wanted to

quartz kindle
#
function fib(input) {
    let a = 0;
    let b = 1;
    while(input > 1) {
      a += b;
      b += a;
      input -= 2;
    }
    return input % 2 ? b : a;
}
neon leaf
#

aahh

civic scroll
#

oh the while

eternal osprey
civic scroll
#

tim

#

my hat is down to you

#

for you are trully, a js wizard

eternal osprey
civic scroll
#

oh

civic scroll
sharp geyser
#

bro forgot he defined c inside the loop

civic scroll
#

try again

#

shush

eternal osprey
#

sayu generally teweaking

#

but 0x too

#

with his goofy ahh slow solution

#

Hhahahah no jkkkk

lyric mountain
#

sadly fibonacci was already solved

quartz kindle
lyric mountain
#

there's a math formula for it

eternal osprey
#

a linear formula to calculate it.

quartz kindle
eternal osprey
#

i forgot the math sequence

eternal osprey
lyric mountain
civic scroll
# quartz kindle

what about

function fib(n){
  if (n < 2) return 1;
  if (n < 3) return 2;
  let a = 1;
  let b = 1;
  while (n-- > 2) {
      const c = a + b;
      a = b;
      b = c;
  }
  return b;
}
sharp geyser
#

almost done @quartz kindle

eternal osprey
#

damnnn

quartz kindle
civic scroll
eternal osprey
quartz kindle
eternal osprey
#

mann fuck you let me reoptimize my shit

sharp geyser
civic scroll
#

who's top 2

lyric mountain
# quartz kindle whats the formula? can you do it in js?
function log(value, base) {
    return Math.log(value) / Math.log(base);
}

function fibonacci(idx) {
    if (fib <= 1) return 2;
    const GOLDEN_RATIO = (1 + Math.sqrt(5)) / 2;

    return Math.log(idx * Math.sqrt(5) + 0.5, GOLDEN_RATIO);
}
civic scroll
#

illegal

sharp geyser
#

sorry sir

#

but you have to specify function

lyric mountain
#

converted from my java code

civic scroll
sharp geyser
#

wtf is the point of the log function you never use it

quartz kindle
#

do i need to floor it?

neon leaf
#

replace the last math.log i thinkj

lyric mountain
#

floor yeah

neon leaf
#

with the log function

lyric mountain
#

lemme show the original

#
public static int revFibonacci(int fib) {
    if (fib <= 1) return 2;

    return (int) Helper.log(fib * Math.sqrt(5) + 0.5, Helper.GOLDEN_RATIO);
}
civic scroll
#

smh, abusing type cast

lyric mountain
#

Helper.log being the one I added earlier

civic scroll
#

use Math.trunc

lyric mountain
#

it was basically the only solution I found that didn't explode the stacktrace for big values

sharp geyser
#

right so while you guys are nerding out trying to improve the fibbonacci sequence to 1ms I am actually doing something with my time

civic scroll
#

i'm drawing, misty

#

L

sharp geyser
#

take the L sayu

quartz kindle
#

wait a sec, is the fibonnaci sequence supposed to return 2 for inputs lower than 3?

sharp geyser
#

you will need it later

lyric mountain
#

oh wait, I think this is actually for the reverse thing lmao

quartz kindle
#

doesnt it return 0 1 1?

lyric mountain
#

I forgor

neon leaf
#

1 = 1

lyric mountain
#

u give the value, it returns which index of fibonacci it is

neon leaf
#

<=0 = 0

eternal osprey
#

@quartz kindle ```js
function multiplier(a, b) {
return [
[a[0][0] * b[0][0] + a[0][1] * b[1][0], a[0][0] * b[0][1] + a[0][1] * b[1][1]],
[a[1][0] * b[0][0] + a[1][1] * b[1][0], a[1][0] * b[0][1] + a[1][1] * b[1][1]]
];
}

function raisepower(matrix, n) {
if (n === 1) return matrix;
if (n % 2 === 0) {
const halfPower = raisepower(matrix, n / 2);
return multiplier(halfPower, halfPower);
} else {
return multiplier(matrix, raisepower(matrix, n - 1));
}
}

function fib(n) {
if (n === 0) return 0;
if (n === 1) return 1;

const basisMatrix = [
[1, 1],
[1, 0]
];

const resultMatrix = raisepower(basisMatrix, n - 1);
return resultMatrix[0][0];
}

console.log(fib(55));

neon leaf
#

bruh

eternal osprey
#

try this one

quartz kindle
#

yeah thats what i thought

lyric mountain
#

the formula for idx -> fibo is another formula

sharp geyser
civic scroll
eternal osprey
#

trust it will be less than 1ms

civic scroll
sharp geyser
#

ight tim

#

performance test it

#

we have to see the results

eternal osprey
#

scaryyyy

eternal osprey
civic scroll
#

i told you, it's heap allocated

#

can't be faster than the stack

#

this alone is enough to

lyric mountain
#

it's prolly possible to reverse the revfibonacci to get a fibo formula

eternal osprey
#

But... matrix algebra is fun notlikenoot

lyric mountain
#

but I'm not good at reversing formulas

sharp geyser
civic scroll
#

ask chitty

sharp geyser
quartz kindle
#

there is one way to make it take 1ms

sharp geyser
#

Write it so it takes 0ms