#🪅-progaming
1 messages · Page 22 of 1
i'm not quite so confident what the GPL has to say regarding brand assets included along with the code
you're best off asking vee
always assume the strictest possible license
unless it was released under cc or w/e the copyright for the logo technically belongs to nanoqoi (fka synqat)
with permission given to vee obviously
at least i think thats who made it
and then proceed to violate it

(joke)
that's not how it works
anyway we don't care much as long as you don't do something malicious with it
"You can do anything" is more like CC license isn't it
if you want to make art or alt icons or whatever, feel free
but don't use the icon to impersonate or for your own projects
im gonna make torjan called vendor and put a cute icon on it which has VC and a cat in it
basically: feel free to do whatever you want as long as it's not malicious
yeah
i didn't know much about licensing logos until now
heres the updated path btw
i forgot to optimize it
oneko nonexistent at small sizes
rip
Has anyone here worked with the spotify API before
im trying to figure out the best option for tracking a listening status without constantly polling the api
if thats possible
you have two options:
- reverse engineer discord's spotify websocket
- poll
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var es_exports = {};
__export(es_exports, {
a: () => a
});
module.exports = __toCommonJS(es_exports);
class a {
}
Does anyone know how to stop esbuild from spitting all this junk
with this js
export class a {}
and esbuild --format=cjs it generates a shit ton of garbage
the solution would be to either not use cjs or to module.exports = { a: a } yourself
figured
why do you care
idk
dont think thats how that works, but as long as you're not doing anything malicious, i dont think anyone will care
i know
does anyone know how stack allocated variables in C like actually work lol
i would like to know too
in elle when you define a variable in a while loop it eventually segfaults because it keeps stack allocating memory to store that variable on every iteration and stack overflows
the solution is to stack allocate once at the top of the function and just reuse that allocation every iteration
but idk if that's something that C does
When compiling a function, the compiler basically makes a struct of all variables in the function, and pushes that struct to the stack when the function is called
Nothing else is pushed until you call another function
for example
fn main() {
i32 a;
while true {
a = 5;
}
}
``` would stack allocate `a` once and then put 5 into that allocation on every iteration
meanwhile
```rs
fn main() {
while true {
i32 a = 5;
}
}
``` would stack allocate `a` every iteration causing a stack overflow
in this case not really because any IR allows you to stack allocate at any time
Both of those would push a slot for a when first calling the function, and write into that slot each iteration
in llvm its alloca, in qbe its just alloc8 or alloc4 or alloc16 depending on your alignment
Some IRs have alloca, yes, which causes great headaches whenever used
yes
thats what i need to do then
the first example has the desired, and expected, output
type :ElleMeta = { l, l, w, l, l, w, w }
export function w $main() {
@start
%i.addr.6 =l alloc8 4
storew 0, %i.addr.6
@loop.7.cond
jnz 1, @loop.7.body, @loop.7.end
@loop.7.step
jmp @loop.7.cond
@loop.7.body
storew 5, %i.addr.6
%i.8 =w loadw %i.addr.6
jmp @loop.7.step
@loop.7.end
ret 0
}
the second stack allocates every time
type :ElleMeta = { l, l, w, l, l, w, w }
export function w $main() {
@start
@loop.5.cond
jnz 1, @loop.5.body, @loop.5.end
@loop.5.step
jmp @loop.5.cond
@loop.5.body
%i.addr.7 =l alloc8 4
storew 5, %i.addr.7
jmp @loop.5.step
@loop.5.end
ret 0
}
so yes the solution seems to be to create a slot
in the case of elle it would be to push a placeholder addr at the top level of functions whenever it encounters an assignment of a variable that doesnt exist yet
then using that slot every time instead of allocating new memory
thank you
ok
i only really discovered this was a thing because i was working with graphics and i was rendering every pixel on the screen so i was doing hundreds of thousands of stack allocations which means a stack overflow very fast lmao
Yeah you don't push to the stack in the middle of a function
You push everything you need at the beginning of it
makes sense
Mandelbrot :3
What resolution/iterations is that?
sorry to ask such a simple question but could someone please explain to me how selection-, insertion- and bubblesort work? I just started learning java and I am struggling a bit.
300x300 @100 iterations iirc
If you ever have time, could you check the frametime of a 1kx1k 1k iterations
Would be fun to compare with other languages
I’ve done a lot of mandelbrots :3
iirc it was 4fps but elle has no optimisations whatsoever
which is similar to in C with optimisations enabled so not really a surprise there
both using raylib and using the same iterative algorithm fyi*
:o that’s pretty good!
what’s the best you’ve seen :nyaboom:
Found this on Spotify API docs, perhaps that's what you want? https://developer.spotify.com/documentation/web-playback-sdk/reference#:~:text=})%3B-,player_state_changed,-Description
that's only for the Web Playback SDK
the web playback sdk acts as a spotify player/client
so the user would need to constantly be on that site and listen "through" it
ah my bad! shoulda not expected it to be that easy though
The Web Playback SDK requires a Spotify Premium subscription
also that
reverse engineering discord websocket connection seems a better option
(I'm not sure but maybe you can pretend ur discord and not require premium for that stuff)

listening along also says it requires spotify premium (as discord says) but apparently it's not(?) (as the crackspotify or w/e it's called exists), perhaps there's a workaround too
unsure how the plugin works
the plugin just makes discord think ur a Spotify premium user
all the api calls it does are independent on premium or not
wtf is the point of limiting this feature behind a meaningless paywall then
so by making discord think ur premium it just avoids discord aborting/blocking stuff since u arent premium
probably what Spotify wants from it
yeah what I thought of too
but then they gave discord a token to access their api which can do everything lol
regardless of premium
good for us I'm not complaining 😂
also speaking of the original question, not sure how that might help but when I was trying to mess with the spotify api stuff discord does, I've noticed every time you change the song it uh sends this content-inventory/users/@me/spotify request. Iirc content-inventory is these activity cards(?)
yeah that's just tracking for their new activity stuff
so they have data to show
it does similar to every game you play
yeah like perhaps you can track how it gets the data from the request call stack
Advent of Code, just a week away!
unfortunately, no
@dawn ledge hiii
My hand rolled assembly did it in under 100ms but to be fair that didn’t have proper graphics so it doesn’t really count
Also it’s hard to compare since just framing changes execution time a lot
yeah different parts of the fractal will be different
4fps will be approx 250ms per frame
Everything in the ”black” zone will always take max iterations
yep
there is definitely ways to take shortcuts
my impl is definitely the most raw way possible
(.rs so it displays a preview)
technically this would use Vector2::dot for checking this
but thats the only vector operation that really is used here so i didnt bother with it
@valid jetty you might know this
why is my compiled shared library depending on 500 billion libraries
guh wait
i need to rebuild to show
is there some way to see whtas adding what
and its linking to x11 for some reason
wtf
218 lines of ldd 
yop
@valid jetty you should use comic sans
haiii
@dawn ledge hiii
comic sans is a banger font
comic code is a font based on comic sans but monospace and it’s actually really nice
make venbot module that auto bans anyone who mentions comic code
comic code
I use comic shanns NF and can confirm it’s quite good
Not as pretty as comic code
But free
what language would yall use to make a package manager
Zig
this isn’t a language
on another note Id use Swift
rust, go, crystal, v
or C++
hmm okay
the vee programming language
you will die
rust or go
@deep mulch's Message: you will die
7.01% Identity attack
7.07% Reasoning (beta)
29.21% Profanity
34.95% Severe toxicity
49.08% Inflammatory
57.63% Affinity (beta)
66.16% Threat
71.89% Toxicity ```
Powered by <https://www.perspectiveapi.com/>
yeah
and heres after i took feedback
yop
oneko unfortunately should be dropped
aw man
i dont wanna drop oneko
hes just not gonna be legible
does anyone know if vencord plugin can add proxy (socks5) functionality?
honestly, just use something like proxychains (desktop) or your browser proxy settings
maybe i want proxy only on discord
for example, discord has now been blocked in Russia
my friends can log in via vesktop, but they also won’t let me into voice channels
launch discord with this flag
your proxy server
just use DPI bypass
please never let me cook on web design i will burn the place down
Any plugin that shows media in channel like on mobile?
like a media gallery
if i find any im gonna create myself one
but i want to know if already exists
there isnt
yall how do you even explain to someone that you should follow the regulations of mac os icons
they're guidelines and you don't have to follow them
I need advice
libmpv has a trillion optional features that are automatically enabled based on whether they're available in the system
should I disable them all and manually specify
I'm worried about having to cross compile like 500 additional libraries
all inshallah
where do i find docs about functions in vencord plugin dev
i mean, vencord plugins descriptions e.g
just read the code of existing plugins
or ask in #🧩-plugin-development
too much complex for beginners
i just wanna open a modal/dialog, then do a request at /channels/{channelId}/messages but i dunno how to get user's token, maybe in localStorage?
don’t manually do fetch
use RestAPI in @webpack/common
endpoints are in Constants
look at some plugins using them
that's what i said, a page showing "this function does this", "this function runs when client receives a websocket event" and so on
i dunno nothing about webpack
you will most likely need some basic understanding of reverse engineering minified javascript.
you would have better chances in #🧩-plugin-development when asking questions
what is your goal
you can probably do this without sending an API request
plugin dev isnt for you if you arent willing the read the source
should i remove the cat and fill the logo in or
keep it like that
this is such cursed switch case syntax lmfao
Wtf is defer break;
its to make sure you dont forget to break at the end and get yourself into an infinite loop
ideally in a real switch case you wouldnt be able to do that at all
this while loop is just a way to create this structure```ts
if true {} else {}
cond:
jnz 1 @body @else
body:
// do stuff
jmp @end
else:
// do stuff
jmp @end
end:
// out of if statement
```ts
while true {}
cond:
jnz 1 @body @end
body:
// do stuff
jmp @cond
end:
// out of while loop
breaking early always makes it work essentially like a switch case
wat
so its an infinite loop.... that only runs once?
why not just add a code block syntax i.e. rust
oh
Or just, else
this is supposed to be a substitute for else-if because that doesn’t exist yet
you have only else
it’s supposed to be for else-if/switch case because the syntax doesn’t exist yet
it is it just requires continuous parsing
it is not as simple as it may seem
i’ll do it soon i just haven’t gotten to it yet because usually you don’t need to
else-if by design is not very clean code
if you ever need to write an else-if you can write cleaner code by making it an array or something like that
usually if you need to check a condition you just need to check if it is true and do something else if it isn’t
i’ve written around 2k lines of pure elle code and i have not ever needed to use else-if except that one example above
that example above would be rewritten like
if a is infant …
else if a is student or a is senior …
else …
But for switch cases wouldn’t it be better to have a fallthrough keyword instead of break?
99.9% of the time switch cases are used as a long else-if chain
You rarely need to fall through
thats because this syntax isnt for switch cases its while loop syntax
ideally elle wouldnt have switch cases it would have pattern matching
const thing = "i will END vencord once and for all, be prepared because this event will be truly cataclysmic... :3";
function shuffle<T>(array: Array<T>): Array<T> {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
function misspell(payload: string) {
return payload
.split(" ")
.map(word => {
let shift = 0; while ([',', '.'].includes(word[word.length - (1 + shift)])) shift++;
if (word.length - shift <= 2) return word;
const middle = word.slice(1, -(1 + shift)).split("");
const shuffledMiddle = shuffle(middle).join("");
const end = word.slice(-shift - 1)
return `${word[0]}${shuffledMiddle}${end}`;
})
.join(" ");
}
console.log(misspell(thing)); // "i wlil END vecnrod ocne and for all, be paprreed baesuce tihs eenvt will be tlruy cmlaiatsycc... :3"
``` spell checkers will love this
misspell the cat word now
just found a vuln in my states DPS system
they just added the ability for people to be able to upgrade their license online
and now im able to give myself any type of license without review
also a way to bypass DD # verification and mark myself as a veteran on my license
💀
LMAOOOO
it’s actually insane
literally just modifying responses using burp
then it updates the database with the response
might actually be able to change my name too
it’s bad
I wouldn't abuse it or you might get in trouble
see if you can somehow get a bug bounty (probably not
)
i was considering it (it’s the government i don’t expect anything but a thank you)
i’m reverting any changes i make while testing, pretty much any info can be changed
i was even able to change the replacement card cost because for some reason it’s different for everyone so it’s stored along with the users other data
for my buddy he’d have to pay 1$ for a replacement but for me it was 10$ by default
just made me curious what they base it on
make it $0.01 and buy 100 replacements
real
Hi, I'm currently trying to build my own plugin, and I was wondering how patches are being created.
I understand the idea to search for a certain string/RegExp that is inside only one file, then replace it also using string/RegExp. But how can I actually know what files and lines do what I need to modify?
good or bad
if a syntax error occurs tokens are commented out until there is no longer a syntax error
this feels like a weird api for js i think (https://www.npmjs.com/package/peek-readable)
like why doesnt .read return a new uint8array instead of making you allocate one first and then doing the .read which writes to it
“doing .read which writes to it”
i love javascript
it's funny but it's pretty much the same way in every language
except you explicitly indicate a mutable reference
because that's incredibly inefficient
it's very normal to make you pass your own buffer
majority of languages do the same
Here is your swift(5.3.3) output @formal belfry
😖
/run
def 🥺()
print("😖")
end
🥺
Here is your cr(0.36.1) output @royal nymph
😖```

crystal
/run
def 🥺()
print("😖")
🥺()
@mellow phoenix I only received py(3.10.0) error output
File "/piston/jobs/fe0165ce-5bad-43fb-9f5b-25dd4dc41115/file0.code", line 1
def 🥺()
^
SyntaxError: invalid character '🥺' (U+1F97A)
python L
/run
++++++++++++++++++
>[+++++++<->]
>[+++++++++++++<->]
>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<->]
>.
Here is your brainfuck(2.7.3) output @viscid grove
:(
I don't think brainfuck works very well with emojiss
wait i did the wrong emoji
i was trying to print out out 🥺
/run
function 🥺() {
console.log("😖");
}
🥺()
@viscid grove I only received javascript(18.15.0) error output
/piston/jobs/91ea77eb-f228-4792-a238-ee2e17bf57ec/file0.code:1
function 🥺() {
^
SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1176:20)
at Module._compile (node:internal/modules/cjs/loader:1218:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.15.0
what are you reverse engineering
wdym
Did you read the message just above, that that was a response to?
I'm confused why you're reverse engineering if the asar is public
inside the app....
k
@echo elm
check those,
https://github.com/Vendicated/Vencord/blob/main/CONTRIBUTING.md
https://docs.vencord.dev/installing/
if you have any questions, ask.
@echo elm
Unsupported language: None
Request a new language
/run ```python
print("ss")
@echo elm
Unsupported language: None
Request a new language
/run python
print("sss")
Here is your python(3.10.0) output @echo elm
sss
/run
++++++>[+++<->]>...
Here is your brainfuck(2.7.3) output @viscid grove
Here is your brainfuck(2.7.3) output @viscid grove
Here is your brainfuck(2.7.3) output @viscid grove
sss```
wow yeah i was so skill issued
/run
--<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+.
@valid jetty I only received bf(2.7.3) error output
error: tape memory out of bounds (underrun)
undershot the tape size of 30000 cells
oh i skill issued so hard on this
even if it had enough bits and was using the right character table, it would print the 0th character...
@nimble bone
/run
+++++++++++++++
[>+++++++++++<-]>
[>+++++++++++++++++++<-]>
[>+++++++++++++++++++++++++++++++++++++++++<-]>
-.
Here is your brainfuck(2.7.3) output @viscid grove
```
so good
m(?)b(yte)str(ing)tow(ide)c(har)s(tring)
What's the difference between a multibyte string and a wide char string? Utf8 vs utf16?
presumably
why node
whats the difference between spawning a process and forking it
dont both have the process that spawns/forks as their parent process
forks inherits the state of the process being forked
Isn't the userspace spawn function a combination of fork + exec
I'm pretty sure yes
i see
exec basically overwrites the inherited state from the fork
Fork spawns a new process, by cloning all state of the current process (or only current thread maybe? Not sure tbh)
Exec replaces the current process by a new one
This kinda weird setup the parent process to customize things like changing the stdio fds, current directory, and various other parameters before actually starting the child process
How would one define a custom react component type?
A react component is simply a function that takes a props object and returns a react node
right, so what if i want to have component that is like div?
it might sound stupid
i dont want to use any dom elements though
All react components boil down to dom elements in the end
i guess doing smth like:
function Test({x}: {x: number}) {
return React.createElement('Test', { x: x })
}
would be good enough
... i know how to use react, my point is that im making a library which i want to use jsx, but dont know how to create the elements correctly, as they dont use dom in any way
What do your elements render to if not dom
winui3
why the hell are you using jsx
trynna use bun ffi to port winui3 to js lol
because xaml sucks ass
then use electron
Build native Windows & macOS apps with Javascript and React
this is essentially what you want
use C++ and Qt 
i want fancy windows 11 component design
this
React Native for Windows + macOS brings React Native support for the Windows SDK as well as the macOS 10.14 SDK. With this, you can use JavaScript to build native Windows apps for all devices supported by Windows 10 and higher including PCs, tablets, 2-in-1s, Xbox, Mixed reality devices, etc., as well as the macOS desktop and laptop ecosystems.
yes but that doesnt give me the fancy components winui3 provides
i want the native components ported:
you want to write a custom jsx runtime
use a build tool like typescript, esbuild, webpack, etc that allows you to define JsxFactory and JsxFragment
then you need to define those two, e.g.
function MyJsx(element, props, ...children) {
// do something
}
you can use this shitpost i made as example https://github.com/Vendicated/Jsxml
you are not supposed to use react then
what you want is to write your own jsx compiler/transpiler
that will compile down to the appropriate winui calls
wdym vee, you do need a custom jsx compiler to convert <Foo /> -> whateverWinUIFactory.createWidget("Foo", ...)
literally all js transpilers allow you to bring your own jsxFactory and jsxFragment
you just need to define those two
and done
well i thought it would be as easy as traversing the tree with a loop and adding children with corresponding native calls xD
and that is what i meant buddy
okay compiler was a bad choice of word
it is
look at this example
JsxML.js: Line 13
export function jsxML(tag, attrs, ...children) {
run.mjs: Lines 5-9
await esbuild.build({
outfile: "dist/index.js",
entryPoints: ["index.jsx"],
inject: ["runtime/JsxML.js"],
jsxFactory: "jsxML",
esbuild my beloved
this is with esbuild but all js buildtools allow you to define your own jsxFactory
given i use bun, i can do this without esbuild lol
okay which other ffis can i use? i dont know any other ones
this is something i'd do ngl
i vibe with this
i mean, napi
i used bun pre 1.0 and gave up
it might be better now
back then the docs were there but the implementations werent
with this setup, it will compile
function Test() {}
function Child() {}
<Test foo="bar" baz>
<Child />
</Test>
to
function Test() {}
jsxML(Test, { foo: "bar", baz: true }, jsxML(Child));
and somethings were contradictory
so now it's just your responsibility to implement the jsxML function (and obviously rename it to something better) to do what you want
go ahead and write an esbuild plugin that modifies the ast directly and eliminates any calls your jsx factory
i see, thanks for the directions guys, greatly appreciated :)
write jsx only for it to be built down to json
@royal nymph https://www.php.net/manual/en/class.gender.php
chat my gender is ANY_COUNTRY
there's deno, and coffi in node (but funky to work with)
Using bun ffi was pretty smooth so far
where is regulars
sorry i ate it
nom
nom
nom
right guys, im skill issuing once again, it might be typescript tweaking. found some guide onto how to make custom jsx runtime(with help of what vee yesterday linked) & define custom default elements. i have declared JSX namespace:
declare namespace JSX {
export interface IntrinsicElements {
div: { customProp: string; anotherProp?: boolean };
span: { anotherCustomProp: number };
myCustomElement: { propA: string; propB?: number };
}
}
however, when i try to use it i get:
tsconfig option: "jsxImportSource": "./src/jsx"
any idea where could be problem?
nvm i fixed it lol
Who can help me to achieve something like this?
looks like something you'd do with css so i think #🎨-theme-development more appropiate
css gaming
and here i thought id ask stuff around in #🧩-plugin-development but no message access
that's not how you make custom components or define their props...
Even in Custom jsx runtime? This is what some guide + gipity told me
gipity doesnt know shit lol
hmmm
I mean its a better google search
it just sounds convincing
that seems VERY weird
it really isnt
Sometimes it helps
But like 1/2 times its pretty clueless
as long as you are skeptical enough
Ill tell you what some random cs professor told me: chatgpt is good enough to help you with anything, if its giving you bad results, its either because you have wrongly asked or dont have pro plan
Im not even kidding
thats super cringe
Yes
I was arguing with him for like half an hour
He also told me that if students use gipity for writing their thesis, he will use it to grade the thesis too
Atleast i knew that thats not uni i want to go to
using llms just stagnates your growth imo
i've used chatgpt for a grand total of like 5 times to do something (it didnt work)
I mean it was able to help me with parsing out ia32 instructions
So i didnt really had to look into the giant manual
it's good for well documented boilerplate
and like nothing else lmao
I tried using it a few times
didn't work I just wasted my time
oh they left. lol
hear me out:
any editor where you can write text
and run shell commands
is a good IDE
you don’t need fancy intellisense just read the compiler errors
you could literally write code in nano and it would be a good editor
an editor that does the job and a good editor are totally different things
you can turn an editor that does the job into a good editor btw
stock vim and vim with plugins are pretty much different things
idk about stock vim
but i've used stock nvim
and its great
what you need in (n)vim is the motions
and stock has it
:Ntree + motions
peak experience
Seeing what lines have changed is very useful
But I always do the actual committing with the cli
it's subjective as to what you find useful
there are people who are very much content with the bare minimum
literally me
i work by literally just editing text and then sudo make
no fancy features
i even use git CLI
part because im too lazy to install them manually since nix shits itself if i install them from mason since nix isnt fsh compatible
we are not the same
no we are
can't understand those who don't
Nix is one of those ideas that sound really nice until you try to use it in the real world
I just ./Main.hs; nix-shell and stack handle the rest
yeah lmfao
I, too, love running arbitrary scripts as root
do you use ghci
no because i know what the script does
no
its ran as sudo because it puts an executable in /usr/bin/local
make && sudo make install would be more sensible
the
the third shebang jit-compiles and executes it
idk i use nvim
(was asking rosie)
i too do use nvim tho
peak editor
i recently started using nvim for notes too
motions are peak
nvim + typst is awesome
very nice
very minimal
very terminal-like
it has vim motions too so i use that
and blazingly fast 🔥
(rust-based)
idk i use it on macos
yeah i used it on linux
and before the started distributing builds
so i had to build myself too 😭
idk you should try it again :3
idk
i prefer this over nvim
because i cant find a very nice looking terminal emulator
mate-terminal is decent, but kinda low-feature
is it blazing fast
It scrolls by pixels rather than lines, which is a surprisingly rare feature
That single thing is a major reason why I use it honestly
i prefer by line
Oh yeah and another problem with my transparency is that it makes it not draw the default background on unstyled pages, which makes them unreadable. Is that fixed?
can it run in a tmux
yes this is actually an important condition on whether I can use it
zed is a gui app
unless it has some other way to share state between 3 devices at once and runs in a browser
rewrite zed in elle
||/joke||
the riir treatment but elle
Half life reference
lambda
lambda
i finally solved some huge struct issues
well
one was just me being bad
raylib has a struct called Color which has r, g, b, a fields
when i first made this struct to test raylib functionality, i made it with i32 because thats the smallest type that existed in elle at the time
however that didnt work properly because it was offsetting each field by 4 (bytes) when it should really have offset it by 1 (byte)
so literally just changing this struct to use u8 works now
because even though in elle the compiler knows how far to offset to get the right color, raylib is a library
the offset into the struct is baked into the file
that offset being +1 not +4
the other struct issue was that i literally made structs wrong
structs inside of structs are contiguous memory so they should directly be offset again without dereferencing unlike any other value
this was causing some issues when working with things like RenderTextures in raylib because that holds a Texture struct inside of it
so by literally just not dereferencing structs inside of structs and directly calculating a new offset from that pointer it works now
and the best part is; i didnt even need to change anything else
the test to ensure accessing structs in structs still works with no changes
because i was already storing nested structs in contiguous memory
i was just doing bad stuff when accessing them
because research is for losers and reverse engineering it is more fun
the worst part is that to solve the nested struct thing i was literally just brute forcing it
relatively cursed code
(yes elle lets you cast a struct into a pointer)
Does (i32*) a cast the struct itself, i.e. 4 bytes in case of Color, into a pointer, or does it implicitly take a pointer to the struct and cast that?
the struct is technically just syntactic sugar for a pointer of contiguous memory of different types
so *(i32 *)struct is like doing struct_start[0] technically
its not a transmute
it takes the pointer of memory allocated and interprets it as an i32*
to make a struct, its made like this
%struct_start = alloc 4
store 255 into %struct_start + 0
store 0 into %struct_start + 1
store 0 into %struct_start + 2
store 255 into %struct_start + 3
where in this case %struct_start is a pointer to the allocated region
to access any fields you just offset that pointer by the size of the fields until the field you want and then dereference it
So *(i32 *)struct is only valid if the first field of the struct is a pointer?
so basically a cast to a pointer just takes that pointer to the start of the struct and thinks it is some arbitrary pointer
no it is only valid if the first field of the struct is an i32
in the case of the RenderTexture and Texture structs, it is
(u32 is still 4 bytes so its fine)
this is really complicated for me to explain but i can use strings as an example
a null terminated string is just an allocation of bytes for the length of the string + 1
%string_start = alloc 10
it then offsets that pointer that is returned and stores something at that new address
when you wanna access that again you shift the string by that offset again and derefence and you have your value
and this is how like, "arrays" in C work
structs work a similar way except its not one single type so you cant just do index * sizeof type to calculate your offset
instead you must add each previous field's type to an offset until you get the field you want
I know how structs work
oh ok
But I think it sounds weird that casting a struct implicitly takes a pointer to it
it does not take a pointer to it
structs themselves are a pointer
its just abstracted away
Oh
that pointer being the thingie i said earlier
the %struct_start
that is the pointer
casting to i32 * just takes that thing and thinks its an i32*
Does anyone know which of the windows processes causes the desktop to render? Is it dwm or explorer? Whats the difference?
dwm
👌
a lambda is a nonrefundable form that can eventually be β-reduced with another value
yo what is this called
copy and paste
Fearmongering
and the first two fields of a user token can be derived from your user id
someone who thinks they're really cool (it's fake)
it just so happens that the first part of your token is your user id encoded with base64
the ip is randomly generated
as is the rest of the token
and the other stuff is trivial information that anyone has access to
who hurt you
beta reduction is so over complicated when explained
as are monads
(the way i see it monads are just abstractions over some value and action)
like the maybe monad which abstracts possible missing values
:3
hello vendor discord server how do i apply code to every message element the moment discord renders it (for a plugin)
kthxbye
:3
this is fake shit
s/nonrefundable/nonreducible/ thanks autocorrect
“”””buy”””” memory and lose it because you don’t own media in this society anymore
pirate_memory() and free()
effectively, to β-reduce (λx.A)B, you just replace every x in A with B
haskell
literally just substitution
idk why people make such a big deal out of it as if its some complicated thing
oh god
every math thing is disguised as a complicated thing
No, nonrefundable is right
semigroups are just associative operators
not what I was typing
Monads are just monoids in the category of endofunctors
Turns out lots of things are monads
yeah
lol
oh yeah i thought this might be cool to post here
i wrote this a while ago
Option<T> but for typescript
with (mostly) the same semantics
theres no .map and stuff but the main concept is there
if anyone wants to see how it works https://gist.github.com/acquitelol/1c61dfb8e5f3a246c3e307526c5b7656
why did you create ugles thing ever
is there anyone who loves rust option
yeah lets use unwrap everywhere excellent choice
i love rust option
true but i wanted an excuse to write this abomination of typescript code
you are deranged
what shenanigans
and why do you bind immediately before apply
Is there any way to get the admin password with a script?
No
not Kotlin
that's just the ecosystem and java
anime girl
nop
nop
I make text replace plug-in that checks good person plugin replace list and inserts a random invisible character

why would you spread entries when its supposed to be an O(1) op...
which?
horror
opinions on interpreted rust?
interpreted
looks nice!!! I mostly use ts-pattern for this
Miri is great
I think i figured out why
I think it was in an iframe
@calm ruin REMOVE KOTLIN FROM GOODPERSON
Never
it deserves to be there
kotlin so bad
i think he got scared and i got mad
me
for one, if youre unwrapping
bad code
and two, you dont unwrap in library code, you propogate
so unwrap is mostly used in binaries
why is it replacing for "anime girl" anyways?
even if you dont unwrap its still bad
if let Some(option) blabla
still very ugly
hater
yes
haters be hating
i love options
typeof null === "object"
typeof undefined === "undefined"
typeof false === "boolean"
typeof 0 === "number"
(theyre all the same value to a compiler)
Certain operations treat them the same, you mean
that is javascript though
🤢
nullable objects are literally just auto-unwrapping options
not true
options are just nullables with wrappers
oh yeah
Not true
Nullability implies pointers
@NotNull Optional<~>?
Option<u32> contains zero pointers
technically
very technically
the Option enum is a compile time construct actually
so yes zero pointers
hm
not true
options are safe nullables
and monads
and an enum
and have the name "option"
hopte this helps!
i leave when someone pulls up functional programming lingo
a monad is a monoid in the category of endofunctors
yes; I was saying that nullable objects were just unsafe options
but being real Options being monads are a real disctinction from nullable things
i understood nothing
what is a monoid
what is an endofunctor
what is anything
i do wanna try fp some time tho
well i mean
you dont really need to know what that stuff is
ive said this like 5 times in the past 2 days but
i get fomo
a monad is just a way to abstract some complex system away from you

option abstracts away the lack of a value, promise/future abstracts away async/await, mutex abstracts away threading and deadlocks, etc etc etc
there has to be a better way to write this
yes
okay so make a function that returns Result<T, U>
and use that there
oh well technically
i guess specifically for this function that might be the best way to do it
but i dont want to believe that
lc.ocr
let SocketAddr::V4(ip, _) = addr else {
};
self.protocol_error(ProtocolError:: Ipv4Expected);
None?
let Some(user) = User: by ip(ip) else {
};
self.protocol_error(ProtocolError:: NoAssociated User);
None?
let Some (packet) = self.recv() else {
};
self.protocol_error(ProtocolError:: ReadFailure);
None?
let C2SPacket :: Open (secret) = packet else {
self.protocol_error(ProtocolError:: SecretExpected);
None?
};
todo! ()
hold on it broke
could you like
use and_or_else
let user = User::by_ip(ip).ok_or_else(|| {
self.protocol_error(ProtocolError::NoAssociatedUser)
})?;
The difference is that in Option<Option<T>> you can distinguish between the two Nones, but in T|null|null you can't
protocol_error moves self (and drops the field)
is that related to the fact that Option is a monad?
Not really
The monadic thing is that you can flatten the difference
no; the only thing about Option that makes it a monad is that you can put ordinary values in Option (Some) and run a function on the value inside with the result flattened (and_then)
i see
you can do similar things with Result (Ok, and_then)
A monad is a functor (map) that also has monadic operators (join/flatten and pure)
yeah
they should add haskell syntax for it
<*> and <* stuff
i forgot which one is for fmap
rust monads would be nice
<$>
Those are for applicatives, not monads
oh yeah right
arent applicatives a class of functor??
Applicatives allow lowering tuples, (f a, f b) into f (a, b)
yep
isn't that just \a b -> (,) <$> a <*> b?
(<*>) = fmap (uncurry ($)) . lower
Though haskell defines applicatives in terms of <*> for some reason
Wait no I'm getting the curries wrong let's just write it out a <*> b = fmap (\(a, b) -> a b)) (lower (a, b))
i love haskell
just 11
just monika
made this pointfree for fun (fmap (,) .) . (flip (<*>))
(by hand; the translator produces unreadable code)
As opposed to
(fmap (,) .) . (flip (<*>)) is somewhat readable
it can be made pointful by hand
also is there a way to hint to rustc that a match branch is very, very unlikely to be called?
specifically, the case that a map didn't have a certain key, but did after upgrading to a write lock
nvm
certified shitcode
I think there's a #[cold] attribute, but I think it can only be used on functions
cold is #[inline] #[cold] fn cold() {}
it'd be cool if this were acceptable tho
i'm also adding errors
not hardcoded
$Id: ... $ is a RCS tag that is updated automatically on checkout
which is why I immediately slice it
(yes, RCS is single-file. this file is 351 lines)
yeag
(and this isn't originally my repo)
Just include_str!() it
not how that works
That sort of stuff has no place in source code
RCS does a textual replacement when the file is checked out
(and removes the contents when checked in)
i don't have anything to include_str
If you can insert that string into source code, you can insert it somewhere else
nop
only one file to work with
otherwise I would've split it a long time ago
you'd extract the branch content into a function and add #[cold] I think?
I remember reading about this
turns out adding LIKELY and UNLIKELY for cpp/c can actually incorrectly produce optimizations and have a detrimental effect
@nimble bone ```cpp
int main() {
for (int i = 10; i --> 0;)
printf("%d\n", 2 * i+-+-+-+-1);
return 0;
}
when is this beauty of a code gonna be added to nin0chat
delete
The code prints the even numbers from 20 down to 2, but it does so in a confusing and non-standard way. The i --> 0 is equivalent to i-- and the +-+-+-+-1 is just -1.
tldr
But there are four -s, so isn't it +1
why
@valid jetty
Yes, that's 2n+1 for n = (0..10).rev()
guh
Fine
is there any way i can clean this up more
i basically just tried to clean up the quake 3 fast 1/sqrt(x)
Why are you interpreting the f32 as a i64
I don't like the missing return type on the first function
thats.. kinda how the fast inverse square root works
you interpret a float as an integer
No, it uses i32
inferred return type should only be reserved for short expression functions
it uses long
which has the minimum size of i32 but can be wider
tbf i think i could have used i32 yeah
yeah that still works
You're reading 4 bytes of garbage
when you put it like that
that makes sense
however it doesnt really matter because those bytes will never be used for anything
any operations done are done within that i32 bitspace
The bitshift might shift in one bit of garbage into the mix
maybies
i love ```
git reset --soft HEAD~
change the code
git commit -m "aaaa"
git push --force
on small scale projects like this where commits dont happen often its great
git commit --amend
that works too
nope
inferred return type is literally just stolen from the type of the return statements
the compiler will warn you when you use it with another type
no one's gonna wanna read through a 200 line function to see what it returns, if at all
js does it too
just make it required to specify return type for functions
true maybe
but i think its fine because youll get errors if it isnt what youre expecting it to be
and you can explicitly define it if you like
idk I personally hate it
fyi doing this also declares what kind of type constant literals are
or well
returned constant literals*
do
if you set the return type to f32 and you return 5, it will interpret that 5 as 5.0
do what its already done
require specifiying return type
i think i would rather leave it to the implementation developer
if they feel the function is big enough to warrant an explicit return type then theyll do it themselves
but making it explicit feels a bit boilerplateish when the functions are very small (which they very often are)
guh
there's stacked git which is nice for that
you have a stack of patches on top of the latest commit for e.g. features
and in that stack you can reorder, edit, or commit at will
use ide/similar with intellisense that tells u
similar cause vscode isnt an ide i think but it has that
i think for js it work
Elle ide when @valid jetty
pj
i was so confused
this is programming channel
i thought it was regulars but i tabbed to offtopic then to regulars and thought the whole convo just banished
insane
LMAOO IVE DONE THAT BEFORE
something like it as far as i'm aware
"help I fell in love with Microsoft's answer to Java as a Java dev"
doesnt feel that bad when you realize that the shit thing about c# is visual studio
garbage collected
string operations clone instead of viewing
inheritance
no variadic methods
pascal case
it does?
i couldn't find any documentation on variadics of more than 1 type
yeah that's variadics of 1 type
wait how does c# do writeline
no lol it was satire
Console.WriteLine(object)
i literally put inheritance as one of the downsides
it's usually (fmt, arg1, arg2) tho
or with string interpolation i guess
but that's variadic with multiple args
i wonder how
its capped lmao xD
masndjahfjaehfjwehfjwebguwehfuwebfiwefjjewhgwekghwejhfwefihsdfbfuiregfoyiesfgofwyueregfr0uyfgqer
even java has printf
c# gotta use their shitty interpolation
(on the other hand, java doesnt have one - ||well it did(added in 21 as preview), but was removed in 23||)
who tf would interpolate with backslash
string interpolation imo is a gimmick
tbf
\ means you don't need to escape it ever
"\{variable}"
yes
wth is that
it's a very nice way to do it
imagine combining this into regex
that's the one thing i like about swift
but again string interpolation is a gimmick imo
this is still perfectly fine to read
im okay with printf or concat lol
even concat yeah
thats swift?
no lol
rust?
swift has \(thing)
nope it's my own thingie



