this post was submitted on 12 Mar 2025
700 points (98.5% liked)

Programmer Humor

21564 readers
2459 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
all 48 comments
sorted by: hot top controversial new old
[–] Scoopta@programming.dev 110 points 3 days ago (1 children)

...this is so much more cursed than it needs to be. If you want to bash in C just system("echo hello world");

[–] tempest 55 points 3 days ago (2 children)

That wouldn't necessarily be bash though

[–] smeg@feddit.uk 54 points 3 days ago (1 children)

Fine, system("bash -c 'echo hello world'"); then!

[–] xthexder@l.sw0.com 9 points 3 days ago (3 children)

Now print "¯\_(ツ)_/¯" with the quotes

[–] Beanie@programming.dev 1 points 7 hours ago

my best guess: system("bash -c 'echo \\\"¯\\\\_(ツ)_/¯\\\"'");

which will get parsed as: bash -c 'echo \"¯\\_(ツ)_/¯\"'

which will run: echo "¯\_(ツ)_/¯"

and since echo just prints whatever was given to it, it'll print "¯\_(ツ)_/¯" with the quotes

[–] ultrafastsloth@lemmy.world 14 points 3 days ago

I decided to throw my PC in the composter and become a gardener

[–] smeg@feddit.uk 3 points 3 days ago

That was actually the first line of C I've ever written so there's no way I'm guessing the right number of escapes, but I guess I'd cheat by finding the value of each char and printing those one at a time.

[–] Scoopta@programming.dev 21 points 3 days ago

Fair, should've just said shell

[–] ClassifiedPancake@discuss.tchncs.de 39 points 3 days ago (1 children)

That emoji annoys me more than I would like

[–] kamen@lemmy.world 24 points 3 days ago (1 children)

As if someone's telling a joke and saying "This is where you should laugh"

[–] Deebster@programming.dev 16 points 3 days ago (1 children)

It's the meme version of a laugh track

[–] kamen@lemmy.world -1 points 3 days ago

Laugh tracks have a purpose though. I understand they're not to everyone's liking - and that's fine, but they work for some comedy shows - and usually they're from the live audience that sees things performed in front of them.

[–] xia@lemmy.sdf.org 65 points 3 days ago

Tsk tsk... forgot to clean up your temp file!

[–] MonkderVierte@lemmy.ml 24 points 3 days ago (2 children)
[–] potoo22@programming.dev 9 points 3 days ago

Okay but 🍒 shouldn't output 🍉. This is inconsistent and confusing. We have standards.

[–] Opisek@lemmy.world 9 points 3 days ago

Picking emojis that make sense actually made it easy to read.

[–] misteloct@lemmy.world 28 points 3 days ago

My coworkers could learn a thing or two from this. For one, it actually works.

[–] tdawg@lemmy.world 41 points 3 days ago

For shame. They forgot to make a script to make a tmp script using mktmp, so they can store their tmp script in the tmp script and have proper cleanup

[–] Artyom@lemm.ee 34 points 3 days ago

Always follow best practices, make sure you cleanup by deleting the hello world bash file!

[–] mkwt@lemmy.world 20 points 3 days ago (1 children)
[–] ArtVandelay@lemmy.world 14 points 3 days ago* (last edited 3 days ago)

It violates oh so much including that.

[–] tiredofsametab@fedia.io 19 points 3 days ago (3 children)

Now call that C program from some other program in another language.

[–] JasonDJ@lemmy.zip 27 points 3 days ago* (last edited 3 days ago)
with open('program.c', 'w') as f:
    f.write(
"""I'm not actually going to copy down the program... 

But you get the idea of the joke.

Right?""")
[–] bjoern_tantau@swg-empire.de 24 points 3 days ago (1 children)
[–] tiredofsametab@fedia.io 15 points 3 days ago (1 children)
[–] Traister101@lemmy.today 1 points 3 days ago (1 children)

Ah yes now I can... dereference a raw pointer (yes that's essentially the only thing unsafe rust actually enables you to do, it doesn't disable the borrow checker or anything else, it just allows you to play with pointers)

[–] calcopiritus@lemmy.world 1 points 3 days ago
unsafe fn<'a, T>(p: &'a T) -> &'static mut T {
    p as *cons T as *mut T as &'static mut T
}

It is a bit more than just dereferencing raw pointers.

[–] xthexder@l.sw0.com 7 points 3 days ago (1 children)
[–] tiredofsametab@fedia.io 2 points 3 days ago

It's..... Beautiful.

[–] tetris11@lemmy.ml 19 points 3 days ago

why would you hurt me like this

[–] CrimsonMishaps@lemmy.world 17 points 3 days ago

Fucking brilliant

[–] thann@lemmy.dbzer0.com 7 points 3 days ago

Who says C isnt mem safe?

[–] BartyDeCanter@lemmy.sdf.org 11 points 3 days ago

Thanks, I hate it.

[–] qaz@lemmy.world 6 points 3 days ago (1 children)

Some time ago I wrote a program in COBOL and half of it was just CALL "SYSTEM" BY CONTENT in the end.

I did the same with python once lol.

I didn't know enoug python or bash so i mixed both with os.system

[–] ZILtoid1991@lemmy.world 3 points 3 days ago

I C what you did there!

Dave is not here.

[–] pedz 3 points 3 days ago (1 children)

That's me with TCL.

I've had an eggdrop for years (obviously) and I'm very bad with TCL, so any new script that I want to add is a bash script executed by the TCL script.

[–] aquafunk@lemmy.sdf.org 1 points 3 days ago (1 children)

TIL people still run eggdrop bots. I don't think Ive touched one since maybe 2003. was probably the last time I messed with tcl

[–] pedz 2 points 3 days ago

I still have an IRC server but the eggdrop's usefulness has pretty much been reduced to fetching YouTube titles and the URL of images on tenor. Its main use was to fetch titles for all URLs pasted on channels where it is, but because me and most of the users are now using TheLounge as a client, there is no need for that anymore, except for a few exceptions. At one point it was also displaying all the things my friends upvoted on reddit, but since reddit closed its API and I came here...

IRC with TheLounge is still very useful though.

[–] Irelephant@lemm.ee 2 points 3 days ago

subprocess.run()

[–] sga@lemmings.world 2 points 3 days ago

reinventing shell scripting. Though I am guilty of this, I do something like this (more complex) but essentially a shell script in rust just because for some application, reading files is slower that way

[–] CosmicCleric@lemmy.world -1 points 3 days ago (1 children)

Apologies for being off-topic, but the domain name, "swg-empire.de", does the 'swg' part 'Star Wars Galaxies' by chance?

~This~ ~comment~ ~is~ ~licensed~ ~under~ ~CC~ ~BY-NC-SA~ ~4.0~

[–] bjoern_tantau@swg-empire.de 5 points 3 days ago (1 children)

No. It was for a Star Wars roleplay but not a video game. It started life in the newsgroup de.rec.sf.starwars and I played the role of Emperor.

[–] CosmicCleric@lemmy.world -1 points 3 days ago (1 children)

No. It was for a Star Wars roleplay but not a video game. It started life in the newsgroup de.rec.sf.starwars

Ah, ok, nice! Was that the old D6 version, or the newer D20 one?

and I played the role of Emperor.

You dark person you! 😜

~This~ ~comment~ ~is~ ~licensed~ ~under~ ~CC~ ~BY-NC-SA~ ~4.0~

[–] bjoern_tantau@swg-empire.de 8 points 3 days ago (1 children)

No set rules, just goofing around. When we got too annoying for the rest of the newsgroup we moved to a mailing list and met up in real life a bunch of times.

First time my father flew me there in a small sports plane. They had gotten the permission to greet me on the air field with a limousine blasting the Force Commander remix of the Imperial March and a black carpet. All the Jedi, Sith and in-betweens were waving Emperor-flags and greeted me as was befitting a man of my status.

Did I mention that I was 14 at the time and everyone else about 30?

Good times.