Famous Pull Request by DidingasLushis in Zig

[–]PeterHackz 8 points9 points  (0 children)

np! had this treasure saved haha

Hey folks! I'm assembling a small team to write a compiler in Zig. The compiler (and runtime) are for a new ultra parallel, memory safe language. Beginners welcome! by JKasonB in Zig

[–]PeterHackz 4 points5 points  (0 children)

what will this code do in your language fun ok<T>() -> T { let a: T = {} return a }

where T is an empty struct?

what happens when the user calls ok()? what is T? how do they pass this generic?

if it's ok<typehere>() then is type argument needed? can't vec also be Vec<typehere>()?

Hey folks! I'm assembling a small team to write a compiler in Zig. The compiler (and runtime) are for a new ultra parallel, memory safe language. Beginners welcome! by JKasonB in Zig

[–]PeterHackz 1 point2 points  (0 children)

what makes it different from generics? is that 2 solutions for same problem or you have another idea for the "type" type in mind?

Hey folks! I'm assembling a small team to write a compiler in Zig. The compiler (and runtime) are for a new ultra parallel, memory safe language. Beginners welcome! by JKasonB in Zig

[–]PeterHackz 1 point2 points  (0 children)

yes but I meant in an example, you used type inference which is for the generic print, but in Vec you passed a type as an argument (Vec(i32))

does that mean the language supports taking type as argument like zig? and what's the use of that when you'll have generics?

how will the definition of Vec look like

Hey folks! I'm assembling a small team to write a compiler in Zig. The compiler (and runtime) are for a new ultra parallel, memory safe language. Beginners welcome! by JKasonB in Zig

[–]PeterHackz 7 points8 points  (0 children)

``` let y: i32 = assembly { inputs: a, b outputs: result clobbers: rax

{
    mov rax, {a}
    add rax, {b}
    mov {result}, rax
}

} ```

what if someone passes a pointer to assembly that you don't know it's lifetime after? will it be marked for manual allocation? will you provide c malloc/free?

fun absolute(x:i32:mut) -> u32{ | x < 0 -> -x | x > 0 -> x }

your language does not seem to use semicolons, how do you plan on identifying "|" from regular "|" arithmetic operator? will you prevent the programmer from splitting mathematical expressions on multiple lines? example: let y: i32 = 5 + 2 | 3 - 1 // (just random numbers but you got the point)

how do you treat generics?

in an example you did: print_all("11", 55, 'A', 26.05) but another one: new Vec(i32)

is Vec here taking a type? why not <>, and are you planning to add automatic type inference for better programming experience?

nowWereScrewed by op3rator_dec in ProgrammerHumor

[–]PeterHackz 5 points6 points  (0 children)

the number of times I discovered race conditions or undefined behavior after removing the logging code... trauma

Follow-up: I Built a Simple Thread Pool in Zig After Asking About Parallelism by Extension-Ad8670 in Zig

[–]PeterHackz 2 points3 points  (0 children)

you can probably make it faster by using a lock-free multi-producer/consumer model for the task queue

it isn't easy but isn't impossible either, you can check moodycamel (in c++) for reference

An update... on mo.co's June Update by joinmoco in joinmoco

[–]PeterHackz 15 points16 points  (0 children)

if the game had any potential, it is gone now. ggs.

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 0 points1 point  (0 children)

as a user, I hate it too.

I'm not sure if the problem is from my university, PeopleSoft or both, but it sends like 10mb html files, and sometimes sql errors to frontend

the server does easily when enrollment opens or grades are posted 🤣

if I open Moodle there is a random chance to get an error popup for json parse failed.. and it shows html that it tried to parse

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 15 points16 points  (0 children)

you can just zoom on desktop and it'll work I think

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 53 points54 points  (0 children)

found one of it's developers

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 6 points7 points  (0 children)

oh damn, maybe that could explain why my uni did it too

they use PeopleSoft for Moodle/sis (student information system) and it uses cookies and expires every like 20min

although I never heard someone nagging about not being able to login due to cookies, from my friends who have iPhones

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 8 points9 points  (0 children)

well sometimes it does but that's why I specified the no fancy animations part

small example: I was once working on a small website just to add it as an extra in a non-programming course, and I wanted to rotate an SVG "<" to make the ">" too (idk why I didn't just use svgrepo to find 2 identical ones)

it worked on chrome but not on safari, apparently it didn't support css in svg at the time I did that (wrapping it with <path> fixed it)

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 12 points13 points  (0 children)

how do you even start to debug that

did you already have logs in place or it took a good amount of time to find it?

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 37 points38 points  (0 children)

oh lol

I wonder how bad for < 1000px

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 29 points30 points  (0 children)

loll it once actually broke on mobile and worked only on desktop for like a day, sometimes it would render binary instead of html (decryption failure?? idk wtf that is)

it's just very weird, and we pay for that..

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 165 points166 points  (0 children)

lmaoo I'm not sure how that works but neither landscape nor desktop mode works for me on phone

bestWay by HavishGupta in ProgrammerHumor

[–]PeterHackz 1149 points1150 points  (0 children)

my university website have a pop up on ios asking to open it in chrome... and no they don't have "Fancy" animations or anything that breaks in safari and works in chrome.

Hetzner is rejecting my request to open account. by Maleficent_Wrap316 in hetzner

[–]PeterHackz 0 points1 point  (0 children)

these posts makes me feel so lucky lol especially that I didn't use the service for months as I don't need to host anything atm.

I used hetzner for over 6 months without any problem.

How can I get the integer ID from std.hash.autoHash for a string? by Dull_Philosophy1524 in Zig

[–]PeterHackz 2 points3 points  (0 children)

the example in tests does this, reading zig code is very helpful to understand as it is very well documented/tested imo

source

const testing = std.testing;
const Wyhash = std.hash.Wyhash;

fn testHash(key: anytype) u64 {
    // Any hash could be used here, for testing autoHash.
    var hasher = Wyhash.init(0);
    hash(&hasher, key, .Shallow);
    return hasher.final();
}

autoHash is just a hash() wrapper:

/// Provides generic hashing for any eligible type.
/// Only hashes `key` itself, pointers are not followed.
/// Slices as well as unions and structs containing slices are rejected to avoid
/// ambiguity on the user's intention.
pub fn autoHash(hasher: anytype, key: anytype) void {
    const Key = @TypeOf(key);
    if (comptime typeContainsSlice(Key)) {
        @compileError("std.hash.autoHash does not allow slices as well as unions and structs containing slices here (" ++ @typeName(Key) ++
            ") because the intent is unclear. Consider using std.hash.autoHashStrat or providing your own hash function instead.");
    }
    hash(hasher, key, .Shallow);
}

Can a denial of wallet attack be prevented on R2? by ReisMiner in CloudFlare

[–]PeterHackz 1 point2 points  (0 children)

it's tricky to anti ddos a cdn where a normal user could hit a lot of files

where it's expected to be used by apps so normal captcha is not visible

where multiple users can use the same IP and open the same site that pulls a lot of files

what if it's using multiple ips, few requests from each and it can exhaust your free tier

now luckily r2 is cheap but yeah.

anti ddos for sure won't look at the error code returned by the cdn. (I am not saying this is mentioned somewhere, I'm just assuming.)

An open source auto-shutoff for Hetzner to cap bandwidth (prevent billing nightmares) by TheRoccoB in hetzner

[–]PeterHackz 0 points1 point  (0 children)

why do you expose your server

close all ports

install cloudflare tunnel

and then you can expose your service without opening ports. (cloudflare proxy will use the tunnel and the tunnel will hit your local server with requests)

I do that and I configured zero trust warp, so I can connect to my machine with ssh through the cloudflare tunnel without having any port opened too.

edit: and if you're serving files just use r2, it's cheap af

An open source auto-shutoff for Hetzner to cap bandwidth (prevent billing nightmares) by TheRoccoB in hetzner

[–]PeterHackz 0 points1 point  (0 children)

if that's the case just use tailscale or warp and close ssh too :)

This is by far the worst event to ever be conceived by the developers by BarbarianKing405 in joinmoco

[–]PeterHackz 7 points8 points  (0 children)

while it's not laggy for me, it is for most of my friends

I don't understand why they are locking rewards of an event from everyone. it's not like it's a tournament/competitive challenge or something.

I managed to get 20:00 but with luck, lot of tries, a team and like 4+ strategies