#development
1 messages · Page 251 of 1
was it
oh right
yeah he split into array, reversed and joined
i also tried reversing a string with a for loop, not much difference
chloe: 67.301ms
best_possible_optimizations: 40.922ms
best_possible_optimizations_2: 42.505ms
tim2: 30.67ms
robert ~/projects bun sha1.js
[33.85ms] chloe
[25.81ms] best_possible_optimizations
[24.78ms] best_possible_optimizations_2
[29.72ms] tim2```
interesting
bun uses JSC, which basically means slower raw js, and faster non-js built ins
such as c++ addons and internals
:^)
robert ~/projects deno run sha1.js
error: Uncaught (in promise) ReferenceError: require is not defined
const crypto = require('crypto');
^
at file:///home/robert/projects/sha1.js:1:16
ugh
xDDD
robert ~/projects deno run sha1.js
chloe: 198ms
best_possible_optimizations: 134ms
best_possible_optimizations_2: 116ms
tim2: 16ms
💀
welp now i know what to not use in prod
chloe: 188ms
best_possible_optimizations: 131ms
best_possible_optimizations_2: 113ms
tim2: 19ms
robert ~/projects bun sha1.js
[41.48ms] chloe
[31.50ms] best_possible_optimizations
[34.47ms] best_possible_optimizations_2
[37.81ms] tim2
robert ~/projects node sha1.js
chloe: 69.046ms
best_possible_optimizations: 42.996ms
best_possible_optimizations_2: 43.665ms
tim2: 38.974ms```
by reusing a buffer like 0x7 and using buffer.copy into the preallocated buffer i got 20-30ms faster, huge gains
function chloe() {
const reversedSet = new Set();
let buffer = Buffer.allocUnsafe(32);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
entry.bytes_buffer.copy(buffer);
const reversed = buffer.reverse();
if (reversedSet.has(decoder.write(reversed))) {
console.log("Duplicate found!")
}
reversedSet.add(decoder.write(entry.bytes_buffer));
}
}
turns out buffer.from is a bit slow
oh thats why it fluctuates so much
.set is also as good as .copy
if not slightly better
robert ~/projects bun sha1.js
[19.79ms] chloe
[27.96ms] best_possible_optimizations
[24.66ms] best_possible_optimizations_2
[21.96ms] tim2
buns clearly doing something right
with .write
robert ~/projects bun sha1.js
[27.10ms] chloe
[29.48ms] best_possible_optimizations
[27.56ms] best_possible_optimizations_2
[32.50ms] tim2
with .end
oh no you dont need to call .end on it
well you should to avoid allocating tons of memory
your function is using over 5gb ram on 10000000 objects
tims is definitely the best solution
uses barely any ram and is 2s faster
tims solution hurts my eyes
mitata, one of the best benchmarking libs i've tried so far
very consistent results, unlike most other benchmarking libs
how many entries?
10mil too much lmao
using binary encoding for some reason with textdecoder i got it down another 20ms to Chloe Function: 34.52ms
no idea why thats faster than ascii but this is js after all
gonna add tims too for comparison
@quartz kindle your one runs slower than mine for some reason
Chloe Function: 35.194ms
Tim Function: 57.827ms
Hex Username Man Function: 95.63ms
i used this one
hacks
i still dont get why using binary as a key is faster than ascii
ascii is literally just str[i] = buffer[i]
no thats binary
oh wait
ascii has some extra stupid validation afaik
yeah
i thought it meant something like 0111010010101
then yeah thats gonna be always faster
mmmm
ah yeah, i forgot about that
binary is alias for latin1, not ascii
binary/latin1 is the one that does no checks
i dont like this language
i still dont know if mine is actually reliable/accurate lmao, i did add one duplicate entry to see if it finds it and it did, but im not confident in this rocket science code
yeah, js fluctiations are normal, cant really deal with them
I really need to fix my cooling
I am using an aio with the pump in the radiator but mounted at the top
barely any water going through
using set instead of copy for buffer had no impact
yeah this is my end result and its almost as fast as tims, without finding a way to avoid using a set or converting buffer to string dont think theres a way to make it faster
function chloe() {
const reversedSet = new Set();
let buffer = Buffer.allocUnsafe(32);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
entry.bytes_buffer.copy(buffer);
const reversed = buffer.reverse();
if (reversedSet.has(decoder.write(reversed))) {
console.log("Duplicate found!")
}
reversedSet.add(decoder.write(entry.bytes_buffer));
decoder.end();
}
}
i wonder what happens if i use an object instead of a set
much slower around 30ms more
function chloe() {
const reversedSet = {};
let buffer = Buffer.allocUnsafe(32);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
entry.bytes_buffer.copy(buffer);
const reversed = buffer.reverse();
if (decoder.write(reversed) in reversedSet) {
console.log("Duplicate found!")
}
reversedSet[decoder.write(entry.bytes_buffer)] = undefined;
decoder.end();
}
}
i got this with yours
yeah its about 2ms faster than using map
i checked v8 internals and maps and sets are almost identical in implementation
except set doesnt set any value
ye
anyhow i guess this concludes our annual "try to optimise this js function and work around javascript quirks for no reason other than fun"
but does it
more like monthly
xD
unless you can write something more cursed than tims rope function i dont think so
wonder how it would perform with native bindings
takes ages to setup a nodegyp project though so i wont bother
I have an idea
i dont think the data is large enough to make it faster
you would need to concat all the buffers into a single large buffer, pass it to c++ and then decode everything there in one go
otherwise it wont be worth the overhead
ill write a patch for v8 just to implement this single use case into arrays
xD
[].has_reverse(x)
native bindings are very slow at going back and forth between c++ and js, sadly
ok i was gonna write tims stuff in assemblyscript but i truly dont understand wtf tim wrote to type it out
lmfao
basically
lets say each buffer is like this [34,252,12,534,34,234,53,3463,64,554,2,352,3,23,...]
take first item 34, use it as an array index: [33x empty, something here]
after a few times doing this, you will eventually run into collisions
two buffers that have the same first number
when that happens, you create a new rope node/leaf, for example [33x empty, [251x empty, buffer that first time is 34 and second item is 252, ...], ...]
and slowly you build up a rope like a tree index, something like this:
{
34: {
252: {
12: { ... }
}
}
}
which allows you to compare new buffers to old buffers byte by byte without having to compare all bytes
ill stick to developing an os kernel
lmao
guess how long this takes with assemblyscript (ts to wasm ran in bun)
// The entry file of your WebAssembly module.
export function add(a: u8, b: u8): u8 {
console.log(a.toString(2))
return a + b;
}
function toString(data: Uint8Array): string {
let str = '';
for (let i = 0; i < data.length; i++) {
str += String.fromCharCode(data[i]);
}
return str;
}
export function chloe(entries: Uint8Array[]): void {
const reversedSet = new StaticArray<string>(entries.length);
let buffer = new Uint8Array(32);
for (let i = 0; i < entries.length; i++) {
const entry = entries[i];
buffer.set(entry);
const reversed = buffer.reverse();
if (reversedSet.includes(toString(reversed))) {
console.log("Duplicate found!")
}
reversedSet[i] = toString(entry);
}
}```
(this has been running 2m+ so far on 1mil)
Lol
btw this is how the full rope looks like at the end of the function (with a reduced test case of 10 buffers of 16 bytes each)
hey tim
yeah
ah okay now I get it
its a rope data structure
its very similar to a tree
v8 uses ropes to handle string concatenation under the hood
why cant computers just be magic
brb gonna build a quantum computer
idk why
but with objects instead of arrays
it gets 2x faster at 1mil iterations
but stays the same perf at 100k iterations
now put chloe0 
for (const entry of entries) {
const reversed = Buffer.from(entry.bytes_buffer).reverse();
for (const e of entries) {
if (e.bytes_buffer.compare(reversed) === 0) {
console.log("Duplicate found!");
process.exit(1);
}
}
}```
cpu goes brrrr
hi
how’s it going
still running
good, doing some benchmarking
nice💪🏾
i dont think this is going to end any time soon
its a double loop
i was gonna ask for a humongous favor
essentially 100k x 100k
and i understand if you say no
but
can you look at my game code and maybe give me any suggestions for optimizations or improvements that come to your mind? i can screen record the game to show you how it looks if you’re willing
again, completely understand if you say no
i know you’re a busy man
i mean, i can, but like, if you really wanna fully optimize it, you're gonna need to rewrite the whole thing from ground up
its not that your code is bad
its just that your coding mindset can improve, different ways to think about things
and for that to work, the whole thing needs to start from the beginning
ok i gotcha, over time i’m willing to learn! maybe not i’ll wait on the optimization lol
they say that premature optimization is the root of all evil xD
lol i want to get to that point!
for starters, avoid using fixed timers
always think in terms of "when this ends, start that", never like "run this for x time, after this time run that"
no, just from what i remember from before
mind if i dm you the code? kinda scared to post it here again lol
whenever you can get to it, any feedback at all is appreciated!
love how wildly js fluctuates dependign on what my laptop is doing in the background
exact same run
thats why you gotta run benchmarks a gazillion times, to find a good average
(or run on an empty vps/lxc)
ye
ok i think this is the final version of the function, just a few adjustments, got rid of Buffer.isBuffer()
function tim2() {
const rope = Array(255);
for(let i = 0; i < entries.length; i++) {
const buffer = entries[i].bytes_buffer;
let current = rope;
for(let n = 0; n < buffer.length; n++) {
const entry = current[buffer[buffer.length - n - 1]];
if(entry) {
if(Array.isArray(entry)) {
current = entry;
continue;
}
if(n < buffer.length -1) {
const next = Array(255);
next[entry[n+1]] = entry;
next[buffer[n+1]] = buffer;
current = current[buffer[n]] = next;
continue;
}
// console.log("duplicate found");
}
current[buffer[n]] = buffer;
break;
}
}
}
array is still better than object for integer keys, even though v8 claiming that objects have the same ooptimizations as arrays if all its keys are integers
got a sub 20 using continue instead of else, at 100k iter
might just be luck tho
ok i had enough of this xD
LOL
moral of the story: dont use sketchy ts to wasm solutions
Why can't I set this option to "Discord Provided Link"?
I was trying to create a private test bot, and so I had to set the install link to "none" for once, however now I can't set it back to "Discord Provided Link"
But for my public bot, it is a valid option
Because private bots cannot have this button on their profile
It won't let me generate an OAuth2 link for me to invite my bot to the Discord server where I will be doing the tests
The "Discord Provided Link" option in the Discord Developer Portal is typically used for redirect URLs that point to a Discord-provided endpoint, like the OAuth2 authorization flow. If you're having trouble setting this option, there are a few possible reasons:
-
Limited Use Case: This option is restricted to specific use cases where Discord provides a link for a particular purpose, such as OAuth2 authentication. If your bot or application doesn't fall under these use cases, this option might not be available.
-
Incorrect Configuration: If your bot's configuration doesn't align with the requirements for using a Discord-provided link, the option might be unavailable. For example, this option is usually relevant when setting up OAuth2 flows where Discord handles the redirection to a specified endpoint.
-
API Type: The option might only be available for certain types of applications or bots. For instance, it may not be applicable to bots that don't use OAuth2 or other specific Discord features that require a provided link.
-
Role or Permissions: Ensure that you have the correct role or permissions in your Discord server or Developer Portal account to modify this setting. If you don't have sufficient permissions, you might be restricted from changing certain options.
-
Region or Account Type: Some features or settings in the Discord Developer Portal may be region-specific or dependent on your account type. If the feature is not available in your region or for your account, you might not be able to select this option.
💀
what is bro doing
Apparently it will never let me turn off this option no matter what
So even tho it is currently a public bot with the all intents on, I still can't see the option "discord provided link"
Discord's developer portal is annoying
This option also prevents the "Add app" button from being enabled
Oh thanks
i try to refix the vote seem it dont send to the webhook did i do anything wrong?
const { WebhookClient } = require('discord.js');
const dayjs = require('dayjs');
require('dotenv').config();
module.exports = (client) => {
client.on("webhook_vote", async (voteData) => {
try {
const { user } = voteData;
const webhookURL = process.env.WEBHOOKURL;
// Create a Webhook Client
const webhookClient = new WebhookClient({ url: webhookURL });
// Get the current date and time
const currentDate = dayjs().format('YYYY-MM-DD');
const currentTime = dayjs().format('HH:mm:ss');
// Send the message through the webhook
await webhookClient.send({
content: `:ballot_box: **Received a vote from ${user}!**`,
embeds: [
{
color: 0x00A36C, // Customize the color as needed
fields: [
{ name: 'Date', value: currentDate, inline: true },
{ name: 'Time', value: currentTime, inline: true },
],
},
],
});
} catch (error) {
console.error("Error handling vote event:", error);
}
});
};
WEBHOOKTOKEN=ZZZZZZZZZZZZZZZZZZ
WEBHOOKURL=https://discord.com/api/webhooksXXXXXXXXXXXXXXXXX
is the webhookurl is discord url? or no
Nope
I mean, it depends in what sense
Because you can use the discord webhook url to send a message but you can't use it to receive a request from top.gg
did you create a custom event for vote?
because client.on("webhook_vote") does not exist
also, that code does not have any webhook server in it
show trhe code where the webhook server is
i found this
https://webhook-topgg.com/
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
if you use that, you dont need any code
owhhhhhhhhhh
with that the vote goes directly to discord, not to your bot
which also means you cant do rewards and stuff like that
its ok my bot dont have any function for give reward or anything
because it mostly flightsim used
ok so you can delete all the vote code, and use the webhook-topgg url
Been working on a program to automatically take material properties from a 3D program (in this case Unity) and bake all of the settings the material has into a texture atlas. This includes stuff like tinting the texture, repeat amount and offsets like specified in the material for each texture slot. Also supports normal maps and scaling on that. (I hate math) and the offsets of the texture where the texture overflows the edges to the other corner is what I'm especially proud of (I hate math)
awesome
Did I mention that I hate math
I also hate how when resizing a canvas, all of the image data is lost
Also needed to create clamp and lerp functions

Need to optimize as well since offset in both directions calls for 4 slices to reconstruct the image meanwhile offsetting in one direction only calls for 2.
Really makes me wonder how things look under the hood of a shader
HLSL makes things really easy
I mean like Unity shader internals btw since you need to sample the image textures with a special function if you want tiling and offsets
please dont use chatgpt to help others
its inaccurate 99% of the time and theres no point answering if you aren't writing it yourself and can actually back what you're saying
regarding that, you can generate a link without that button, simply click on OAuth and select your desired perms
the button is merely a convenience for others to invite your bot
One message removed from a suspended account.
One message removed from a suspended account.
DANKE
One message removed from a suspended account.
such bullshit goal
One message removed from a suspended account.
how much does this dude host to have bills that high
storage is so cheap these days
yesss
its like
0.01 cent for 10 gig now no?
or am i too far in the future
~6$ per tb
depends where
google/amazon its stupid expensive
the volume storage products at least
the personal 2tb cloud storage is cheap
but you cant really use that for this, is would be stupid slow
cloudflare r2 costs 1 cent per 10gb for fast storage
plus processing fees and what not
no other fees really
class a is pretty hard to get to the free tier limit
Comparison of all hard drives and SSDs on Amazon, sorted by price per TB
34$ for 900gb SAS is pretty good
but i have 14 600gb ones laying around gg
sas is pretty annoying
https://svelte.dev/repl/440c652622ff44a882a78d34156fa825?version=4.2.18
CSS did not work fully due to repl
I made fullpage scroll snap animation using gsap. I made a sidebar (it appears at the top left in repl, normally it is right on the left of the page). I want to switch between sections using the sidebar, but I can't figure out how to do this. When the section was changed, I also changed the page url hash. Using this, I can understand which section it is in, but I couldn't figure out how to show that section when I go to that hash.
Hii
Having a bit of trouble offsetting an image. My logic is to get the sides and swap them around but that produces this funny little fella. Any help would be appreciated. Using the HTML5 canvas
const right = partInAtlas.getImageData(shiftAmountX, 0, sizeInAtlas, sizeInAtlas); // to left
const left = partInAtlas.getImageData(0, 0, shiftAmountX, sizeInAtlas); // to right
ctx.putImageData(right, 0, 0);
ctx.putImageData(left, shiftAmountX, 0);
This is what I want the end result to look similar to where the black line is where the end of the image actually was before. The left side is now on the right and the right side is now on the left of the black line
but for some reason, there's some overdraw
does getimagedata copy the bytes?
or is it just a reference?
I don't know, but I tried before with another Canvas instance with the same pixel data using drawImage from ctx.canvas
Produced the same results unless the data is also just a reference
The image data is stored in a uint8array
4 * width * height for RGBA
did you try this?
var original = ctx.getImageData(0,0,300,150);
var copiedData = original.data.slice();
var copied = new ImageData(copiedData, original.width, original.height);
I can try that when I get home from work. Just gonna bookmark this convo and I'll get back in like 7 hours :)
xD
guys for unknon reason when some one vote to bot its send many post not just one post ?
Are you returning status 200 correctly
Whenever a shard dies / fails to start, what do you guys recommend doing instead of restarting the whole bot over? It's kinda tedius to continue to do that if something dies on startup.
iirc you don't have to restart the whole bot?
I'm not certain of the process myself, but I wouldn't imagine that's the case
do you have respawn true enabled?
To be fair I'm not sure how else to get the shard to retry once its process exits.
Yeah it retries.
Sometimes it just dies at random, but I seldomly ever restart the bot
Waiting for 30 shards to spawn takes so long, I can't imagine being Iara lmao
djs?
afaik if you kill the child process, the manager should automatically recreate it
Oh hmmmmmmm
Kill the child so the parent can have a new one, got it 
Any reason interactionCreate would be firing the ready.js event?
good to know using var instead of const casued this
Lol
lmfao
i am a dumbass 😭
This didn't work
Database query result: { wins: 0n, losses: 0n }
Error fetching user stats: Error: No data returned from the database
at Object.execute (/root/bots/Leon/commands/utility/userstatus.js:28:23)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Object.execute (/root/bots/Leon/events/interactionCreate.js:14:17)
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('userstats')
.setDescription('Shows your win and loss count'),
async execute(interaction) {
const userId = interaction.user.id;
const db = interaction.client.db;
try {
const [rows] = await db.query(`
SELECT
COALESCE(
(SELECT COUNT(*) FROM rps_games WHERE winner_id = ?), 0
) AS wins,
COALESCE(
(SELECT COUNT(*) FROM rps_games WHERE
(player1_id = ? AND winner_id != ?) OR
(player2_id = ? AND winner_id != ?)
), 0
) AS losses
`, [userId, userId, userId, userId, userId]);
console.log('Database query result:', rows);
if (!Array.isArray(rows) || rows.length === 0) {
throw new Error('No data returned from the database');
}
const result = rows[0];
if (typeof result !== 'object' || result === null || typeof result.wins === 'undefined' || typeof result.losses === 'undefined') {
throw new Error('Unexpected data structure');
}
const wins = Number(result.wins);
const losses = Number(result.losses);
const embed = new EmbedBuilder()
.setColor('#00FF00')
.setTitle('User Statistics')
.setDescription(`Here are your statistics, ${interaction.user.username}:`)
.addFields(
{ name: 'Wins', value: `${wins}`, inline: true },
{ name: 'Losses', value: `${losses}`, inline: true }
)
.setTimestamp();
await interaction.reply({ embeds: [embed] });
} catch (error) {
console.error('Error fetching user stats:', error);
await interaction.reply({ content: 'There was an error fetching your statistics. Please try again later.', ephemeral: true });
}
},
};
It's failing to pull the data for some reason
why are your results returning bigints?
that is a performance killer
@quartz kindle I figured out that param indexes 2 and 3 are for the size of the rectangle not the coordinates on the canvas
Dont need to duplicate the data either
works in all directions, x, y and xy
It also handles numbers greater than 1 and less than 0
How do I send the function in onMount to the component? sveltekit
I'm back to dashboard my first dashboard development attempt, and I'm facing with a strange issue
quick.db works outside my Next.js app folder, however inside the app folder, it keeps throwing the following error:
Module not found: Can't resolve 'write-file-atomic'
It worked to execute npm quick.db write-file-atomic

bro used a clash royale emote 💀
Gaming.
Lol, it expresses my current reaction so
Oh this emoji from clash royale this remember me when I was playing it it's gold days
😃
What should I be doing?
Okay I need some help with verification of my new discord bot, this discord update is quite tragic. It's asking me to do identity verification and when I'm submitting my id it's just rejecting it. What can I do?
This isn't me trying to verify my first bot. I've a bot which got verified 2 years ago and like 4-5 months ago I verified my 2nd bot. When I verified my 2nd bot, it didn't ask for any id. I thought as I'm already verified once, I don't have to do it anymore.
Now after 4-5 months, I'm trying to get my 3rd bot verified. This time the verification page is completely changed for whatever reason and it's asking me plus not accepting the same document. BRUH
they use stripe for the document verification, you can check on the stripe website which documents they accept from your country
maybe they changed something there and stopped accepting certain types
I checked that and it's Pan card only, I'm using that
then you need to contact support or something
not sure why your db library is doing that but maybe there is a setting to disable using bigints
you probably dont need unlimited number precision
I opened a ticket on discords support a hour ago, now waiting for them to answer. Hopefully it helps
Not sure how they can handle it or assist because as you said stripe manages it mostly
there is nothing wrong with your query, its not failing to pull the data, you're just mishandling the variables
rows is an array, [rows] is the first item of the array
Honestly its my first time using MariaDB
its not about the db, its just js
Ah
const rows = ... this is an array, so you can do Array.isArray(rows) and rows.length
const [rows] = ... this is not the array, this is the first item of the array, same thing as rows[0]
Oooo
by the way you might want to set this config to true
not sure why the library by default returns the numbers as bigints
oh right he did
???
no i think the library just returns all numbers as bigints
ah i think i see
it doesnt actually affect the size of the number but it affects the return precision
so if you have something like int(5) for a 0 value mysql will return 00000
not sure though
this would not affect js tho, unless js converted it to string
Ton of words
aggregation/counting is always in bigints by default
INT(5) ZEROFILL with the stored value of 32 will show 00032
INT(5) with the stored value of 32 will show 32
INT with the stored value of 32 will show 32
well, it doesnt really matter
numbers or bigints will not make any measurable difference in this case
your particular issue was just the rows / [rows] thing
bigints means big integers right?
it depends how the library does it but id imagine since it returns 11 0's it tricks the library into thinking it should return a bigint? i dont know how mysql returns data on the low level though
does look like it does it all by strings though
and im not sure if you can check whether a number string would exceed the max number limit accurately
it wouldnt make sense tho, because max safe integer is 16 digits long
but 0x7 said aggregation/counting is alreays done in bigints
so it is
probably that then
not sure why thats a bigint by default though
not much different than returning a number column
from the librarys perspective
all just tables
the db itself has no concept of bigint since its purely a js thing, so the this particular db library must be doing something
if it returns numbers in binary it can just return the number it has as-is
if its a string it should just convert it to a string
none of these really require any special conversions in this case
the js lib for postgres you mean? or what
no the actual db
ah
i guess js will always convert them to bigint without checking how big the number is
if the column is defined as int64
yeah bigint looks like its just 64 bit numbers
though if you want "bigints" theyre really just strings in js anyways so you might as well store them as strings in the database
best performance that way
cpu-wise maybe, but storage-wise bigint is better
how about we just dont use bigints in database and instead store massive numbers like private key prime numbers as blobs/binary in the database
that way we retain blazingly fast performance
fun fact, a js bigint is the most space-efficient method of storing short amounts of binary data in js
its js im not even going to try dispute this because its probably true
this language has you rethink everything you know about optimising code because it doesnt apply to it
tim when optimize my ip and subnet parser
too much rocket science for me
is there any qrcode module recommand to generate ?
qrcode.js : Cross-browser QRCode generator for javascript
@jovial palm use this https://github.com/ushelp/EasyQRCodeJS-NodeJS
You can output to a base64 or image stream that you can upload as a file
If you want to set an embed image/thumbnail with the attached file you can set the embed image url to attachment://file.png for example if you upload it as file.png
Does anyone kow the best way to check for NSFW content in images using JS which balances out resource intensiveness and cost.
Because i could use NSFWJS but it's extremely resource intensive, or i could outsource it to a micro-service but that would become extremely expensive?
The use case is an emoji listing site which gets around 3000 new listings per day.
We also allow people to change the content of their emoji, in case they make revisions to the graphic. And we don't know whether it would be more appropriate to re-check on every edit OR re check on an interval.
You can simply add emote verification for accounts that are new/untrusted and you can also add an emote reporting option
you could also limit/downscale the image size before checking, if you dont already to that
i love how they have a camera option for testing
@quartz kindle https://github.com/PapiOphidian/MaterialList2Atlas if you were curious at all about my struggles for the past few days. It's considered complete
reads 2 lines from readme
10/10
Thank you
hey chat
bye chat
i'm working on vehicle culling and i'm not sure what if statements and stuff to do to make it work properly
i'm updating the "state" of a vehicle on every frame render
the data I have is:
- is the vehicle within the player camera fov
- the distance to the vehicle from the camera
- if the vehicle is blocked by terrain or not (and so the camera cant see it)
and I can either hide the vehicle all together, or just hide the chassis (chassis is e.g. wheels)
I'm just not sure what order of things I have to do
There's a tradeoff between correctness and resource cost
You'll need to sacrifice one or the other
I'm trying to make fullscreen snap scroll animation using fullpage.js, but all sections appear on a single page.
(I'm trying to rewrite a project I got from github using svelte)
The height of all sections is 100vh
does anyone know how i would apply classes / attributes to the body / html further down in the component tree in nextjs app router without using vanilla js to modify the dom since that's frowned upon (e.g. document.body)?
so i can provide theme previewing, rtl, and ltr support etc.
tbf, i dont think nsfwjs is that intensive
Ima be real, don't bother checking
If you really dont want it on there, have a report system
An example of what I made for a Roblox game:
https://github.com/CWRBLX/asset-scanner
Trying to guard against nsfw images is more work then its worth
it can scan many a second and its running on the same machine as the website itself
and often times the results vary in accuracy
It's not me so much as the registrar, even with a report system if some manage to slip by... domain registrars hate it.
In regards to the inaccuracy i think i will mark any with a score higher than 0.5 as awaiting approval by moderator. i would never STRAIGHT remove from an image model, only make the review process easier.
I would PROBABLY dictate a risk score PRIOR to making the image check too. i.e. emoji name, file name, etc. those cold be great indicators as to the content of the image and the likelyhood of it needing to be checked
Why would your domain registratar care?
well we're on namecheap now but when we were on... godaddy 🤢 they would always be on our case
because they have to step in for stuff
namecheap is good and gives 24h notice most of the time
godaddy is trigger happy for anything other than phishing lol
lol
I honestly just don't care enough. You can't expect me to guard against everything perfectly
its better to just let it happen, and handle it as it gets noticed. As even with an AI model it is not perfect if you dont have enough data
var { Events } = require("discord.js");
module.exports = {
name: Events.GuildCreate,
async execute(guild) {
console.log()
}
}
is there a way i could call the client from the guild to access the db or no?
Have you tried guild.client yet?
You can just pass your client as an argument to the function wherever you set up your event handler
That would be the “proper” way to do things
You could technically make your client a singleton if you wanted but that could be a little messy
there is no reason for why guild.client would not work
✨ magic ✨
unless guild is not a guild
Why cant you add client like (client, guild)
I was lazy and did this: event.execute(...args, client);
WHAT IT WORKS
thats not a good idea
also u just muted me for 23 days thats a dick move
I do it
because different events can have different number of arguments
Ill make it 24
no
it work it works
if you do ...args, client
if event has 1 arg, it will be arg1, client
if event has 2 args, it will be arg1, arg2, client
so client is not always in the same position
so you have to remember that in your event handlers
do not do that
bro thinks hes him
bro has learnt the art of mod abusing fron the best 
he muted me once for nothing
I been doing it
what's a good library for making graphs? is D3 still good?
In what lang?
english
JavaScript in the browser or in nodejs building it serverside inside a sveltekit serverless function
like building a svg
im looking at d3-node and d3
A nice way to log
client.on("ready", (client) => console.log(client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.users.client.user.id))

nope
i got it in 2 days
I don't think so
Does anyone know how to convert an HDR color to SDR
For instance, I have a color of RGBI(191, 79, 6, 2.353308);
The color on the left is RGB(191, 79, 6); and the one on the right is the output target color which is RGB(255, 255, 93);
Using JS, but any programmatical way to do it without relying on some external deps/magic would be very appreciated.
I can understand other languages to a certain degree so don't hold back
ai says to do this
function hdrToSdr(r, g, b, intensity) {
// Normalize RGB values to 0-1 range
r = r / 255;
g = g / 255;
b = b / 255;
// Apply intensity
r *= intensity;
g *= intensity;
b *= intensity;
// Apply a simple tone mapping (Reinhard operator)
r = r / (1 + r);
g = g / (1 + g);
b = b / (1 + b);
// Convert back to 0-255 range
r = Math.round(r * 255);
g = Math.round(g * 255);
b = Math.round(b * 255);
return [r, g, b];
}
// Example usage
const hdrColor = [191, 79, 6];
const intensity = 2.353308;
const sdrColor = hdrToSdr(...hdrColor, intensity);
console.log(sdrColor);```
never use AI to code
please 🙏
you need to make mistakes to learn
here's some more AI insight
Note that this is a basic implementation and may not give you exactly the output you're looking for (RGB(255, 255, 93)). The exact conversion depends on various factors, including the color space, the tone mapping operator used, and any additional color grading applied.
For more accurate results, you might need to consider:
The color space of your input (e.g., linear RGB, sRGB, etc.).
The target color space for your output.
A more sophisticated tone mapping operator.
Color grading operations to achieve the desired look.
If you need a more precise conversion, you might want to look into color management libraries or implement a more complex tone mapping algorithm. However, these often involve external dependencies or more complex mathematics.
what are you trying to do @proven lantern
help Ophidian
well dont use AI because its 99% wrong
most the time

yall dont use ai and call yourselves developers right?
I think you have a misconception
Nothing wrong with using AI to get a direction to go in
i get that, just dont rely on AI to do all your coding or you will never learn
Same
At this point it is impossible not to use AI
i dont
Its literally built into every browser now
#general you got question to answer
lets be friends fr 🔥
I use AI to explain vauge errors
Its better for it to pull sources that I can fact check myself then to scour for them
I hardly ever ask AI for code, it will get it wrong 70% of the time
If it works it works 
Yea, well your bot works, does not mean its good
yes
that will evaluate ofc
djs everything has the client attached to it
guild object, channel object, user object, role object
if it doesn't, it surely will have something that does
true
There's a big difference between using AI to suggest or auto complete stuff (in the sense of completing things like next number in a sequence or last used variables based on context)
Compared to writing the entire code or generating images for you.
Pretty much a lot of big developer tools/services, even Discord, has used some level AI techniques before the whole "AI is supreme" era came in.
Even stuff like message reply features which some social apps, keyboards and android os have had for a long time to suggest what to reply back with "hi" "ok" based on context
Meanwhile apple is flaunting message reply features in iphones like it's some kind of crazy new technology 
here's a better version
// Adjustable parameters
let exposure = 1.0;
let contrast = 1.0;
let saturation = 1.0;
let highlightCompression = 1.0;
let shadowLifting = 0.0;
function linearToSRGB(x) {
if (x <= 0.0031308) return x * 12.92;
return 1.055 * Math.pow(x, 1/2.4) - 0.055;
}
function sRGBToLinear(x) {
if (x <= 0.04045) return x / 12.92;
return Math.pow((x + 0.055) / 1.055, 2.4);
}
function hdrToSdr(r, g, b, intensity) {
// Convert to linear space
r = sRGBToLinear(r / 255);
g = sRGBToLinear(g / 255);
b = sRGBToLinear(b / 255);
// Apply intensity and exposure
r *= intensity * exposure;
g *= intensity * exposure;
b *= intensity * exposure;
// Apply contrast
r = Math.pow(r, contrast);
g = Math.pow(g, contrast);
b = Math.pow(b, contrast);
// Apply ACES-inspired tone mapping
const tonemap = (x) => {
const a = 2.51;
const b = 0.03;
const c = 2.43;
const d = 0.59;
const e = 0.14;
return (x * (a * x + b)) / (x * (c * x + d) + e);
};
r = tonemap(r * highlightCompression) + shadowLifting;
g = tonemap(g * highlightCompression) + shadowLifting;
b = tonemap(b * highlightCompression) + shadowLifting;
// Apply saturation
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
r = luminance + saturation * (r - luminance);
g = luminance + saturation * (g - luminance);
b = luminance + saturation * (b - luminance);
// Clamp values
r = Math.max(0, Math.min(1, r));
g = Math.max(0, Math.min(1, g));
b = Math.max(0, Math.min(1, b));
// Convert back to sRGB space
r = linearToSRGB(r);
g = linearToSRGB(g);
b = linearToSRGB(b);
// Convert to 0-255 range
r = Math.round(r * 255);
g = Math.round(g * 255);
b = Math.round(b * 255);
return [r, g, b];
}
this is a vps right?
like tf is a kvm
this shit is so fucking cheap for a vps
def changing my vps
what are u making
what
PapiOphidian asked how to conver hdr to sdr
ye
i've been happy with it
12gb for < $5
tho just dont trust that "turbo" clock speed
it's running at base speed
the host system has a bunch of VMs running on it right?
ofc
so you dont get all that processing power
all other vps providers are like that too
unless you buy the "dedicated vps"
which is a lot expensive
sheeeesh
that will cost you 30 vBucks
kernal-based virtual machine
Which one are you using
I just bought this for 5$
Seems like a good deal to me, and i can always upgrade to the 8gb versions soon
I am using galaxygate now, 4gb ram, 1.4ghz cpu, no ddos and 30gb storage. Overprices as FUCK
Will directly cancel them
This one probably (or the second version with 15TB traffic)
https://datalix.eu/2024-sale
-# pls don't ban
Owh damn
Owh damn i bought this one but i can ofc still switch
Whatchu think
I personally use the one with 12GB of ram for my bot
I see, i do find my vps maximized a lot at 4gb ram so i might buy the 12 one
5dollar????
tell me how is it going? great?
Datalix is good.
are you using it too?
This looks like a gold for me. So cheap and pretty powerful for this price
nah it's probably better than some 'Discord Bot Hosting' sites
Well yes but noone can compete with hetzner dedicated servers
50€ for i9-9900k 2x1tb 128gb ram
Thanks, I'll add it to bookmarks
This one lmao
But i upgraded the ram to 16gb
For 7$
Honestly datalix so far has been great. Their dashboard etc is also 10x better than galaxygate
guys, how long does it took to get your discord bot verified here?
@late crest
When will my bot be reviewed?
Currently our average bot reviewal time is a few days or more.
Because of this — and because some bots take longer to review than others due to their features — we can't guarantee your bot will be reviewed as quickly as someone else's in the past and we also can't guarantee your bot will be reviewed within that timeframe. There is no exact time for how long bot approval can take. There is no way to check your bot's position in our reviewal queue, but remember you're not first and you're not last!
You may edit your bot's page as much as you like both before and after it's reviewed and this will have no impact on its place in queue.
You can read more about our bot reviewal process in this support article: How the Bot Reviewal Process Works.
In the meantime, please make sure your bot follows all of our Bot Guidelines for a quick and smooth approval!
nah, I was just asking how long it took for others
ddr3 in 2024 is diabolical
I got a server PC with 8GB of DDR2 running Windows 11
Server PC as in 2 CPUs
Dont ask why I put Windows 11 on it
e
💀 why?
isn't like DDR2 too slow for Win11? Also what CPUs does it have?
trimmed debloated win 11 maybe
I hope so. Debloated win11 is good
win11 LTSC ftw
Is there a limit for slash command option choices?
I think the limit is 25
So if I get scammed can I blame you? 
if you get scammed by datalix, its a reseller not datalix itself
datalix allows reselling and even promotes it
welcome back lol
sup tim
brb gonna make my own vps business with datalix machines
building a vps business isnt a bad idea tbh, but you will be paying from your own pocket for quite a while until you have enough clients
i dont have that much pocket money rn
otherwise i would totally give it a try
"my fucking VPS"
per-user disk encryption so datalix cant see any thing my users put in it
well
they are still datalix's servers
I dont think they'd like having encrypted drives
💀
well if i rent a dedi, do they have a say in it?
I mean
you are renting it
you dont own it
If you stop paying for it
it goes back to them
how do i upgrade
I think it is still in insider preview program
and you will need Win 10 LTSC to upgrade
i would be interested in changing my windows 11 pro installation to the ltsc version
because im sick of microsoft adding more bloatware and annoyances each update
and more things that are opt out by default instead of opt in
but if you cant i might just reinstall it from scratch
idk if you can, clean install is usually the way
doubt windows would let you "upgrade" into something that removes a ton of shit
yup the best way
ltsc still has many unneeded services and telemetry, but it it much better than stock
Hell yea 
good job on whatever that is
A self-hostable dashboard for server/website/project/logging management and other dev related tools like image manipulation/convert, markdown editor, network tools like dns 🙂
Fancy seeing you here Builder. The dash looks nice.
Thanks and yea gonna use this to replace sentry and portainer when it's fully functional 🙂
Does anyone know why is it empty and why this exists?
a few of those pages have been like that for a while now
Vote credits got removed too a long time ago
They are planning on doing a lot of that when they release the new site stuff afaik
🙃 Ever single time you navigate it just forgets everything and loads it all again, such a waste
Why are the navigation links also missing on loading...

looks sad
Lol no wonder why that's broken as hell, the CDN service they use for those flags is just gone with ssl errors and http redirects to some sketchy website
It's been like this for months now
Credits for votes were removed about half a year ago and I still see people who weren't aware of it
#auctions-support message 
Is there any way to show server count like it is on other bots? Or it will show after some time auto?>
does it work?
so its not drawing the second avatar?
I was reading that oop
that's my bbygirl u cant seethat
💀
ima put it back lol
rip people who can use snipe / have modded clients
User 1: Maki https://cdn.discordapp.com/avatars/563434444321587202/3bedfc513ab9272409513297aa9265ea.png
User 2: bigtex3328 https://cdn.discordapp.com/avatars/197538444631605259/4d6dbf87e8fe581ab7ef300d6fd466c9.png
Loading avatars...
Avatars loaded successfully.
Canvas created. Drawing background...
Drawing first avatar...
First avatar drawn.
Resetting clipping region...
Drawing second avatar...
Second avatar drawn.
Canvas converted to buffer.
Embed created. Sending reply...
Reply sent successfully.
It might honestly be drawing it out of bounds
what happens if you copy & paste that image in the embed
Discord limits the size of images in embeds and iirc has been known to "clip" images cutting stuff off
nvm i fixed it
i changed the pixels to 350x175
and since i made it smaller i had to reposition it a little bit
i need to make the font a little smaller though

Why
Can you detail your end result please
at this point in time, I am confused on what you want to accomplish
ok
so you need stuff from both the header & body correct?
So
you 100% can
Had to find a source, but you can do smth like this
https://github.com/arlyon/async-stripe/blob/master/examples/webhook-rocket.rs
It details how you can get something from the header as well as something from the body of a request
Assuming you are still using rocket
No problemo
I like axum tho
because its not as annoying

It has extractors built in that you can use that does all the impl stuff for you
Types and traits for extracting data from requests.
In case you ever look at using axum
you'd literally just do
fn some_handler(headers: HeaderMap, Json(payload): Json<SomeStruct>)```
axum is nice
it has a concept you are familiar with I assume
middlewares
Its similar to express middlewares in a way
I swapped from using rocket to axum
and plan on rewriting my backend to my old project into it when I get off my ass and do it
💀
either that or I will use asp.net core

Going to flip a coin to decide tbh
Is there a character limit for modal text input labels?
I think the limit is 45 characters (at least that's what I understand from the documentation)
yes
Thank you 😊
45 characters
God damnit NyNu
😭
Discord didn't register your messages until after I tabbed back in and hit enter
Does not need to be verified
can i take it off?
make the bot private
What
i saw you joined my server and left lol
LOL
you should try it with your server!
Unable to create a 'DbContext' of type 'RuntimeType'. The exception 'Method 'GetDatabaseLock' in type 'Npgsql.EntityFrameworkCore.PostgreSQL.Migrations.Internal.NpgsqlHistoryRepository' from assembly 'Npgsql.EntityFrameworkCore.PostgreSQL, Version=9.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' does not have an implementation.' was thrown while attempting to create an instance.
What in the flying fuck does this mean
datalix for bot 1v core enough? On free hosting I have 50% cpu limit
Im thinking about getting ryzen one, since it is faster in single/multi-thread than xeon. And I dont need too much ram for my bot.
1 vcore is not enough for a lot of applications especially at server cpu frequencies
If your app is small then yes
depends on what you are running
also depends on how powerful that one core is 
datalix has some pretty beefy cpus tho
ryzen core is pretty powerful even on single thread
at least in terms of their ryzen
Right now it is very small, around 43 servers in. And usage is pretty low, but I am planning to advertise it.
Will it be enough to run a discord bot? Sure, probably not the most efficient though
It also depends on what your bot is doing as well
I just want to get rid of "Application is not responding" on first try, and then work on second try. On free hosting there is 1 core limited to 50%, 512mb ram, 1gb storage
umm the thoughest function is combining pictures. Avatar and Other picture which takes time and resources.
oracle free tier is love
unless they delete it out from the existance because yes
I tried to register, but it does not accept any of my credit cards to verify 🙂
same as AWS
worked for me and got a x86 2 vcpu 1gb ram vm
i couldve gotten that juicy 4vcpu 24gb ram arm server though but
getting that is hard
its out of capacity all the time
so you either break the tos or be lucky
how long are you working with oracle free tier?
its been a few months since i set it up
it now has a purpose aka running analytics server for my site
ah I see
will I be able to upgrade vcpu there in Datalix?
without recreating VM
Idk. I don't use datalix. You can look at how the price to performance is and scale based on your current needs
yes
you can upgrade, but you cant downgrade
oracle free tier has extremely poor fraud detection
i once had my free trial registrations denied consistently and oracle support wouldnt tell me why
i once tried registering on another wifi connection and it worked, flagged my ISP apparently
I heard many stories like that
about oracle
they make you out like some criminal when you try contacting them asking why
"we are not allowed to give any details"
yeah its okay
give you a reasonable amount of free stuff but most of it is the limited first 3 months or whatever
they tend to give you 12 months free on most of their flagship products like S3 but the rest either no or its always free
on a lot of these you can probably run them outside of the free trial anyways since cloud providers can be really cheap if you know what youre doing
on their VMs or VPSs though you have no hope of competitive prices they tend to be extremely costly
free tier / trial sucks
yeah aws lambdas do but to use them for anything meaningful you need to have some "aws router / proxy" instance which is behind the 12 month free trial
they have api gateways and it's like $1 for 300 million requests
pay per use
yeah its api gateways
also they have function urls
those are newer
Function URLs are included in Lambda’s request and duration pricing. For example, let’s imagine that you deploy a single Lambda function with 128 MB of memory and an average invocation time of 50 ms. The function receives five million requests every month, so the cost will be $1.00 for the requests, and $0.53 for the duration. The grand total is $1.53 per month, in the US East (N. Virginia) Region.
5 million request for $1
not bad
300 million for $1 is better
30 Mil for 0$ 
where should i move my domains to now that google domains shut down?
One message removed from a suspended account.
One message removed from a suspended account.
i used to run 2000 servers on google's old free tier, which is like 0.25 vcpus and 512mb ram
oracle terminated my account without explanation and deleted all my files
i was running a minecraft server on their free ampere vms
if you're lucky, xd
You must have done something wrong, they wouldn't have deleted your account for hosting a minecraft server... right? 
i literally had nothing else in there
only a single minecraft server, which i setup according to their own guide as well
lmao
and the server would be inactive 99% of the time
maybe they didnt like that 24gb ram were being used to run nothing 99% of the time
or that i didnt upgrade to any billing plan after 1 month
i also had issues signing up, had to contact their support about it because it wouldnt let me register
Or maybe they thought you were making money from the minecraft server without sharing a penny with them 
oh yeah, making money from a server that had at most 4 people on
xD
15/06/2022 - account created
12/08/2022 -
How can they serve you in the future if they just terminated your account? 
:^)
Hey I'm experiencing slowness in my bot's performance after it runs for a long duration. Like upto 16 hours or more.
I've figured that it's being caused by the usage of Mongodb database, overtime the amount of threads being used increases to upto 120 or even 150 sometimes. But normally it shouldn't go upto 50 I'm assuming.
When I restart the bot, the count goes back down to normal obviously but builds back up over span of time. Currently I just re-start the bot once a day and it's not that big of a deal as restart time is quite acceptable. But I was wondering how can I manage the threads properly and just permanently sort this issue, read some docs not that helpful. I can't switch from mongodb to sql now as there's approx 50k lines of code
If anyone ends up responding, feel free to ping me cus im not looking at channel
what language is your bot written in?
Yeah it’s going to depend on the language, but most langs have a way to profile their performance. I’d highly recommend looking into a profiler, especially if it’s written in a compiled language
But assuming it’s in js I believe there is a js profiler out there somewhere
also depends what he means by threads, actual cpu threads or mongodb connections?
in any case if its increasing like that its a code mistake that needs to be corrected
Also, 50k lines is a MASSIVE number for a discord bot
Going to hope it’s not 50k lines of js 😭
49k of them is a handwritten isEven :^)
Classic
Yours is different
You use actual software patterns and such for your bot
Plus it’s java so boilerplate
(And afaik your bot is also fairly complex in its features)
oh, wait, I'm actually below 50k
hax
whats the estimated cost to develop?
should be around half a million lmao
mine is saying 200k for 10k lines
I used that tool on 188 million lines of python I autogenned and it said something like 6 trillion dollars
its actually a small one
compared to many projects out there
wasnt there someone here with 600mb node_modules folder?
mine is 77mb
Most of mine end up being at least 200mb
Installing one package immediately installs 674 package deps
most of that is devDependencies
idk why dev deps are installed by default
for production you have to specifically run npm i --omit=dev
Most of my projects also never make it to prod lol
xDDD
Deploying is hard man
I’m so scared of deployment that I overthink it before I finish a project
my issue is finishing the product, ie packaging the code, writing docs, desigining user interface/website
what is this app called?
hahaha funny
my bot was over 10k lines of python in one file
🤌
probably the longest if chain ever written
crazy and not funny
ty
jeez
it is pretty hard to maintain tho, cuz it's have 5000 hieroglyphs there with meanings and other things.
Python
sounds hard
not that hard, but time consuming yes
do you use a library for mongodb? or do you use some raw api?
do you have a local offline mongodb or do you use the atlas service?
I forgot which tool was that, I use cloc now
ah right, scc
permission denied, for some reason
yikes, snap
windows or linux?
it's...linux ofc
even with sudo?
it's a hard pass for me to have a windows server
yes, snap has those issues
bruh 😦
only businesses meat riding microsoft or with serious technical debt use windows server
rarely any good reason to use it
aight, got from binaries

Windows is the last OS I see as being lightweight and getting out of your way
how does this estimation thing even work 💀
idk, there's probably an explanation on their git
not to mention gui-based windows is awful
if you use cmd you lack a lot of tools bash has, if you use powershell you cant use && to chain commands (yes, they broke it) and Everything-Is -In-Weird -Kebab-Case

