My favourite one being
sudo rm -rf /*
What is your preferred scariest one liner code?
My favourite one being
sudo rm -rf /*
What is your preferred scariest one liner code?
For further actions, you may consider blocking this person and/or reporting abuse
Juan Carlos Valerio Barreto -
Michael Tharrington -
Shwet Khatri -
Ron Northcutt -
Once suspended, ankitbeniwal will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, ankitbeniwal will be able to comment and publish posts again.
Once unpublished, all posts by ankitbeniwal will become hidden and only accessible to themselves.
If ankitbeniwal is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Ankit Beniwal.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag ankitbeniwal:
Unflagging ankitbeniwal will restore default visibility to their posts.
Top comments (12)
The classic fork bomb is pretty terrifying:
The function is called
:
. Call itscaryFunc
instead:This function recursively calls itself, then pipes it to another call of itself that gets put in the background with
&
, meaning the child will not die and just continually recursively call itself, blocking everything else, until it's maxed out your system resources and you crash. It's even multiple-recursive, for extra oomph. After defining the function, we call it.Don't do this.
I won't do it. Pretty Scary. 😱😱
The following is the Python form of one of the most insidious anti-patterns in all of programming. The scary one-liner is the third line.
Mike Pirnat aptly calls that the "Diaper Anti-Pattern". It's horrific because it silences all errors, expected and otherwise, leaving your program in an unresolved exceptional state with few, if any, clues as to what's wrong.
Always, always explicitly catch and handle (or at least log) your exceptions. Unhandled exceptions should always crash your program. Period.
From the Zen of Python:
If you're using anything resembling the diaper anti-pattern in any language, go fix it now. Seriously. Right now. Don't make me call your mother.
Here's a runner up from Python 2...
Thankfully, that one is no longer possible in Python 3.
The boolean-swapping allowed by Python 2 is a great one 👏 I remember when I first discovered that
True
andFalse
were just builtin, mutable, global variables 😬I agree with Ben Lovy... typical forkbomb like this one in C
But even scarier is
or something like deleting the column from table in production database like:
deleting usernames is awesome. 😂
Watch out, a JS ghost...
Ha! Made me smile
Sorry, my one liner is so scary even I'm too scared of writing it down.
Something I actually did. On production. But luckily before going live with a new service.
Since that day, I always BEGIN and either ABORT or COMMIT after triple-checking.