#๐ช -progaming
1 messages ยท Page 32 of 1
main webpack bundle is loaded through the main property of package.json in an asar package
bro homerow mods are annoying sometimes, i tried pasting the aoc answer but to do that i have to hold N and press V (since N is ctrl) and i did it too fast and submitted 'nv' as my answer
aoc needs to not put u on cooldown if u submit an answer with a letter in it when its supposed to be ints
what I did is rename the asar bundle and made a small loader to run code before loading the actual asar
kinda like vencord used to do it
still does it that way
can you send the whole file that is in
also why is it not minified lmao
gitkraken insane
is gitkraken foss
it was
I formatted
you also renamed __webpack_module_cache__?
Guys what do you think would be faster:
- parse javadoc data out of the html pages that are generated
- parse source java files and extract the javadoc comments
Faster in terms of actual speed
webpack loader at the end
yeah
bro dropped entire gitkraken code
no
also is it gitkraken desktop
yes
okay wait
I couldn't find anything leaking to global
300mn 
can you open devtools
not by default
how do I enbale
i think I might've done it in this one here
you just need to register a global keybind with electron
and then call browserWindow.openDevTools()
or well you would want to use the toggle function
im not sure what they're doing
but it doesn't matter anyways because main bundle is loaded in main process
renderer loads a different bundle so devtools are useless
i need to patch main bundle
why th do they have 3 app asar ๐ญ
it's so cursed
@calm ruin u would love 2017 aoc
nop not now
bfable
you can still open devtools
The DevTools in an Electron browser window can only debug JavaScript that's executed in that window (i.e. the web pages). To debug JavaScript that's executed in the main process you will need to use an external debugger and launch Electron with the --inspect or --inspect-brk switch.
open chrome://inspect in a chromium browser
o
and launch gitkraken with --inspect
then you can connect to it from the devtools in the browser
if you want to debug before the app starts, you can use --inspect-brk instead which will immediately break
neat
I will try
yeah that worked
I was gonna unpack default_app.asar modify and repack
but this is easier
I mean that's also very easy
oh
default app is ignored
that's electron default
wth does it even use then
if you want to debug renderer / preload, you can just do this
its file structure so confusing
app.asar
app.asar only had unpacked stuff
there's a 7zip plugin for asar
it makes editing so much easier
no it's packed
That sounds like some arab name
I mean it had the stuff thats already in app.asar.unpacked
correct
do you still want
Sure
eh
its so easy
.unpacked is literally just for git
lmao no
I don't want plain black bg
pnpm add --global @electron/asar
# unpack
asar e app.asar app
# then edit files in app folder
# pack
asar p app app.asar
And i dont want to fuck with shaders
i guess you want something like this https://bg.ibelick.com
Yeesss!!! Exactly!!!!!
this is incredibly easy to do
Thankssss
you can pollute global prototypes to intercept this assignment
this does exactly what u need
you're welcome
lmk if you need anything
@ornate quiver I managed to get it
tho that amd0 might change
but you can probably do same thing with c
BAD
I WAS TRYING TO MAKE STUPID DEBUGGER WORK
export function waitForDeclaration(obj, prop, callback: (obj,prop)=>{}) {
Object.defineProperty(obj, prop, {
set(v) {
Object.defineProperty(obj, prop, {
value: v,
writable: false,
configurable: false,
...Object.getOwnPropertyDescriptors(v),
});
callback(obj, prop);
},
configurable: true,
});
}
``` @royal nymph what do you think about my hlorious code
onceDefined.ts: Lines 30-47
export function onceDefined<T extends object, P extends LiteralUnion<keyof T, PropertyKey>>(
target: T, property: P, callback: (v: P extends keyof T ? T[P] : any) => void
): void {
const propertyAsAny = property as any;
if (property in target)
return void callback(target[propertyAsAny]);
Object.defineProperty(target, property, {
set(v) {
delete target[propertyAsAny];
target[propertyAsAny] = v;
callback(v);
},
configurable: true,
enumerable: false
});
}
STEALER
trol
disgusting
this is not a real programming language
well it lets you do cursed stuff
Why does it take a callback rather than returning a promise
I at least like its that part
async bad
also cant promise also introduce some delay
this needs to call instantly
while blocking main thread
Hm, that's a fair point
Resolving a promise only schedules the then to be run at the runtime's convenience
yeah thats bad
oh neat
alright i will try
WebpackGrabber.user.js: Lines 15-33
function extractPrivateCache(wreq) {
let cache = null;
const sym = Symbol("wpgrabber.extract");
Object.defineProperty(Object.prototype, sym, {
get() {
cache = this;
return { exports: {} };
},
set() { },
configurable: true,
})
wreq(sym);
delete Object.prototype[sym];
if (cache) delete cache[sym];
return cache;
}
how does this work
Just evil magic, nothing special
Define a magic symbol that does funky things when looked up, then trick webpack into running that lookup function
Thereby getting the object it's looked up on
oh neat
you dont need that
you only need it for when the cache isnt exposed at all
it's usually available on wreq.c as is the case with gitkraken
but very rarely it isn't
oh
it's to get a reference to the cache if it's only a local variable
can i make webpack cache a proxy then or something
to intercept new modules being added
what exactly are u trying to do
same as vencord?
regex patches?
or do you want to monkey patch
nop
i just need to monkeypatch the result of two functions from different modules
find by props
WebpackGrabber has everything
lmao u dont need anything like that even
if u just want to patch 2 functions
i dont see anything that lets me intercept new modules as they are added
why would u need to do that
if u just wanna monkeypatch
waitForModule doesnt exist on webpackgrabber yes
because if i do it too late then it doesnt matter
oh okay
wont work
well
.c has the cache which is the finished exports
.m has the module source
BRO
fuck this bot lmao

anyway you need to patch .m
can you patch its .push method to capture new modules
you do need this then ๐ฅณ
very slight variation tho
its not an array, but an object
then proxy ๐
this is so confusing
how
its all because you confuse rusher with dumb symbol
if you put skibi-i instead of symbol he wouldnt get confused
whenever we require q, it
- obtains
cache[q]to look up the module in the cache - if we found cached exports it just returns that
- if not, it creates a new entry on
cache[q] - then it calls
modules[q]to initialise the module (require call) and puts the return value (the exports) in the cache
that function is meant to extract the private cache variable
so what it does is create a symbol (unique key)
then it declares a getter & setter for our symbol on the object prototype (so every object has this getter and setter)
then it calls require with our symbol
require looks up our symbol in the cache and thus invokes our getter
now our getter function has a reference to the cache
basically this lookup calls getter with "this" as cache
but you don't want the cache (wreq.c), you need the modules (wreq.m - not actually exported in this scenario)
so you need to slightly alter that function to your needs
oh i see
I will soon steal all the vencord utility functions
function extractPrivateModules(wreq) {
let modules = null;
let cache = null;
const sym = Symbol("wpgrabber.extract");
let isSecondPass = false;
Object.defineProperty(Object.prototype, sym, {
get() {
if (!isSecondPass) { // this is cache[sym] get
cache = this;
isSecondPass = true;
return undefined; // return undefined so it skips cache
}
// this is modules[sym] get
modules = this;
return () => {} // modules are functions that it calls to get the exports. just return a noop function
},
set() { },
configurable: true,
})
wreq(sym);
delete Object.prototype[sym];
if (cache) delete cache[sym];
return modules;
}
this should work
essentially
modules is an object that holds each module (file)
cache is an object that caches the module exports. because if you import a module twice, it reuses the same variables
Source Code:
export let counter = 0;
export function increment() {
counter++;
}
Output:
let modules = {
1234567: (module, exports, require) => {
exports.counter = 0;
exports.increment = function() {
exports.counter++;
}
}
}
then the first time you require 1234567, it will call the function and then put the exports object that it assigned counter and increment on to the cache object. in the future it will obtain it from the cache so it keeps reusing the same counter variable
each member of the modules object corresponds to one source file and all have the same function signature and assign their exports to the exports
it is called exactly one the first time you require it, and then never again
so what you want to do is find the member of the modules object that is the module you want to patch (based on source code, you need to stringify the function)
then you want to override that member with your own function. your own function should then call the original function and can alter the exports accordingly
you can see modules right at the top of ur file
81984 is the module id aka filename of the first module
re(7914) means require module 7914
then K.default = ... means exports.default = ...
so this module requires module 7914 and all those other modules and defines a default export that has properties activityLogLevel and so on
although
isn't this slower than just making the cache a proxy and checking props
i only need to check by props, not by code
const theModuleYouWantToPatch = Object.entries(webpackModules).find(([id, module]) => module.toString().includes(".DEFAULT_COMMIT_MESSAGE_GENERATION_USER_PROMPT"));
if (!theModuleYouWantToPatch) throw "done exploder";
const [id, originalModule] = theModuleYouWantToPatch;
webpackModules[id] = function (module, exports, require) {
originalModule(module, exports, require);
// exports / module.exports are now initialised to whatever that module exports. you can access or modify it
module.exports.whatever = 42;
}
except you cant do that
because the require function accesses it via local variable which you cant change
the best you could do is find the module id from the modules object and then define a getter/setter on the cache with that
but at that point it makes more sense to just monkey patch the module
exactly like this
i made a slight edit because i made a istake
oki
sadly the part where you stringify the modules to find the right one seems to consume some memory permanently
because js caches the string
so if there is 10mb of code and you stringify everything
this is why vencord increases memory usage somewhat
hm
anyway doesntr matter much
what if i go through each module in __webpack_modules__ and monkeypatch it's call method
that way it doesnt use a ton of memory and i can also check by props immediately
you would just replace the function instead of patching call
anyway you can do that but its probably not worth it lol
its not like it will use hundreds of mb of ram
the thing is i dont know which module it is until it's run
its not that much
yes i know
im saying
you wouldnt monkeypatch .call
that makes no sense
you'd just do
for (const [id, originalModule] in Object.entries(modules)) {
modules[id] = function (module) {
originalModule.apply(this, arguments);
if (module.exports.whatever) // do thing;
}
}
but its probably not worth it lol
you create so many new functions and closures
and its more cpu intensive probably
you know its bad when you see "310 remaining items load more" in a issue
insane
just don't use WSL
I will
I was trying to figure out why it was using 40gb
I couldnt figure out
Probably half of it is cuda
except you can place a Proxy in the prototype but the getter/setter approach is better
horror
the performance of that is probably atrocious
yeah but inside the prototype
it's kinda different
the second u start messing with prototypes and do weird shit performance dips
all the prototype set methods have performance warnings xd
lol
well it might be fine who knows
either way it needs some tricks to get it to work fully
so not worth it
depending on how you do it, some traps are required to avoid a stack overflow
speaking of proxies it's kinda silly that proxies even have apply trap
I guess it's for completeness sake
but there's really no reason to ever need that
you can just wrap the function with ur own function instead to achieve the same without a proxy xd
might be more peeformant somehow
yo how do i get jemalloc to use page size 16? im tryna build the nuclear music player for my asahi linux installation but jemalloc always stops it with unsupported page size.
the only solution ive been able to find online was to use:
JEMALLOC_SYS_WITH_LG_PAGE
but that doesent seem to work for me
is it just me, or is this a macro
yeah
should i leave this as a bug to fix later or call it a feature and never fix it?
one of the side effects of rewriting the entire collision code
windows 7
look inside
kde
looks fine to me!
I love features!
has anyone ever here worked with antlr4
worst nightmare
disable-copying.js: Lines 9-25
function disableSelect() {
return false;
}
function reEnable() {
return true;
}
// If IE4+
document.onselectstart = new Function ("return false");
document.oncontextmenu = new Function ("return false");
// If NS6
if (window.sidebar) {
document.onmousedown = disableSelect();
document.onclick = reEnable();
}

Me when code is 13 years old
well heh
the fuck is blom
my lang
oh okay fair enough
@valid jetty @placid cape yall need to do https://adventofcode.com/2017/day/23
its awesome
i (and a lot of ppl in the solutions megathread) were really close to the answer but ||off by 1 because the loop does g = b - c, then b+=17 and then checks if g == c but thats before adding 17 so its an inclusive range and eric made the last number always prime ๐ญ ||
52min delta time
1 year left
yep and about 30 mins on the spoiler
ill do it after finishing 2015
another issue i had was that my || is prime function was inverted|| but i fount that quickly
if u finish it then its not broken
no way ffmpeg is hosting c & asm courses now
https://x.com/ffmpeg/status/1874474647988933010
Make your New Year's Resolution to learn C and Assembly: https://t.co/Q63dLuCgFb
We are making low level languages great again in 2025!

Ah, so they're running low on contributors
I doubt they would want some newbies to mess up their code
why is 2017 so easy
i mean code reviews exist
Javadoc
regex
No like into an actual json structure
why into a json structure
Out of an existing source
Or any format basically
isn't it a flat structure
Java library for parsing information from a structured Javadoc string. - chhorz/javadoc-parser
maybe this
Something i can read in javascript
Better javadocs
if accuracy doesn't matter that much you could just try to write your own parser
because it's unlikely there are any for js
That's a good idea, javadoc frontend sucks
ah well ig if you're trying to replace that you'll need accuracy
Yea i have frontend rn which can fetch any of the maven central artifacts
Java-parser is good, but i have backend written in JS and idk how to use teavm to port java to js
Ig if nothing else remains
or look at java parser's source code and work out what they do
but it's probably not the simplest thing to parse
Its a really fucking abstracted clusterfuck
average java project
Yea

The JavadocNode is implemented by like 12 interfaces
they're probably all the different types of javadoc structures
@valid jetty how to speed up general longest path
Make graph smaller
2017 d24 p2 takes 5s
No idea, my repo only contains stuff from 19 onward
i brought p1 from 5s to 300ms with a cache but p2 is uncacheable
ok the rust guy did it in 275 microseconds so its clearly possible
one day i will upsolve
one day
u should do this one today
make your day 10 y2015 O(n)
i solved the halting problem!!!
This seems to be my scores from long ago
i cant keep procrastinating intcode for much longer ๐ญ
Yeah I hated intcode
function overloading ๐ฅ
this is the worst problem for me rn cause im doing these on my new keyboard
and on a new layout
so i dont have symbol muscle memory
49% consistency 
is this arity based only or also type based
if i wasnโt super busy with school work i didnโt bother doing and taking down my christmas decors i would lol
Also type based
Hype based
but if you have more than one overload then for example this:
fun a(a: i64) -> i32 {...}
fun a(a: i64, b: i64) -> {...}
fun @public main() {
return a(5);
}
Will not compile because 5 is i32 by default
but if you have only one overload then it'll implicitly cast it
so this works:
fun a(a: i64) -> i32 {...}
fun @public main() {
return a(5);
}
I'll try to improve this later but for now it's enough
why the @ in @public?
Because it's an annotation, I'll probably make it as a keyword
Kinda makes more sense than putting it before
Making it so function declarations always start with the fun keyword is nice
why does it show AoC++ on EACH year 
cause i bought it on EACH year
Simp
ah. i thought itโs like one-time purchase
it is
I think you can also do this in java but not sure
so monomorphization but for arity and type
yea
fun
u do @annotation void whatever, before the type
in kotlin its before the fun keyword
you can do it also after the type if I'm not mistaken
idk in elle i have it after the param list but before the return type
fn foo(i32 a) @volatile @fmt -> string
eventually i want to make it above like in rust/java (java allows it almost everywhere)
nope
after the visibility mod but not after the type / fun
i made modifiers in any order because itโs easier to parse
pub external fn and external pub fn
do u have annotations
you're just setting booleans, don't you?
i call them โattributesโ tho
yea
can u do pub @volatile external @manual fn
no
.
oh
attributes come before the return type but after param list
meh i think it makes more sense to put them first
thats not what volatile means is it
itโs not
lol
volatile in C says to the compiler it shouldnโt optimize, reorder, or remove the variable/function through dead code elimination
but it works fine here i guess
i just know that if a variable is modified in an interrupt service routine it should be made volatile
yeah it mostly says to the compiler โdonโt make any assumptions about how to treat this variableโ
which means the compiler canโt do instruction reordering and optimization as a result
In computer programming, a value is said to be volatile if it can be read or modified asynchronously by something other than the current thread of execution.
The value of a volatile variable may spontaneously change for reasons such as:
sharing values with other threads;
sharing values with asynchronous signal handlers;
accessing hardware devi...
i thought it meant dont cache this anywhere
don't reorder volatile reads and writes
this is prob the important part
@placid cape how do you parse >=
is that GreaterEqual or [Greater, Equal]
GreaterEqual
idk maybe thats easier
does anyone here know how to use teavm
@ionic lake you have worked with shadcn i suppose
sup
shoot your question(s)
well theres this thing called sidebar
oh yeah that's new
the thing is that i dont really know how to make it show under the top menu bar
it overlaps it
currently its like this, where Navbar is my component
this is kinda what i want if you get me
hop on hypixel disasters
you mean hypixel skyblock?
i really didnt want to make my own sidebar but i guess ill have to
This is literally copy of a roblox game
sad think is ik which one ur talking abt
ok what if you put your sidebar above nav
like the whole sidebarprovider or what
cause siderbar has to be inside siderbarprovider
yeah move that entire block above
i fucking HATE c#
instead of just letting me do this
[Serializable]
class GameState {
public Grid playerFleet = new();
public Grid computerFleet = new();
public Grid targetTracker = new();
public void Clear() {
playerFleet.Clear();
computerFleet.Clear();
targetTracker.Clear();
}
}
class SaveManager {
private const string SaveFileName = "gamestate.dat";
public void Save(GameState state) {
using (FileStream fs = new FileStream(SaveFileName, FileMode.Create)) {
BinaryFormatter formatter = new();
formatter.Serialize(fs, state);
}
}
public GameState Load() {
using (FileStream fs = new FileStream(SaveFileName, FileMode.Open)) {
BinaryFormatter formatter = new();
return (GameState)formatter.Deserialize(fs);
}
}
}
``` to save and load data
they deprecated BinaryFormatter
because its "unsafe"
so i literally cant use it without installing an external package
my other options are all convoluted bloated things like converting to json or using a BinaryWriter/Reader with reflection
when it would just be this simple
what if i show you some example code
that would be cool
or, even if i hate to say, you can try shoving it to v0 and let it do it
look at the <aside> chunk in that code
its intcode time
var stream = new MemoryStream();
var writer = new BinaryWriter(stream);
writer.Write(Something1);
writer.Write(Something2);
writer.Write(Something3);
writer.Write(Something4);
writer.Write(Something5);
writer.Write(Something6);



also i recently was wondering if there's an easy way to serialize an object in rust into a binary file
Serde+bincode?
oh yeah sounds like it
i kinda wish it was simpler to parse binary file in rust though
like in c# it's just
var reader = new BinaryReader(stream);
Size = reader.ReadInt32();
FormatSize = reader.ReadInt32();
while in rust it's something insane
theo jumpscare
But ReadInt32 is quite ambiguous - is it le or be?
that's not theo
i swear to god i've browser hundreds of forum posts, crates, and i haven't found anythnig as easy as c#'s impl
theprimeagen
yeah this
It doesn't have to be harder than this https://github.com/Aureole-Suite/Factoria/blob/main/src/dirdat.rs#L109-L129
val reader = DataInputStream(FileInputStream("file.bin"))
val size = reader.readInt()
val formatSize = reader.readInt()
are u64, u32 the built-in funcs?
What do you mean built in
They're completely normal functions, defined on a completely normal struct
oh
confusing theo and prime is crazy
(Or rather, u32 is defined in the Le trait, and just calls u32le)
I'M SORRY 
you are proving his point
what's the difference though besides different method names
thats kotlin
What point, that reading and writing bytes is easy in any language?
you can tell because function namer arent PascasCase (worst decision ever)
i wrote this beauty
class SaveManager {
public const string Name = "state.bin";
public void Save(GameState state) {
using (BinaryWriter writer = new(File.Open(Name, FileMode.Create))) {
WriteObject(writer, state);
}
}
public GameState Load() {
using (BinaryReader reader = new(File.Open(Name, FileMode.Open))) {
return (GameState)ReadObject(reader, typeof(GameState));
}
}
private void WriteObject(BinaryWriter writer, object obj) {
Type type = obj.GetType();
foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Instance)) {
object value = field.GetValue(obj)!;
if (value is Grid grid) WriteGrid(writer, grid);
}
}
private object ReadObject(BinaryReader reader, Type type) {
object obj = Activator.CreateInstance(type)!;
foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Instance)) {
field.SetValue(obj, ReadGrid(reader));
}
return obj;
}
private void WriteGrid(BinaryWriter writer, Grid grid) {
writer.Write((Byte)grid.kind);
for (int row = 0; row < Config.GRID_SIZE; ++row)
for (int col = 0; col < Config.GRID_SIZE; ++col)
writer.Write(grid[row, col]);
}
private Grid ReadGrid(BinaryReader reader) {
Grid grid = new((GridKind)reader.ReadByte());
for (int row = 0; row < Config.GRID_SIZE; ++row)
for (int col = 0; col < Config.GRID_SIZE; ++col)
grid[row, col] = reader.ReadChar();
return grid;
}
}
its almost the binaryformatter
just a little extra bloat
ignore what i said
since when do u c#
since i can write in any language??
PascalCase function names is the worst decision ever yeah
and i need to for school
if i get in trouble for publishing the source code its whatever
microsoft java
i just looked and this just uses a 3rd-party crate. my point was that without crates reading binary is too hard in rust, which it seems is true
First party tho
And yes, if adding one line of toml counts as hard, you're gonna have trouble
they didn't say including the library is hard
they said that it's hard without the library
Yeah and driving a car is difficult without tires
they said "without crates reading binary is too hard", adding that one line of toml breaks that invariant of "without crates"
virus
i think reading binary files should be a simple thing in any language
you shouldn't need a library to do it
If you want to add nonsensical constraints to your language ratings you should state so upfront so I can disregard them
i don't think trying to avoid third party libraries is that nonsensical of a constraint
It is
i don't like the idea of having to use a crate for such a simple thing as just parsing simple types from a binary file
i expected messing with binary being easier in low-level languages but it seems like it's not
Imo that is exactly the kind of thing that has no place in a stdlib since there's a billion different ways to do it
Choosing one of those ways to be Objectively Superior is exactly what a stdlib should avoid
Fair, but reader already exists in rust's stdlib, it shouldn't be that hard to implement a few helper methods to make parsing easier
not "hard" but uhhh
Easy to add, hard to design
And zero (or imo negative) value in adding, since using a crate is more adaptive
Rust's stdlib is designed around the assumption that you will use external crates for more specialized things
And that is the correct design
you have a point i guess, but that's still quite confusing to me ๐
i guess i'll probably stick with doing my own small implementation of stuff like read_u32, read_u64, etc., but i'm still not quite sure about all these types of uh readers. like each solution i've found on forums suggest different ones: Cursor, BufReader, Vec, [u8], ...
arghhh why is rust so hard
And that is exactly why such a thing has no place in a stdlib
Did you make it?
I want to do 2019 intcode so much tbh
Who's stopping you
I feel like I have to solve all previous years before 2019
Ah, superstition
I redid day 7 with todd ginsbergs async approach
It feels more like implementing some sort of enterprise sotware instead of aoc
if you do it properly
dont listen to rosie
Implement aoc in enterprise style https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
Ok its not that bad
Its a sealed class with 1 abstract method thats inherited by 10 other classes who implement it
and coroutines invoking the correct class' method according to the opcode
Channel for io
i fucking love this project
sealed class ๐
Utils.cs: Line 7
public static char[,] Fill(this char[,] array, char filler) {
Is that a 2d array
why are you reading through it horror
fun
C# 
"hey i wrote my project in a language i made myself is that okay"
i mean im doing that for the bigger version of this project
im gonna write a compiler for a dummy language in elle
they say it can be any language so it should be fine i hope
elle in elle ๐ฅ
lol
tmrw ill probably start working on field access
good luck that took me a while to get right
elle calculator
use std/prelude;
use std/time;
fn calculate(string input) {
let exec_path = "{}".format(time(nil));
let src_path = "{}.le".format(exec_path);
let src = "
use std/io;
fn main() {{
io::println({});
}
".format(input);
if !io::write_to_file(src_path, src) {
return false;
}
if !libc::system("ellec {} --hush".format(src_path)) {
libc::system("./{}".format(exec_path));
io::remove(src_path);
io::remove(exec_path);
}
}
fn main() {
while true {
calculate(io::input("-> "));
}
}
or elle repl technically
depending on how you wanna look at it
it doesnt do line backhandling like the py one tho
but i can make it do that
can it remove my systemโs french language pack
yeah probably
backlog repl rewritten in elle
use std/prelude;
use std/time;
const string SHORT_EXTENSION = ".le";
fn main(string[] args) {
let program = args.remove(0);
string[] lines = [];
while true {
let line = io::input(".เณเฟ* -> "));
if line.ends_with(";") {
line.pop();
}
let backlog = "{}{}".format(
lines.join(";\n{}".format(" ".repeat(16))),
lines.len() > 0 ? ";" : ""
);
let code = "
use std/prelude;
fn main() {{
{}
io::println({});
}".format(backlog, line)
.split("\n")
.map<string>(fn(string x) x.replace(" ".repeat(12), ""))
.join("\n");
if line == "<!dbg>" {
io::println(code);
continue;
}
let src_path = ".repl-{}{}".format(time(nil), SHORT_EXTENSION);
let exec_path = "./{}".format(src_path.replace(SHORT_EXTENSION, ""));
if !io::write_to_file(src_path, code) {
io::eprintf("Failed to write to file at path: {}", src_path);
continue;
}
let src_code = libc::system(
"ellec --hush {} {}".format(
args.join(""),
src_path
)
);
io::remove(src_path);
if !src_code {
let exec_code = libc::system(exec_path);
io::remove(exec_path);
if !exec_code {
lines.push(line);
}
}
}
}
ive GOTTA make a file abstraction soon
calculate when my input is a string ๐ฅ
Is Prisma bad?
Like i hear all these opinions to use drizzle or typeorm instead
But im pretty comfortable with prisma
totally agree lol
the only real database is a plaintext file and you use the kotlin stdlib to write queries
@valid jetty when is elle gonna compile to intcode
real lol
intcode IR
@placid cape i am the biggest 2019 day 7 procrastinator
i have had 2019 day 8 solved and gitignored for almost 2 years cause i wanted to push in order and didnt have a proper day 7 solution lol
i think 2019 d7 is my longest delta
lol
i'll have big delta for 2019 d2
idk why i solved p1 before
omg day 9 is so free now
@placid cape XDDDDDD
look at the file
@placid cape i submitted nv as my answer again
so annoying
couldve had a new delta pb
17s
finally done with intcode
didnt even take that long
XDDDDDDDDDD
nicee
I just solved d16 y2015
2015 is so easy tbh
am I correct in assuming they should've censored the secrets
yes, but its a troll post i suppose lol
oh yeah looks like it
@jiratickets
made a bait post that blew up and now just feel bad about all of the nice people replying with kindness and encouragement. how does yacine live like this
@valid jetty you are REQUIRED to do https://adventofcode.com/2019/day/10
i took an hour for p1 and 19 mins for p2, lb took 13min/42min
this is so cursed
part 1 is a hack
the number of things a node sees is also the number of unique minified (divided by gcd(dx, dy)) distance vectors
I just used atan2 for that
if 2 nodes are collinear they share the minified vector
yea im not that goot at math so i didnt immediately jump to angles
I can then ||sort by that angle|| for p2
i used it in part 2 cause there was a similar problem in aoc that required atan2
thats what im doing
i think my p1 probably has a faster runtime
but p1+p2 is slower cause i compute the angle anyways
Mine allocates a n^2 array which is kinda unnecessary
i wrote a proper blocking detection system, but it wasnt giving me the correct answer for p1 so i rewrote it with the minified vector approach and then had to remake the blocking detection in p2 cause i deleted it 
Actually, looking at the numbers, much of my p2 is unnecessary
I think something like this would be more up to modern standards||```py
import cmath;P=cmath.phase;E=enumerate
p={i-j*1j for i,l in E(open("10.in"))for j,c in E(l)if"#"==c}
print(max((len(x:=sorted({P(s-a)%9 for a in p})),(m:=s-min((s-a for a in p if P(s-a)%9==x[199]),key=abs)).real-m.imag100)for s in p))
disgusting
this is becoming such a scuffed project
right now check your mailbox for the install key
lol what is this
looks like an atan2 thing
i think my vector impl in elle would come in useful for that
https://youtube.com/shorts/5cRztbMf0To
There is no way this is real
i only realised that in p2
doing p2 without atan2 would be horror i think
yall are good optimizers, is there any way to optimize this to run faster? For guava it took like 3 seconds which seems horrible(2k entries)
public Set<String> getAvailableClasses() {
URI sourceFileUri = UriComponentsBuilder.fromUriString(getUri())
.path("/")
.path(getArtifactId() + "-" + getVersion() + ".jar")
.build().toUri();
try (var is = new ZipInputStream(sourceFileUri.toURL().openStream())) {
Set<String> classes = new HashSet<>();
ZipEntry entry;
while ((entry = is.getNextEntry()) != null) {
if (entry.getName().endsWith(".class")) {
classes.add(entry.getName().replace(".class", "").replace("/", ".")
.replace("$", "."));
}
}
return classes;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Run a profiler to find what takes time
@placid cape

apparently you can declare a class inside of a method?
you can also have anonymous classes iirc
and they act as just objects
you mean those that you pass in lambdas right?
like these, they do the same thing
like you can do stuff like this
public class Main {
public static void main(String[] args) {
Object obj = new Object() {
@Override
public String toString() {
return "foo";
}
};
System.out.println(obj);
}
}
yah
that
@hoary sluice [solution.le:30:13] Array<Tuple<i64, Triple<i32, Tuple<i64, i64>*, Array<Tuple<i64, i64>*>*>*>*>* queue = <[(12, (0, (0, 0), [(0, 0)]))] at 0x1400094f0> LMAO
the let is saving my life
let queue = [$(dist(start, t), $$(0, start, [start]))];
io::dbg(queue);

because arrays need to be pointers to be able to be pushed to
and idk why i made tuples and triples pointers
An array needs to contain a pointer, sure
But why would that be part of the type? It's just the struct's internals isn't it
you could technically write Array<Tuple<i64, Triple<i32, Tuple<i64, i64>*, Array<Tuple<i64, i64>*>*>*>*>* as (i64, Triple<i32, (i64, i64), (i64, i64)[]> *)[] lol
thats not what i meant
it has that
struct Array<T> @nofmt {
i32 size;
i32 capacity;
T *elements;
};
the pointer to Array<T> is so the structure can be modified in place
So things not in pointers are immutable...?
no but theyre copied
So you don't have anything like rust's &self
if you want to have Array::push and it takes Array<T> not Array<T> * you wont edit the array youll just edit a clone of the array
Kinda like c++ but you chose the different choice?
i do, but sometimes you may not be able to get the address of a stack variable to pass that into push
Why not
so its easier if the array is just always a pointer
if the array is a param of a function
like
fn foo(Array<T> x) {
x.push(1);
}
you dont explicitly allocate stack memory in the IR for this so you cant get its address
So you're letting implementation details guide your design
sort of, i do have a workaround
if there is some value T and there is no address, it goes and allocates stack memory for it of size T and stores the value there, then returns that address
but again, that wont modify x
which is exactly why itโs always a pointer
you never deal with Array<T> itself you just have a T[] which is an alias for Array<T> *
and so it doesnโt copy all over the place and actually mutates the array when you expect it to
if you were to do
fn foo(i32[] x) {
x.push(1);
}
fn main() {
let x = [100, 39];
foo(x);
}
``` you would expect `x` to be mutated surely
if x was a Array<T> and not Array<T> * it wouldnt be
and if you dont want it to mutate there is a .clone() method on Array
And when is the array's memory freed?
currently at the end of the program's runtime, along with every other allocation
i still havent come up with a good solution for this
So, leaked
no
all allocations are pooled into an arena allocator who's pointer is stored in static memory and the arenas are all freed at the end of the program
there are no leaks
"Not freed until the program ends" is the exact definition of a memory leak
technically yes but the allocations are still tracked by the compiler so i want to eventually expand this into a gc lol
mostly this
it takes 2 seconds to fetch this data ๐ญ im so cooked with my code
day 18 done in elle
day 19 in elle
use util;
fn count_ways(HashMap<string, i64> *memo, string d, string[] ps) {
if memo.contains_key(d) {
return memo[d];
}
if d.is_empty() {
return 1;
}
i64 ways = 0;
for p in ps {
if d.starts_with(p) {
let remaining = d.slice(p.len(), d.len());
ways += count_ways(memo, remaining, ps);
}
}
memo[d] = ways;
return ways;
}
fn main(string[] args) {
let parts = io::read_to_string(args[1]).split("\n\n");
let ps = parts[0].split(", ");
let ds = parts[1].split("\n");
let memo = HashMap::new<string, i64>();
i64 c1 = i64 c2 = 0;
for d in ds {
let res = count_ways(memo, d, ps);
c1 += res >= 1;
c2 += res;
}
io::dbg(c1, c2);
}
why tf does python sort sets
maybe its just when printing
{(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (0, 10), (0, 11), (0, 12), (0, 13), (0, 14), (1, 0), (1, 4), (1, 14), (2, 0), (2, 2), (2, 4), (2, 6), (2, 8), (2, 10), (2, 11), (2, 12), (2, 14), (3, 0), (3, 2), (3, 6), (3, 8), (3, 10), (3, 14), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (4, 8), (4, 10), (4, 12), (4, 13), (4, 14), (5, 0), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (5, 8), (5, 10), (5, 14), (6, 0), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6), (6, 8), (6, 10), (6, 11), (6, 12), (6, 14), (7, 0), (7, 1), (7, 2), (7, 6), (7, 10), (7, 14), (8, 0), (8, 1), (8, 2), (8, 4), (8, 5), (8, 6), (8, 7), (8, 8), (8, 9), (8, 10), (8, 12), (8, 13), (8, 14), (9, 0), (9, 4), (9, 5), (9, 6), (9, 10), (9, 14), (10, 0), (10, 2), (10, 3), (10, 4), (10, 5), (10, 6), (10, 8), (10, 10), (10, 11), (10, 12), (10, 14), (11, 0), (11, 2), (11, 6), (11, 8), (11, 10), (11, 14), (12, 0), (12, 2), (12, 4), (12, 6), (12, 8), (12, 10), (12, 12), (12, 13), (12, 14), (13, 0), (13, 4), (13, 8), (13, 12), (13, 13), (13, 14), (14, 0), (14, 1), (14, 2), (14, 3), (14, 4), (14, 5), (14, 6), (14, 7), (14, 8), (14, 9), (14, 10), (14, 11), (14, 12), (14, 13), (14, 14)}
when 2019 day 10 in elle
thats what i thought but for some reason when i print a set its always in order
when i upsolve all the days in elle nyaboom~7
will take a while because im procrastinating so much i cant even finish this year in elle
what
no way
whaaaaa
why is this in order then idk
Sometimes, especially for small integers, the hashes just turn out that way
Mine doesn't print them in order ```py
{(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (0, 10), (0, 11), (0, 12), (0, 13), ...
{(12, 4), (4, 0), (5, 1), (8, 0), (14, 13), (5, 10), (8, 9), (10, 6), (0, 5), (2, 2), (11, 14), (0, 14), (2, 11), (13, 8), ...
did i just get super lucky doing this then
c = set(list(c)[:b])
``` where `c` is a set
and the order is preserved
Which python is it?
Python 3.10.14 (39dc8d3c85a7, Nov 09 2024, 22:52:48)
[PyPy 7.3.17 with GCC Apple LLVM 15.0.0 (clang-1500.1.0.2.5)]
Weird to have pypy aliased as python though
send your sol
ill run it
but probably yeah?
yes it is ๐ญ
If you rely on set ordering then you're wrong
its wrong with python3
i dont anymore
i had to do this after bron kerbosch
but that was a bug in my original solution
because sets are unordered
def solve(c, s=71, b=1024):
c = set(list(c)[:b])
return find(c, s)
with open(sys.argv[1]) as f:
c = set()
for line in f:
x, y = map(int, line.strip().split(','))
c.add((x, y))
print(solve(c))
print(solve2(c))
``` i was doing this and it just shouldnt work but pypy orders sets in order of adding items so it does work lol
should be this instead
def solve(c, s=71, b=1024):
c = set(c[:b])
return find(c, s)
with open(sys.argv[1]) as f:
c = []
for line in f:
x, y = map(int, line.strip().split(','))
c.append((x, y))
print(solve(c))
print(solve2(c))
i wonder why pypy has ordered sets lol
idk if them being ordered is an invariant it may just be a random side effect
wtf did i do
why is it doing that
im doing like the most basic formatting thing ever
and the weirdest thing is it breaks for a second then returns back to workig fine
?????????????????????????/ what in the
maybe im incorrectly assuming the arena has enough space and then it doesnt
@valid jetty https://ioinformatics.org/files/ioi2019problem2.pdf
pretty sure this is just jgrapht docs
find 2 subgraphs of size a, b such that there is at least one edge between them
last question of day 2 is literally just bfs?? https://ioinformatics.org/files/ioi2019problem6.pdf
she has decided she wants to visit a b and c attractions so she has decided she is gonna spill math words
this looks slightly more annoying than just a bfs
parse it into a graph with each building that a skywalk touches being an edge and then its just textbook dijkstra
you can also make a graph with a bunch of degree 2 vertices instead of making it weighted
its the same algo
different sorting
how long do you have to solve this problem
idk
5 hours per problem apparently
gn
In 5h i could make a 3d visualisation of this
lmao true
@hoary sluice @placid cape https://github.com/messcheg/advent-of-code/blob/main/AdventOfCode2015/Day07/Day07.rock
@royal nymph opinions on this
fn $scoped(fn *func) {
let current = #env.allocator;
#env.allocator = ArenaAllocator::new();
func();
#env.allocator.free_self();
#env.allocator = current;
}
fn main() {
let a = 5;
$scoped(fn() {
#env.allocator.alloc(1024 * 1024 * 1024);
});
// All freed after this function is called
}
insta husk holy shit
make it a macro instead so you dont have to use an inline func
and dont use $ its weird
"#" is reserved for compiler builtins
"@" is reserved for function and struct attributes
calling it just "scoped" is weird
and there are no macros yet
oh it's elle
why tf u using rust language block
i thought u meant in rust
anyway just add using/with blocks
Probably because discord doesn't have elle highlighting yet
Someone should make a plugin for that
no because thats not the purpose of it
thats just an example of what you can do
the purposes is like
because the allocator doesnt clean up after itself
if you have to allocate memory during a loop like a game render loop
itll just keep piling
if you $scoped it, everything will be allocated and freed on every iteration
like a temp allocator
the purpose isnt to scope only a single allocation and free it afterwards its to allocate a bunch into an autofreed chunk
sort of like the way stack allocations work but for the heap
specifically like, here
.format allocates heap memory because the string has to grow in size so it cant be stack allocated
and if this is ran in a loop itll just keep allocating
with $scoped itll free itself after its done
helfo heres a pic of some python code i did
oh right wait elle doesnt let you capture things
so actually itll be more like this
fn $scoped(fn *func, void *arg) {
let current = #env.allocator;
#env.allocator = ArenaAllocator::new();
func(arg);
#env.allocator.free_self();
#env.allocator = current;
}
fn main() {
let a = 5;
$scoped(fn(i32 *x) {
#env.allocator.alloc(x);
}, &a);
// All freed after this function is called
}
ARE YOU SERIOUS
Mangle your idents
so it has to be
fn mem::scoped(fn *func, void *arg) {
let current = #env.allocator;
#env.allocator = ArenaAllocator::new();
func(arg);
#env.allocator.free_self();
#env.allocator = current;
}
external fn mem::scoped(fn *func, void *arg) @alias("$scoped");
what
index.html: Lines 107-113
<script src="./Javascript/72b5c5874930d6222007ea7b99269673dad47bcb7355815024742ddf575ca55f.js"></script>
<script src="./Javascript/clipboardInterceptor.js"></script>
<script disable-devtool-auto src='./Javascript/bee50f64f68a2feb114d80f4a2f1337fc164bc5574f6689ce9464be7f5ccf1ed.js'></script>
<!--<script src="./Javascript/d178e32824befa1fe8305a075094c8b669b88e27b4dba91c55abca73b3f081f0.js"></script>-->
lol and this is a working legit solution lmao
Why introducing $scoped? Why not just s regular block:
{...}
maybe because you don't allow inner variables in lambda ๐ค
because scoped is performing a special task of providing a clean allocator which automatically frees everything it allocates after the function call
a regular block doesnt imply the allocator will free everything inside afterwards because the arena allocator isnt recreated
you also cant free a part of an arena only the whole arena
so you either free all or nothing
holy christ
Day07.rock: Lines 52-67
Robert wants control
Cut control into pieces
The code is attractive
Put pieces at the code into the box
A ray is very gleaming
Cast a ray
The room is large enough
Build the room up
Cast the room
while the box ain't misterious
if the box is smaller than a ray or the box is bigger than the room give back lies
build the code up
put pieces at the code into the box
baby
the truth is right
give it back
thats fizzbuzz
ok well
this isnt the prettiest thing ever
$scoped(fn(i32 bounces) {
string bouncesString = "Bounces: {}".format(bounces);
raylib::draw_text(bouncesString, (screenWidth - raylib::measure_text(bouncesString, fontSize)) / 2, 100, fontSize, YELLOW);
}, bounces);
but it doesnt segfault anymore
and i discovered a huge bug in my formatter code lol
let result = (string)#env.allocator.alloc(fmt.len());
the result used to be preallocated to at least the length of the formatter
but never memset
which is just UB
the length of that string is just whichever null byte it finds (there isnt any set)
its much better to make it like just an empty string
let result = "";
because the string.push and string.extend/concat are designed to make it grow
what is a reasonable amount of props to have on a component
cuz im using nextjs and i might be passing a lot of stuff from the server component into client subcomponent
how many?
its 5 now
i think that's okay
omg i was looking for that language
ty
babel?
babel supports everything
Mb i meant xmlparsers
Most of them still use commonjs
But i found some fast-xml-parser whic works ig
Do yall know of any optimized version of ZipInputStream
browsers have XML parsers built in
Eh its on server
i had to look up a hint in the subreddit cause i was completely lost after an hour
the solution is so simple ๐ญ
can u parse it on client instead
well i would get cors errors then
comedy ๐ญ
i should probably extract it into layouts instead
Guava
yea im making javadocs 2
sure do love pygame
lmao
it is not good
are you trying to make a coreutils replacement or what
@fleet cedar i finally fixed the struct double alloc thing
no more double alloc to dynalloc a struct
the issue was when i was doing autoderef on Foo*
it makes no sense to hold a Foo
so doing a load instruction on that ptr would give you a nullptr deref
Is there any way I can pass something from layout to page in nextjs?
i just removed that part and it works for both Foo and Foo* field access
now i need to go and fix all of the places i did double alloc ๐ฅฒ
๐ฅ
i need to work on field access and oeprator overloading
@deep mulch HII
we are finishing this one ๐ฃ๏ธ
hii
yea im just hoping that converting this hell lot of classes into package based tree wont slow this site down by a lot
vcotd
you can theoretically generate every html page at build time
e. g. https://mappings.xhyrom.dev/ this site has like 10GB if im not mistaken lol
well i can scrape any maven repository for javadocs right now
so it cant really be done on build time
its kinda weird how this works
to deref a structptr into a struct i kinda just do .. nothing
i just return the same value with a different type (Foo * and Foo are equivalent actually)
its weird that it works like that
in this
use std/prelude;
struct Foo {
i32 a;
};
fn main() {
Foo *foo = #env.allocator.alloc(#size(Foo) * 4);
foo[0].a = 42;
foo.a = 42;
}
``` those are the same thing
okay i added class lists :D
guaba
yea i mean its kinda the best thing to see it on
foo[0].a thats weird
how
you would do like
foo[0].a = 42; foo[1].a = 39; etc
the allocation is for 4 Foos
ohh didnt see that
but yeah because of auto deref rules foo[0] and foo and *foo are actually the same thing
its really weird but the c compiler does the same thing for llvm so
got a mechanical keyboard and idk if it's better for programming tbh because it's really hard not to make typos
you will get used to it
i cant type on membrane now lol
how do you type without knocking the arrow keys
no numpad
my palm presses them
wth idk
wtf lol
the tiniest bit of pressure registers on the connected device
it's also very easy to press ctrl by accident meaning if you try to type an R it reloads
also this is horrible lol
lol
@placid cape 2019 is really fun
make 15s english
interesting
ill try to finish 2015 until end of next weekend
by not having arrow keys
rust????!
yes
the keyboard is called ferris sweep, its a fork of the ferris keyboard and ferris is the name of the rust crab
thats why hes holding a broom
cause sweep
get it haha
are you touch typing properly
cause i think ur turning ur hands to not have to angle your wrists in a silly way and hence pressing arrow keys

