this post was submitted on 19 Feb 2024
1 points (100.0% liked)

Programmer Humor

32376 readers
1438 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 0 points 8 months ago

Fork bomb is actually a pretty fantastic cat name

[–] [email protected] 0 points 8 months ago (3 children)

I tried but got an error:

:& : Command not found

Is it expected ? Did I type something wrong ? I'm confused...

[–] [email protected] 0 points 8 months ago (3 children)

@wgs

Generally, don't just copy paste things you find online.

Something else to be aware of and stay away from is "rm -rf /" which will delete everything on your computer, including your operating system. Naturally this will crash the computer and you will not be able to start it again.

(You should be able to boot from a usb stick though.)

[–] [email protected] 0 points 8 months ago

sudo rm -rf / --no-preserve-root

and your password to delete the french language pack :3

[–] [email protected] 0 points 8 months ago (1 children)

I just tried your command and it yields a lot of Permission denied. Is it expected or your command is incomplete ?

[–] [email protected] 0 points 8 months ago (1 children)

@wgs I really hope you're trolling. Don't do that.

Yes, this is expected and means the regular safeties are working. Don't turn those off please.

[–] [email protected] 0 points 8 months ago (1 children)

Nevermind I figured it out, you gotta use sudo for it to work properly !

[–] [email protected] 0 points 8 months ago (2 children)

Lies, if you actually did that you would know you need the --no-preserve-root flag

[–] [email protected] 0 points 8 months ago

Not with busybox's rm 🤘

[–] [email protected] 0 points 8 months ago* (last edited 8 months ago) (1 children)

sudo cat /dev/urandom > /dev/sda*

[–] [email protected] 0 points 8 months ago (1 children)

it does not work, it says permission denied. Is there anything I should do ?

[–] [email protected] 0 points 8 months ago* (last edited 8 months ago) (2 children)

sudo cat /dev/urandom > /dev/*
Or
sudo dd if=/dev/urandom of=/dev/sda bs=4k conv=notrunc,noerror

P.s. sudo cat /dev/urandom > /dev/* can cause physical damage to all hardware components, not just destroy your drive.

[–] [email protected] 0 points 8 months ago (2 children)

Can you elaborate how it can cause physical damage?

[–] [email protected] 0 points 8 months ago* (last edited 8 months ago)

It blasts all virtual device files that directly represent the hardware of the system; from disks to audio devices and so on; with extremely random data potentially causing irreversible damage.

[–] [email protected] 0 points 8 months ago (1 children)

Well as I see it, it will just do a lot of write operations to your disk, which might eventually damage it if you do it a lot (just like any write operation done on a disk). However, this specific command isn't bad per se, and is even technically a good thing to do for preparing to full disk encryption.

[–] [email protected] 0 points 8 months ago (1 children)

We aren't in the days of olde any more were disks would execute every random order you give them without thought... also, writing to /dev isn't going to do that it's simply going to give the disks write orders, /dev is quite a bit less raw than the firmware interfaces (SATA etc).

What you're really doing here is fuzzing both the kernel and device firmware. You might find a bug but finding bugs doesn't break things it just lays bare how stuff was always broken. Typically nothing a hard reset won't fix.

[–] [email protected] 0 points 8 months ago* (last edited 8 months ago) (1 children)

I didn't come up with this idea myself, this is straight from OpenBSD disk setup guide (which I personally trust as a good source of info) :

Encrypting External Disks

This section explains how to set up a cryptographic softraid volume for an external USB drive. An outline of the steps is as follows:

  • Overwrite the drive's contents with random data

[...]

# dd if=/dev/urandom of=/dev/rsd3c bs=1m`
[–] [email protected] 0 points 8 months ago

Yeah if that triggers a bug then the kernel or drive is barely functioning, neither of the two should care what data you write and it's getting tested all the time as compressed data is indistinguishable from random data.

You could certainly confuse something in /dev that takes actual commands, but say spinning fans randomly won't do much, and neither crashing the fan controller the firmware will still shut the system down before it melts itself.

But if you have, dunno, an old plotter hooked up to /dev/lp0 and it's directly interpreting every random number on there as a movement command you might overheat the mechanism and set it on fire.

[–] [email protected] 0 points 8 months ago

sudo cat is pointless here, better do

</dev/urandom sudo tee /dev/sd*

As a bonus it'll scramble your terminal 💪

[–] [email protected] 0 points 8 months ago (1 children)

It’s a fork bomb. Specifically it’s a piece of code that recursively calls itself and then it calls itself to run the code.

Thank goodness it did not work, but please do not actually run code like this!! Do your best to figure out what the code is doing before you attempt to run it!

[–] [email protected] 0 points 8 months ago* (last edited 8 months ago)

Nevermind I figured what went wrong, I mistyped it initially ! It would have been much easier to copy paste it if it wasn't a picture...

Fun fact, the command displays a nice cat picture in ASCII :)

Edit: screenshot

[–] [email protected] 0 points 8 months ago (1 children)
[–] [email protected] 0 points 8 months ago (1 children)

I know a guy that can fix it if you send me your ssh keys

[–] [email protected] 0 points 8 months ago

Both of them?

[–] [email protected] 0 points 8 months ago* (last edited 8 months ago) (1 children)

Better cat version:🐈(){🐈|🐈&}

[–] [email protected] 0 points 8 months ago

you are missing ;🐈 at the end

[–] [email protected] 0 points 8 months ago

Stop doxxing the cat

load more comments
view more: next ›