#development
1 messages · Page 143 of 1
One message removed from a suspended account.
yes
@earnest phoenix how should I name functions in C if there's no concept of methods on classes? Naming a method add seems kind of counterintuitive if there's a ton of different structures that all have a method named add
like a generic add method?
GATE JIETAI YEAAAAAAAA
you can rewrite the resize function to utilize realloc
static void resize(Vector* v) {
v->capacity *= 2;
v->items = realloc(v->items, v->capacity);
}
@wheat mesa
the way i would do it is
vector_add(&vec);
vevtor_resize(&vec);
vector_free(&vec);
``` etc
That all looks so weird
that would help when you're using an IDE Intellisense and type vector_
👀
i mean there's no concept of classes in C
Ima do some more coding on my game
everything must be a function
wait
const toProperCase = string => {
const array = string.toLowerCase().replaceAll(' ', ',').replaceAll('_', ',').split(',');
if (array.length === 1) {
if (array[0].length >= 3) {
return array[0].charAt(0).toUpperCase() + array[0].slice(1);
} else {
return array[0].toUpperCase();
}
} else {
let newArray = [];
for (const word of array) {
if (word.length >= 3) {
newArray.push(word.charAt(0).toUpperCase() + word.slice(1));
} else {
newArray.push(word.toUpperCase());
}
}
return newArray.join(' ');
}
}
module.exports = toProperCase;
rate my code
const array = string.toLowerCase().replaceAll(' ', ',').replaceAll('_', ',').split(','); this looks weird
I mean if it works it works ig
what should i do
const array = string.toLowerCase().split(/ |_/)
what magic is this
regex
i'm screaming
yes
or just string.replace(/\b/g, x => x.toUpperCase())
it splits either when a space is hit or when an underscore is hit

where
the entire thing
cap
try it and see
that doesn't work null
if it does i will scream
that was the code i seen from volt
that doesnt work
ye it does nothing
does not work
does not work
bruh
not working for me
skill issue
that was the code volt used so
if volt wrote it then it definitely works
this does too technically
string.split(/_| /).map((w) => w.length > 1 ? `${w[0].toUpperCase()}${w.slice(1)}` : w).join(' ')
well you dingus thats now how it works
wym
bruh
^
then it doesn't do what i want it to
try this

ok then code it yourself
good
Why are you even seperating shit by _
Ask chatgpt
👍
why are you asking me
seems like you just wanted to overengineer and show off
if it provides both underscored and space seperated then use the space separated
I asked chatgpt how to get a girlfriend
this just puts spaces
Are you still single?
what
Well I have no love life and now have a restraining order so yes ||legal purposes this is a joke||
i can't chose which it gives
for some stuff it gives one
for some stuff it gives other
you just said it provided _ or space
is this not in separate fields?
what
Battleless, have you heard about our lord and saviour ChatGPT?
no i don't use it anymore
so OKAY_HELLO to Okay Hello ?
people here got mad at me
toLowerCase + replace /(_|\b)\w/g with x => x.toUpperCase @hushed robin
I would recommend using chatgpt
yes and if it's less than 3 characters it should caps all
I use it all the time
just use toLowerCase on the string first then
people here say otherwise
they always say my code is 100% chatgpt
string.toLowerCase().split()
🙄
why not
People here complain about chatgpt the same way they start lang wars
no we do not!!
i would never rely on AIs
this?

yes
string.split(/_| /).map((w) => w.length === 3 ? w.toUpperCase() : w.length > 1 ? `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}` : w.length && w).filter(Boolean).join(' ')
does with work with space and underscore
lemme see
👀
this?
string.split(/_| /).map((w) => w.length < 3 ? w.toUpperCase() : w.length > 1 ? `${w[0].toUpperCase()}${w.slice(1).toLowerCase()}` : w.length && w).filter(Boolean).join(' ')
those chained ternary operators tho
what does the .filter(Boolean) do
it should even be more performant since it only loops over the string / array 4 times instead of 5
remove all falsy values
so empty string
false
undefined
oh ok
null
yes it works perfectly
I thought an empty string is a truthy value in js
it isnt
v

ofc not
imagine
shut up null
🤨
yes I know this my g
my bot works so good now
I got it mixed up with an empty array
python doesnt
python is mid
I've asked a question in their support channel and all they said was "it should work" and moved on

scratch is best
i think there was manga books in 2018
why is it saying theres no result
dumb anilist api
how healthy is this amount of useeffects
looks normal to me
are you sure
Why not?
I dont know
what does useref in react do
just initiates a ref to a component
in components you just do ref={captcha}
and then you can access the component using captcha.current anywhere
what is .current
as in an Element object?
Im going to fucking blow my head off with this Unity shit
not really
components can customize what refs see
for captcha it adds functions to it like resetCaptcha()
me neither
i'll never understand unity
all i know is just useeffect and usestate
uhh, so question related to my oauth flow
do I request a captcha when logging in with lets say github?
or is it enough that I get a token and know its them
nope
to what did you say nope
make game
shut up battleless
first
shut up misty
alr, well it makes sense that way
stop telling people to shut up
or what
why isn't this query working?
specifically only with type and startDate
I'm sending a variables type as MANGA and startdate as 2018 but for some reason it's returning empty
(and if I do it from the editor it returns data)
what error
did you read what I said
@neon leaf after an hour of reading react docs, i finally understand what useref does 
thanks
that is not helpful
i'm asking for runtime error
like did the function you used for the gql query emitted any kind of error
the "code not returning data" is so generic that even you can be put as its alias
buddy
there is no error
the query is not returning data
when it should
sounds like "you are not entering the right query, when you should"
without error i can't help
cc @lyric mountain to look at this
I am
cuh it works in editor
and returns data
also
but in my code no work
your code has issue then
no
cuh
if it's the same, then it should work
yes it should
but it ain’t pal
🗿
that is why im here asking skilled graphql users for help
That's spooky. Maybe your code is haunted. Do you have any holy water?
look at how you did it and how I did it
there's no YEAR for MANGA
why not use start year?
I did startDate
you did year
no
you can also do 20180000 for startDate to filter only 2018 manga
it's prob some other filter
those don’t matter
that is different
If you don’t send the variable it won’t apply the filter
I tested it
and I removed the variable not the filter there
I bet I'm right
Ben your right 12.2% of the time
you need to do 20180000, not just 2018
Do you know how to perform an exorcism?
why
It works with just 2018 there
👍 thanks
Structs exist in C so you can just use member functions which are like methods, lots of libraries use them this way
not really
even if you do it would be very inefficient to store methods in structs
"Inefficient"?
you would have to store those method function pointers every time the struct is initialized
which wastes a lot of memory
That's not how it works, it the function makes sense to go with a struct then that is that, and note that it barely costs any memory as member functions are already optimized in a way that barely uses any memory
Can I see what you mean by “member functions”
he probably meant something like this ```cpp
struct Something {
int a;
void func() {
// public function
}
private:
void privateFunc() {
// private function
}
}
I'm talking about function pointers in structs, even though the C standard does not name them as member functions, they have quite the same concept going by their specification
Yeah this is only C++ right?
Correct
But as for function pointers in structs, that does sound slightly wasteful since I would assume it’s 8 bytes for each pointer
exactly
Unless it gets optimized down
the only way to implement methods is just a function that accepts a pointer to the struct as an argument
(Somehow)
it doesn't
Yeah C is the last language I would expect to have syntactic sugar
no C library does this
you would rarely see things like something->function(arguments); in C
From my limited time with OpenGL, it usually has you pass a pointer to the data you’re modifying in functions
Like glGenBuffers(&vbo, 0);
windows API does a lot too
Or whatever is meant to be the argument
Yes it does, ever heard of alignment? The compilers are smart enough to optimize the size according to the alignment to make it use as less memory as possible, you can even modify the behavior of the optimization by using pragma directives like pack()
there's no point in storing methods as function pointers in C structs
even if you do it would look really ugly in C because unlike C++ you have to ```c
data.method(&data, arguments);
it's better to just do data_method(&data, arguments);, it also saves memory space since each function pointers occupies 8 bytes
Wrong
There are cases where storing them as such is preferred:
-
Polymorphism: In object-oriented programming, polymorphism allows objects of different types to be treated as objects of a common base type, storing function pointers in a struct can allow you to implement polymorphism in C... by storing different function pointers that represent different behaviors in the struct, you can switch between different implementations of a function based on the object's type
-
Callbacks: Callback functions are functions that are passed as arguments to other functions and are called later to perform some specific task, by storing a function pointer in a struct, you can specify a callback function that will be called at a specific point in the program execution
This allows for extensibility and customization in your code, as different callback functions can be provided by the caller, common examples of callbacks include event handlers in event-driven programming or comparison functions for sorting algorithms
- Interface abstraction: If you have a set of related functions that need to be used interchangeably, you can store their function pointers in a struct, this allows you to abstract away the specific implementations and provide a clean and consistent interface to other parts of your program
And we shouldn't talk about size or memory usage since they'll be optimized anyway so the general pointer sizes are fully reduced (to even a single byte because of the alignment information)
But sure, you can also go the other way as you suggested
no C libraries i've seen implement polymorphism, or anything you have suggested, in C you would rarely see function pointers stored in structs, especially if they're meant to be methods (which is stupid)
lots of libraries implement things like this:
i'm not saying that function pointers are pointless, it's just pointless to store them in structs with the purpose of using them as methods
You haven't seen it, GTK, Windows C API, OpenSSL, pthreads, SQLite, libxml2, and more utilizes function pointers in structs for use as methods, but technically it's more for the reasons I mentioned above or the-like
Just because you haven't seen it doesn't mean none of them uses it as such
But you do have a very valid suggestion over the one I did
can you give me one example of one usage of a library that stores function pointers as methods?
because i don't see them apply in Windows C API, pthreads, etc.
An example in Windows C API: https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassa (WNDPROC)
An example in OpenSSL: https://github.com/openssl/openssl/blob/55d3a6be6ba3af9781631e74833ea1dcbd4008e6/ssl/ssl_local.h#L803 (SSL_CTX which is ssl_ctx_st)
An example in pthreads: http://www.qnx.com/developers/docs/qnxcar2/index.jsp?topic=%2Fcom.qnx.doc.neutrino.getting_started%2Ftopic%2Fs1_procs_thread_attr.html (pthread_attr_t)
An example in libxml2: https://github.com/GNOME/libxml2/blob/884474477284474e0151280aaa275a18e3d7a036/include/libxml/parser.h#L720 (*Func)
And goes on and on and on
all of the examples you've pointed are callbacks, none of them are used in the way that mimics object-oriented class methods
Idk if this was answered already but this is a result of a Unicode failure
wndproc is merely just a callback that the OS calls whenever a window event fires
the second sentence...
Libxml2:
This argument isn't going anywhere, though I did say that you've got a very valid suggestion over mine, and I provided proof that mine is used in quite a lot of places so there's no need to continue
oh well
i'm just saying that this is a really bad design, especially when used in waffle's case - also for libxml2: https://github.com/GNOME/libxml2/blob/884474477284474e0151280aaa275a18e3d7a036/example/gjobread.c 
👍
how should I store very large ids? BigInt or VarChar?
in js?
postgres
which lang's gonna use it?
varchar then
alr
but how long are we talking?
stuff like discord ids, github user ids, google profile ids
not long at all then, just outside integer range
use string yeah, it'll save u the trouble when using them
nah
also do you know why I am not recieving a refresh token with googles oauth flow?
github doesnt need one I read
but google does since it includes an expires field
iirc you have to make another request to get the refresh token
i'm working on two different matchmaking flows. one is a host/join flow and the other is join only. this is my current idea for the host/join matchmaking flow.
An admin creates a discord channel named something like Mario Kart Matchmaking.
An admin runs my bot command to create an embed message in the channel like this
Then when someone wants to "host" a match they click one of the options from the dropdown
once someone clicks a host option another embed message is added to the channel like this
once enough people are in the lobby the host can start
there's probably a simplier way to do this
right tim?
wat
how would you do a host/join matchmaking flow?
is the admin step necessary?
not really, there could be a /host command that each player has access to. but the buttons could be easier for people.
i actually have a /host command in my current version
all the options from the admin command can be implemented by a /host command in a step-by-step manner with buttons
oh yeah
ex user does /host
embed shows up with buttons/dropdowns to chose game type, number of players, etc...
the host embed could even be ephemeral if thats possible
oh yeah
until the final button to open the room makes it a normal message
or the bot just posts a message to the channel
idk whats the state of modals rn, but could also make something with modals
for configuring the room
what if the admin step still existed, but the options aren't passed to it. so players still click the button to host the match, but they go through the wizard flow thing
could be yeah
why not make a website at this point
why not indeed
do these rating type descriptions make sense and does it make sense to track these? I was thinking about another FFA rating that tracks player ratings in matches with 6+ opponents. does that make sense?
Why is this shit still happening man, I've already told nginx to use the proper SSL cert instead of my mailserver one
server {
listen 80;
server_name *.aarondye.dev;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/aarondye.dev-0001/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/aarondye.dev-0001/privkey.pem;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
root /home/misty/portfolio/dist;
index index.html;
server_name *.aarondye.dev;
location / {
try_files $uri /index.html;
}
}
What is wrong with this nginx config
Cause at this point its either this or my cloudflare
because this keeps happening
pretty sure you cant do *.website.com
you have to specify every single subdomain
and make a cert for every single subdomain
unless you actually have a wildcard cert
which is not that common
my config is server_name website.com www.website.com api.website.com test.website.com;
for example
and the pem file contains certs for all those domains specifically
what’s a bot that’s never been made
alright Tim, what do you think about this headless matchmaking flow?
Same first two steps
An admin creates a Discord channel for matchmaking. something like Rocket League Matchmaking.
An admin runs my bot command and my bot returns an embed message like this
I actually have a wildcard cert
Or it should be a wildcard cert
once enough people click join queue it creates a message that alerts all the players like this
did you validate with a dns challenge and all that?
i cant find a single example of someone actually using *.website.com on nginx conf, but its supposed to work
yeah but on ssl installation guides and such
even with wildcard certs they always show with a single server_name
ah
Yes I did
Even set to dns only it gives an error
Okay so oddly enough if I do something.aarondye.dev it points to my portfolio
I think my nginx config is fucked at this point
try server_name aarondye.dev *.aarondye.dev;
otherwise idk
maybe your ssl is fucked
try generating a regular ssl and using that instead
I can try but I had a normal ssl cert before and had issues with it conflicting with the mail server
just use a gmail
Battleless if you aren’t providing help please be quiet
So question regarding this do you just make a cert that encompasses all those variations of the domain? And what if you make a new subdomain do you just issue a new cert adding that subdomain?
Also regarding this how would I direct those subdomains to their proper locations such as aarondye.dev points to my portfolio and mail.aarondye.dev points to my mail server on the same vps
are the file perms correct?
Wdym
nginx requires the private keys to have a very specific permission set
else it refuses to use it
Oh?
Do you know what this ruleset is?
not from the top of the head
Alright I’ll look into it when I get home
I have the perfect bot idea
this will be legendary
I can’t say it now so people don’t steal but I will send my progress soon 🤩
@slender wagon be like
it will be soooo good
this will make me $10000 dollars
@earnest phoenix sorry to bother you at this time, but this is a follow up on that gifencoding lib you recommended to me. It works great in terms of performance, tho I do get some choppy results which may just be the gif running out of colors
example: https://cdn.discordapp.com/attachments/497161350934560778/1124550139089014804/profile.gif
Any idea how I can combat this?
I did manage to get a really good looking result with another pfp
@pale vessel ?
so anyway i thought i'd request a dev badge but somehow my bot got it instead
that’s not the active bot dev badge
that’s the badge bots get for registering a global slash command
you can claim the badge here: https://discord.com/developers/active-developer
If you thought of it then people definitely have
mine is def unique i did a deep research lol
like a utility bot
That’s the slash commands feature not the dev badge
Thanks bro, it's been 4 hours not stuck there anymore got it ♥
I used to have this exact same problem, I fixed it by setting the encoder's transparency to pitch black (#000000) with encoder.setTransparent('#000000');
Though I'm not sure if that'll work for you
Hello I have Bot live on Topgg Website. Because of some accident I lost the discord account of that bot. So can you remove that bot from the website?
@earnest phoenix Do you know anything about nginx? I have a question regarding on how it works internally, because i've seen multiple people do server blocks listening on the same port, for example both listen to 80 and it seems to work perfectly fine? Is this normal?
Missing first frame
The first frame is usually the static background of the gif, with the remaining frames being composed on top of it
hello haku
Hello there
Depends on the question
cough
I do use it for my bot's apis
I am mainly just wondering why its possible for two server blocks to listen on the same port
You can use the same port as long as the address is different
address being the server_name?
So if u have 2 domains it'll work even if the ip is equal
Yes
Think about it as a combination of name + port
so I could have?
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name aarondye.dev;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name mail.aarondye.dev;
}
For example I have shirojbot.site and api.shirojbot.site
had I known this i think my issues would of been solved long long ago
U should add a port 80 redirect tho
So if someone tries to access with http it redirects to https
unless you have it behind cloudflare
then make sure it doesnt redirect
hit that wall before 
It works even with cloud
so something like this?
I use it personally
had it infinitely loop within cloudflare when redirecting to 443
can be a apache2 skill issue tho ngl
Lmao
I think so
my 80 one redirects back to a https version of the site
Would need to check my config to be sure
Alright then question real quick
Do I need to make a redirect for each domain/subdomain, so one for aarondye.dev and one for mail.aarondye.dev or can I combine them into the same one?
You can overwrite only the port and keep the address unchanged
wdym
Nope, never used it myself either
oooo so I don't need multiple
that makes my life so much easier
Do you use letsencrypt for your ssl certs?
Don't remember, but I use cloudflare origin ssl
Mmm
I was just curious as to how I should gen my ssl certs with letsencrypt
cause I know it gives you the options of giving it multiple domains but seperating them by commas, I assume thats so you can do aarondye.dev,mail.aarondye.dev,someothersubdomain.aarondye.dev
and have all your subdomains covered
Using cf has the advantage of hiding the true ip and acting as a layer against ddos
The cert also works with any subdomain iirc
How would I use cf for this?
Don't remember adding socket and api domains to it
Just proxy it through cloudflare?
You point your domain do cf and point cf to the ip
There's a tutorial for it on their page
Just search cloudflare origin ssl
https://developers.cloudflare.com/ssl/origin-configuration/origin-ca/ is this the right thing cause there was 2 links
As long as it is about Origin CA certs im sure its the right thing
just wanna be sure before I fuck something up unknowingly or do something useless

I mean, in any case reverting to the original state is just pointing the domain to to the ip
Just save your current config in case u need to revert
Or comment the cert line, as that's the only thing you'll change
bro this shit is so confusing when you are as tired as I am
Best to attempt it with a clear mind, it's not hard but there are a few steps here and there
Well I saved the cert to a pem file and the key to a key file
I guess now i just move those over to my vps and have nginx grab those in the ssl_certificate and ssl_certificate_key props
Do note, origin certs aren't valid if ur not using cloudflare
I am using cloudflare
Ye
Should I proxy everything through cloudflare after or just dns only?
although pretty sure my mail server doesn't like being proxied so I will have to use dns only
There's a config for emails on cf iirc
oh?
ty
gotta figure out hwere I wanna put my pem and key file tho
dk what would be the best location
honestly might just put it in my home dir
ye its in /etc/ssl right?
Yes
for some reason I can't really access those
Are u root?
I am doing this through WinSCP as I don't really know how to get it onto my vps through the terminal
Which will switch to root user if ur already logged in
ye I know that
but I have no idea how to get the key and pem file onto the vps simply through the terminal
I guess I could just copy the contents and make a new file using nano
Scp "from" "to"
For example scp C:\users\blabla\desktop\somefile.txt user@123.12.23.100:1234:/folder
I am confused 😔
I swapped to using the origin ca cert and its giving me site error
ugh
What am I doing wrong
@lyric mountain does nginx just hate me?
Is it my fucking dns records?
At this point idfk
Did u make the domain point to nginx?
my dns records point to the server nginx is on
Yes, but what abt the domain itself?
wdym
Aaron thing, it must point to cloudflare else ur just ignoring it entirely
I don't get what you mean tho.......
The same place u get the origin ca, there are instructions to it
haku I quite literally don't get what you mean
Just a sec
if you mean the nameservers of the domain then yes its using cloudflares nameservers
Because the type declaration is weird
ConstructorOfASvelteComponent lmao
Yea just followed this and issue still persists so at this point idfk
and honestly kinda getting too annoyed to keep messing with it
Once I'm in my pc I'll check how my settings are configured
I mean even following that guide didn't help so I think im just fucked ngl
The good thing is that u never need to touch it ever again once it's done
I'll check later my domain and cf settings to be able to help u troubleshooting it
Lmao
and the cache ye
letting cloudflare handle the redirect for https is the solution ig
Generated by create next app
lets fucking go man
Ah so u blocked 80 on the firewall
Then nginx should've redirected it, but it worked nonetheless
Now lets see if I can setup my mailserver with nginx without fucking shit up
Before I had the issue of my portfolio conflicting with the mail server

Fuck me man
😔
After setting up the nginx config for my mail server it now redirections aarondye.dev to the mail server as well as mail.aarondye.dev
aarondye.dev should be my portfolio tho

U messed something then
mailcow nginx conf
aarondye.dev nginx conf
I assume im supposed to use the same cert for all server blocks that still use the same domain even if its a subdomain of that domain
im slowly losing my mind
I have different apis running on different ports, iirc if u don't specify any it'll default to 80/443
ugh why is this so fucking confusing
Here's the one for the site itself
I might just hire someone to do this for me at this point
Because I simply just don't understand
Don't give up, u can do it
Compare my configs with yours, try slowly making it similar until it works, to see why it isn't
I mean mine are virtually the same
Also check if u didn't point both domains to the same address on cf
this is my current dns config
Tbh it shouldn't matter, as it's ginx who'll redirect
Also restart nginx in case u didn't, do nginx -t to see if there's any syntax error
ye I already restarted nginx
Try specifying the port
it all just points to my mailserver
No matter what I do it ends up at the mailcow ui
Soon I'll be on my pc, then it'll be easier to read
Alright well lmk when you can cause your help would be much appreciated
I gotta head to the UPS store rn anyway
hey 👋 i am making a security module for my bot but when i tested creating channels it was just too slow to take action in both banning the executor & deleting the spam created channels (for ex: 50 channels in 30 seconds). can someone suggest me ideas to speed up the process?
You can't if you're deleting channels
You're being ratelimited
The best way would be to lower what your bot considers a channel spam so it detects earlier
Like creating 5 channels too quickly
Idk if such feature would be useful at all, as if a bot got perm to create channels the issue is with server management
@sharp geyser one last question, where did u put ur config files?
yes i want to know how i solve when i any malecious person start creating or deleting channel or roles
then on first attempt bot will take action
A person would never trigger it, as discord client limits how fast u can delete stuff
Same for creating
So you'd exclusively detect bots or selfbots
If either reached a position with enough power to do it, then the server management is at fault
I put them in /etc/nginx/sites-available
hmm i am saying about self bot sir
Ok, so one last check, is there anything in conf.d or sites-enabled?
^ hoist
nothing in conf.d and oddly enough my aarondye.dev conf is missing from sites-enabled
U can't really prevent stupid mods
did I forgor to symlink it 
Put your site in sites-enables and the mail in conf.d
I mean, don't copy to sites-enabled
Symlink it
But do copy mailcow to conf.d
why put the mail in conf.d?
@lyric mountain is any way bot in first 5 channel delete detect self bot or bot
That's for apis or non-site configs
ah
Track each create/delete event, save the timestamps
so do I just like cp /etc/nginx/sites-enabled/mailcow /etc/nginx/conf.d?
Then see if the distance between them is low enough
U can mv it
ah
Sites-available is not considered when setting nginx
so I don't even need it in sites-available either then?
It's like a bench for site configs
like self bot create 20 channel in 1min
but it's to much channel
what i update in code to solve
So u can enable/disable sites easily by creating/deleting tge symlink without losing the file
I see
Wdym?
How are u doing it currently?
so I can delete the mailcow conf from sites-available then and only update the one in conf.d when I need to ?
Mv it instead
Mv for move
The only 2 folders considered for nginx are conf.d and sites-enabled
means if any bot create 20 channels in one minute but the bot will detect it after this number of channels which is slow , i want to know what i will do for fast result
Lmao but u kept the original file right?
well I have the file backed up somewhere else
But how are u detecting it currently?
Wait what, am I symlinking it still from sites-available to conf.d? Im confused
i test my bot speed but it is slow when testing i am saying when i got at testing time
It should be:
/etc/nginx/conf.d/mailcow
/etc/nginx/sites-available/site
sym /etc/nginx/sites-enabled/site
Okay so I am good then
I can delete the mailcow in the sites-available and leave a copy of it in conf.d
Not what i mean
How are u detecting a channel spam is happening?
The code I mean
please help me in creating antinuke bot
The simplest step would be to ban any bot invited with admin perm
Well now its backwards, aarondye.dev points to my portfolio but so does mail.aarondye.dev
😩
As a nuke is useless without it
god damnit
by creating channels as fast as 2-3 members together
It's a thing at least, now just need to fix the cow
Yea but I don't get how
Did nginx -t say anything?
also craete new roles and deleting channels and roles it ban after deleting 5-10 roles and channels
action speed is slow
@lyric mountain
Show your current code for detection
Move the cow to another folder, then try to access it (the url)
It's supoosed to error as the site is not mapped on nginx
Are you sure it even looks at conf.d ?
If it DOES redirect u to the portfolio then u have a duplicate somewhere
It does
cause I just remembered that when running nginx -t it should of errored
cause I no longer have /etc/letsencrypt/live/aarondye.dev/fullchain.pem
but that was included in the file (forgor to remove it)
weird
okk
for some reason I dont think nginx is actually registering the mailcow file
Put the cow somewhere else, to see if u can still access the site
You're not supposed to be able to, because nginx can't find the config for it anymore
Okay another blunder on my part
apparently its important to suffix the file with .conf in conf.d

A
Listen man I thought nginx would be fine with it being how it normally is with no file extension
😔
Haku you will forever be a god in my eyes
you are on par with tim rn
you solved my months of pain in a matter of hours
and now i understand a bit more of how nginx works
client.on('channelCreate', async (channel) => {
const guild = await client._guilds.get(channel.guildId);
const audit = await channel.guild.fetchAuditLogs({ limit: 2, type: AuditLogEvent.ChannelCreate });
const logs = audit.entries.first();
if (logs.executorId === channel.guild.ownerId) return;
if (logs.executorId === client.user.id) return;
if (guild) {
if (guild.authorized.includes(logs.executorId) || guild.admins.includes(logs.executorId)) return;
}
await channel.guild.members.ban(logs.executor, { reason: 'Synthia Protection Shield' });
const mod_log = await channel.guild.channels.fetch(guild.reports);
if (!mod_log) return;
await mod_log.send({ embeds: [client.utils.embed(channel).setDescription(bold(`${logs.executor.username} has been banned for creating channels.`))] });
await channel.delete('Synthia Protection Shield').catch(() => null);
});
@lyric mountain
Actually, u made me something wonder something
oh?
I was wrong using conf.d for the api 💀
lol
Just searched it, it's supposed to be for literal configs
Gonna move my api to sites available too
But well, easy thing to fix
help me sir plz
Well again thank you my man
finally don't have a fucked nginx

Yw
posting code without context is not useful
It's for detecting channel spam
oh I see
But I cant read it until I'm at pc
why not let auto mod do that?
Cuz mobile wrecks code
now plz help ke solve issue
i am also on phone bro
Oh, ur using audit logs
U should track it locally, else you'll make too many requests for fetching it
Idk how to explain how tho
Basically have a list of when the channelCreate events happened, and by who
Then every time one is created, check the last N entries and see if the time between them is too low
schtinky client modsch
what you mean bro
okk any more you tell will help me
I think you need to get your eyes checked
well would guildAuditLogEntryCreate event be a good choice maybe 🤔
Nice, now it's all ok
Yeah, for catching all create/delete events
@lyric mountain but it is slow ?
Not really, you're already receiving those events from discord
It all depends on how you implement the comparison of entries
main our concern is bot speed of action is slow
hmm ig saving the data to a local Map and then using that data 🤔
It's slow cuz you're burning your ratelimit on fetching the audit logs everytime
@earnest phoenix
{
type: "CHANNEL",
user: "123456789",
timestamp: "millis of when it happened"
}
A list of this would have enough info for tracking spams
hmm
After that just keep the last N entries
To prevent flooding the list with old data
Optionally use a TTL library
Like expiring-map
well for some odd reasons guildAuditLogEntryCreate isnt being triggered but maybe ill ask it at discord.js
Did u include the intent?
is there a extra specific intent for it?
I think so
One message removed from a suspended account.
Guild is the basic intent you need for the bot to work
Check the available intents, see if any mention audit logs
i already have those intents: ["Guilds", "GuildMessages", "GuildMembers", "MessageContent", "DirectMessages"],
There are constants for that yk
I think you need GuildModeration intent to receive any audit log related events
unless I am reading it wrong
That's likely it
ah
the frames are disposed of
U need to keep the first
For disposition of type If it was optimized u always need to keep the first frame (aka background frame)replace
Actually for both u need to keep
It all depends on whether the gif was optimized (removed pixels that never change) or not
It's safe to always keep it regardless, if it wasn't optimized it'll simply be overlayed anyway
any reason to use Set over an object literal here? seems like converting the array into a set would be slower than just using an object.
i will write speed tests faster than tim
object literals win
couldn't Set be optimized so it's at least as fast as object literals?
You do realize that Sets have more overhead compared to objects literals right? Sets checks for values thoroughly and rejects duplicate values meanwhile that's not the case for object literals at all, and besides, when even checking for a value yourself you're calling a method on a Set, but accessing a property in an object literal which is obviously a lot faster
makes sense
so the real purpose for Set is that they can compare object literals
@earnest phoenix yo is there any way to make gcc log which compiler flags were used? or anyway to check if for example lto was enabled or disabled, as well as O2 or O3 for example
in the build logs
couldn't Sets be optimized to ignore the extra overhead stuff if all the keys are strings?
You can use the --verbose CLI flag (-v for short), for example:
$ gcc -O3 -v -o foo foo.cpp 2>&1 | grep cc1
building with npm+node-gyp btw
tried verbose, doesnt show anything
Then you can do:
$ npm_config_verbose=1 CFLAGS='-v' CXXFLAGS='-v' <your npm command or whatever>
works ty
You're welcome
COLLECT_GCC_OPTIONS='-o' 'Release/obj.target/swisseph/swisseph/swecl.o' '-D' 'NODE_GYP_MODULE_NAME=swisseph' '-D' 'USING_UV_SHARED=1' '-D' 'USING_V8_SHARED=1' '-D' 'V8_DEPRECATION_WARNINGS=1' '-D' 'V8_DEPRECATION_WARNINGS' '-D' 'V8_IMMINENT_DEPRECATION_WARNINGS' '-D' '_GLIBCXX_USE_CXX11_ABI=1' '-D' '_LARGEFILE_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-D' '__STDC_FORMAT_MACROS' '-D' 'OPENSSL_NO_PINSHARED' '-D' 'OPENSSL_THREADS' '-I' '/root/.cache/node-gyp/20.3.0/include/node' '-I' '/root/.cache/node-gyp/20.3.0/src' '-I' '/root/.cache/node-gyp/20.3.0/deps/openssl/config' '-I' '/root/.cache/node-gyp/20.3.0/deps/openssl/openssl/include' '-I' '/root/.cache/node-gyp/20.3.0/deps/uv/include' '-I' '/root/.cache/node-gyp/20.3.0/deps/zlib' '-I' '/root/.cache/node-gyp/20.3.0/deps/v8/include' '-fPIC' '-pthread' '-Wextra' '-Wno-unused-parameter' '-m64' '-O3' '-fno-omit-frame-pointer' '-MMD' '-MF' './Release/.deps/Release/obj.target/swisseph/swisseph/swecl.o.d.raw' '-Wall' '-v' '-c' '-mtune=generic' '-march=x86-64'
``` does this mean its already using -O3 even though i didnt specify it?
Yes
oh, no wonder i didnt see any performance difference when compiling with CFLAGS O3
node-gyp specifies the -O3 CLI flag when the build type is Release which is the default anyway
i see
i tried writing an optimized version that checks for objects, but it's adding an extra loop over the array. might be trickier than i thought
i was thinking the Set class could check for any objects and if there are none just fallback to using a normal object literal. but then once an object is added you'd need to copy everything from the object literal into a new storage format
i dont need -march=native either right? it already has -march=x86-64 which i assume is what native resolves to on this machine
The compiler infers the architecture of the host machine by default so you don't have to specify it
👍
Also if you're looking for better performance, use the Clang compiler :^)
this is what i came up with, but it adds an extra loop over the array
instructions pls
on node-gyp + linux
Hello ! Someone can help me please ? I would to center my bio who is in HTML/CSS, adapt it for phone and enlarge the frame.
What Linux distribution are you using?
debian
what?
12 i thikn
?
ah i think i got it
export CC=/path/to/clang
export CXX=/path/to/clang++
export GYP_DEFINES="clang=1"
I didn't understand what you meant
my english is bad 😂
exactly
well, use markdown instead of html
Why not Ubuntu may I ask?
i like starting with something cleaner and install my way
rather than starting with something with a ton of preinstalled stuff
i have linux on my windows
Well Debian's repositories are incredibly outdated so there's also that, unless you're using the unstable repository
i usually install from alternative repos or build from source
depending on the thing
its do, mmh i can speak to you in PM ? for not to disturb others
they don't mind
But regardless, run the following to install the latest stable LLVM release:
$ bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
clang is part of llvm?
okay
oh
the description was supposed to be centered already
are you changing the width of it?
Yes 
sure
All of these are part of LLVM
https://github.com/llvm/llvm-project/tree/main
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@import url('https://fonts.googleapis.com/css2?family=Lexend&display=swap');
body {
background-color: white;
}
h1.title1 {
color: #FFCC00;
font-family: 'Lexend';
font-weight : bold;
text-align: center;
}
div.arrondi {
border-radius: 10px;
width: 450px;
padding: 10px;
background: #0A0019;
}
p.para {
color: #FFCC00;
font-family: 'Lexend';
font-weight: normal;
}
h2.bot {
color:#FFCC00;
font-family: 'Lexend';
font-weight: normal;
text-align: center;
}
p.bref {
color:#FFCC00;
font-family: 'Lexend';
font-weight: normal;
font-size: 15px;
text-align: center;
margin-top: 20px;
}
</style>
<title>Page 1</title>
</head>
<body>
<div class="arrondi">
<h1 class="title1">QU'EST CE QUE WWD® ?</h1>
<p class="para">WWD® est un bot Discord créé en 2019. Il a pour utilité de vous aider dans la modération ainsi que l'administration de votre serveur.<br><br>Pour le présenter brièvement c'est un bot qui :<br>・N'a pas besoin d'un panel pour être géré<br>・Est connecté 24h/24 et 7j/7<br>・Est utilisé pour une utilisation simple pour un résultat de qualité<br>・100% gratuit<br><br>En terme de fonctionnalités, WWD® saura répondre à vos demandes grâce à ses commandes basiques de modération (ban, kick, warn...), ses commandes d'administration (ticket, userinfo, giveaway...) et quelques commandes fun (8ball, cookie...).<br>Des commandes de jeux sont prévues et en cours de développement.</p>
<p class="bref">bref.</p>
<h2 class="bot">C'EST LE BOT QUI VOUS FAUT.</h2>
</div>
</body>
</html>```
to adapt on top gg, ive remove doctype html, html, head
so i have to use what ?
simply remove those tags and it should work right away
also <title> wont work either
its do
do?
i have remove this tags
done ?
sry 😅
ok wait
@quartz kindle how did it go?
its godd but not center
*good
so i have to put at the beginning [center] and at the end [/center] ?
<center> u mean
ok
u could try text-align: center too
trying to find where did it install to lel
The binaries are separated by major version
For example, clang-16 for LLVM v16
already used
@lyric mountain :/
You can install a symlink to use it as clang for example
it worked didn't it?
if you want the yellow text use color: orange on the text div
<center>
<style type="text/css">
@import url('https://fonts.googleapis.com/css2?family=Lexend&display=swap');
body {
background-color: white;
}
h1.title1 {
color: #FFCC00;
font-family: 'Lexend';
font-weight : bold;
text-align: center;
}
div.arrondi {
border-radius: 10px;
width: 450px;
padding: 10px;
background: #0A0019;
}
p.para {
color: #FFCC00;
font-family: 'Lexend';
font-weight: normal;
}
h2.bot {
color:#FFCC00;
font-family: 'Lexend';
font-weight: normal;
text-align: center;
}
p.bref {
color:#FFCC00;
font-family: 'Lexend';
font-weight: normal;
font-size: 15px;
text-align: center;
margin-top: 20px;
}
</style>
<div class="arrondi">
<h1 class="title1">QU'EST CE QUE WWD® ?</h1>
<p class="para">WWD® est un bot Discord créé en 2019. Il a pour utilité de vous aider dans la modération ainsi que l'administration de votre serveur.<br><br>Pour le présenter brièvement c'est un bot qui :<br>・N'a pas besoin d'un panel pour être géré<br>・Est connecté 24h/24 et 7j/7<br>・Est utilisé pour une utilisation simple pour un résultat de qualité<br>・100% gratuit<br><br>En terme de fonctionnalités, WWD® saura répondre à vos demandes grâce à ses commandes basiques de modération (ban, kick, warn...), ses commandes d'administration (ticket, userinfo, giveaway...) et quelques commandes fun (8ball, cookie...).<br>Des commandes de jeux sont prévues et en cours de développement.</p>
<p class="bref">bref.</p>
<h2 class="bot">C'EST LE BOT QUI VOUS FAUT.</h2>
</div>
</center>```
i have put this
$ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100
$ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100
@quartz kindle ^
And if you want to set Clang as the default compiler you can run:
$ update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
$ update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
div.arrondi {
border-radius: 10px;
width: 450px;
padding: 10px;
background: #0A0019;
}
the width here is probably the issue
brb upgrading debian to 12 lel
Though you should set LLD as the default linker as well instead of GNU LD when using Clang as the default compiler, but this isn't entirely necessary (but it sure is better)
$ update-alternatives --install /usr/bin/lld lld /usr/bin/lld-16 100
$ update-alternatives --install /usr/bin/ld ld /usr/bin/lld 100
Alright
for now i wanna keep everything defaults and just mess with this via env vars on npm install
That's understandable
You can set the CC AND CXX environment variables to specify the compiler to use
make sure to never use the LTO option. stick with defaults
i had enabled by default on my npm package
users complained it wouldnt build on amazon aws
LTO is very good, keep it on
i had to remove it tho
Jeff is up to something
yeah
we went through this with voltrex
turns out amazon linux puts the lto plugins in a different directory
for some reason
Because the stupid Amazon Linux distributions don't install the LTO plugins to a standard directory, it's so incredibly annoying
What the hell were they thinking
I think the Amazon Linux distributions are the only distributions that installs them to a non-standard directory
?
Jeff did it on purpose is what i'm saying
the aws instances that are building stuff will use less cpu cycles to build and everyone that uses the software will use more cpu cycles
might be joking though
they did it so their corporate users are forced to hire amazon management plans to manage it for them
🔥💯
alright everything works except the -flto breaks with clang
probably because i have to use a different lto like you said
but anyways, performance difference is negligible
probbaly because node/napi is the bottleneck in my case :^)


