Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
fool ( fool@programming.dev )  to Programmer Humor@programming.dev · 2 years ago

of=/dev/sda

programming.dev

message-square
40
link
fedilink
344

of=/dev/sda

programming.dev

fool ( fool@programming.dev )  to Programmer Humor@programming.dev · 2 years ago
message-square
40
link
fedilink
alert-triangle
You must log in or # to comment.
  • Badabinski ( Badabinski@kbin.earth ) 
    link
    fedilink
    arrow-up
    58
    ·
    2 years ago

    Having been in this situation (the only binary I could use was bash, although cd was a bash builtin for me), echo * is your friend. Even better is something like this:

    get_path_type() {
        local item
        item="$1"
        [[ -z "$item" ]] && { echo 'wrong arg count passed to get_path_type'; return 1; }
        if [[ -d "$item" ]]; then
            echo 'dir'
        elif [[ -f "$item" ]]; then
            echo 'file'
        elif [[ -h "$item" ]]; then
            echo 'link'  # not accurate, but symlink is too long
        else
            echo '????'
        fi
    }
    
    print_path_listing() {
        local path path_type
        path="$1"
        [[ -z "$path" ]] && { echo 'wrong arg count passed to print_path_listing'; return 1; }
        path_type="$(get_path_type "$path")"
        printf '%s\t%s\n' "$path_type" "$path"
    }
    
    ls() {
        local path paths item symlink_regex
        paths=("$@")
        if ((${#paths[@]} == 0)); then
            paths=("$(pwd)")
        fi
        shopt -s dotglob
        for path in "${paths[@]}"; do
            if [[ -d "$path" ]]; then
                printf '%s\n' "$path"
                for item in "$path"/*; do
                    print_path_listing "$item"
                done
            elif [[ -e "$path" ]]; then
                print_path_listing "$path"
            printf '\n'
            fi
        done
    }
    

    This is recreated from memory and will likely have several nasty bugs. I also wrote it and quickly tested it entirely on my phone which was a bit painful. It should be pure bash, so it’ll work in this type of situation.

    EDIT: I’m bored and sleep deprived and wanted to do something, hence this nonsense. I’ve taken the joke entirely too seriously.

    • MicrowavedTea ( MicrowavedTea@infosec.pub ) 
      link
      fedilink
      arrow-up
      32
      ·
      2 years ago

      was a bit painful

      Well that’s an understatement

      • Badabinski ( Badabinski@kbin.earth ) 
        link
        fedilink
        arrow-up
        24
        ·
        2 years ago

        My pain tolerance for shitty input methods has been permanently warped after experiencing psychic damage from using Teamviewer to connect to a system over a very flaky HughesNet satellite link. I was working for a vendor that supplied a hardware networking box to a stupid retail company that sells food and shit. I just wanted to ssh to our boxen on a specific network so I could troubleshoot something, but the only way I could get to it was via putty installed on an ancient Windows XP desktop on the same network as our box that could only be accessed with Teamviewer. My favorite part of that was that the locale or something was fucked up, so my qwerty keyboard inputs were, like, fucking transformed into azerty somehow?? The Windows desktop was locked down and monitored to a tremendous degree, so I couldn’t change anything. The resolution was terrible, the latency was over a second, and half of my keyboard inputs turned into gibberish on the other side.

        Oh, and I was onsite at that same company’s HQ doing a sales engineering call while I was trying to figure out what was wrong. I spent 5 days sitting in spare offices with shitty chairs, away from my family, living that fucking nightmare before I finally figured out what was wrong. God damn, what a fucking mess that was. For anyone reading this, NEVER WORK FOR GROCERY/DRUG STORE IT. They are worse than fucking banks in some ways. Fuck.

        EDIT: also, I asked ‘why Teamviewer’ and the answer was always shrugs. This was before the big TeamViewer security incidents, so maybe they thought it was more secure? Like, at least they didn’t expose RDP on the internet…

        • MicrowavedTea ( MicrowavedTea@infosec.pub ) 
          link
          fedilink
          arrow-up
          9
          ·
          2 years ago

          Yeah, suddenly coding on a phone doesn’t seem so bad

        • Malfeasant ( Malfeasant@lemm.ee ) 
          link
          fedilink
          arrow-up
          4
          ·
          2 years ago

          HughesNet

          the latency was over a second

          It’s going to space!

          • Badabinski ( Badabinski@kbin.earth ) 
            link
            fedilink
            arrow-up
            4
            ·
            2 years ago

            It very definitely was 😅 The way that company used the satellite network was cool, don’t get me wrong. They would use it to push content out to all their stores with multicast which was really efficient with bandwidth. I loved it for that, but I hated interacting with it over unicast in any way, shape, or form. Horses for courses, as they say.

  • vvv ( vvv@programming.dev ) 
    link
    fedilink
    arrow-up
    55
    ·
    2 years ago

    … but cd is a built-in

    • fool ( fool@programming.dev ) OP
      link
      fedilink
      arrow-up
      29
      ·
      2 years ago

      -1 accuracy point ( ◞ ﹏ ◟)

      linux 4.5-rc5 had efivarfs fixed to prevent “rm -rf /” bricking uefi motherboards – so maybe someone can try it out? :]

    • sik0fewl ( sik0fewl@lemmy.ca ) 
      link
      fedilink
      arrow-up
      8
      ·
      2 years ago

      It would be pretty useless if cd was a child process that changed its own directory, only to return to bash and be back where you started.

  • pfm ( pfm@scribe.disroot.org ) 
    link
    fedilink
    arrow-up
    49
    ·
    2 years ago

    Reminds me this great story from a different era:

    https://www.ee.ryerson.ca/~elf/hack/recovery.html

    • Brahvim ( Brahvim@lemmy.kde.social ) 
      link
      fedilink
      isiZulu
      arrow-up
      5
      ·
      2 years ago

      THANKS!!! I have it bookmarked forever now!

      I lost access to it. Thank you for bringing it back to me! Yay!..

    • pro3757 ( pro3757@programming.dev ) 
      link
      fedilink
      arrow-up
      4
      ·
      2 years ago

      I got reminded of it last week after years. What are the chances it came up again. 😁

  • Thorry84 ( Thorry84@feddit.nl ) 
    link
    fedilink
    arrow-up
    42
    ·
    2 years ago

    Hmmm command not found, let me just try the same command a couple more times, this time it will work right?

    In IT teaching users to actually read and understand errors is always an uphill battle.

    • kaboom36 ( kaboom36@ani.social ) 
      link
      fedilink
      arrow-up
      49
      ·
      2 years ago

      Tbh I’d try it multiple times too, just because the concept of cd not being there is horrifying and cannot possibly be the case

      • Thorry84 ( Thorry84@feddit.nl ) 
        link
        fedilink
        arrow-up
        17
        ·
        2 years ago

        Very true, I would do the same and feel my stomach drop farther each time.

    • smeg ( smeg@feddit.uk ) 
      link
      fedilink
      English
      arrow-up
      6
      ·
      2 years ago

      Never dealt with an intermittent failure or race condition, eh?

    • FruitLips ( FruitLips@lemmy.ml ) 
      link
      fedilink
      arrow-up
      5
      ·
      2 years ago

      Where is the Windows ‘help’ button, did you try that?

  • Shadow ( Shadow@lemmy.ca ) 
    link
    fedilink
    arrow-up
    25
    ·
    2 years ago

    No problem, just tab complete your way around the filesystem.

  • nxn ( nxn@lemmy.ml ) 
    link
    fedilink
    English
    arrow-up
    24
    ·
    edit-2
    2 years ago

    deleted by creator

  • Scoopta ( Scoopta@programming.dev ) 
    link
    fedilink
    arrow-up
    20
    ·
    2 years ago

    I am immune to /dev/sda for I only have nvme

    • redditReallySucks ( redditReallySucks@lemmy.dbzer0.com ) 
      link
      fedilink
      arrow-up
      21
      ·
      2 years ago

      I love the nvme partition naming. Looking at you nvme1n1p3

    • nxn ( nxn@lemmy.ml ) 
      link
      fedilink
      English
      arrow-up
      9
      ·
      edit-2
      2 years ago

      deleted by creator

      • Scoopta ( Scoopta@programming.dev ) 
        link
        fedilink
        arrow-up
        5
        ·
        2 years ago

        Eh? Idk if I agree. My original comment was entirely a joke based on the fact that the literal argument of=/dev/sda has no affect on my system but to address your actual point. I personally don’t find nvme naming any more confusing than SCSI. /dev/nvme0n1 is only one char away from /dev/nvme1n1 just like sda vs sdb. Additionally if you understand how the kernel comes up with those names they make a lot of sense. The first number is the controller, the second is the namespace or drive attached to that controller, the 3rd if present is the partition on the given drive. It is entirely possible to have a controller with more than one namespace. That aside aside…I think there is a genuine benefit to be argued for having USB drives, which are SCSI and fall into sdX naming separate from system drives as I dd far more USB media than system media.

    • Trainguyrom ( Trainguyrom@reddthat.com ) 
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      I realized I was long overdue for a hardware refresh when I learned that nvme drives are /dev/nvme and not /dev/sd[x] and I realized every single computer I interacted with was pre-nvme

    • quant ( quant@leminal.space ) 
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      An unintended benefit of using Qubes is that everything is a virtual machine and physical disks have to be manually attached to a vm before doing operations like dd. I haven’t had to worry about accidentally nuking my main partition for a while.

      • Scoopta ( Scoopta@programming.dev ) 
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        Huh, yeah I suppose that’s true. Qubes is an interesting project but I’m not sure it’s for me. I selectively isolate apps I worry about using containers, I actually should give flatpak a try as it basically does that for me but I haven’t seriously tried it yet.

  • Nicht BurningTurtle ( nichtburningturtle@feddit.org ) 
    link
    fedilink
    arrow-up
    13
    ·
    2 years ago

    I see girls last tour, I upvote.

  • MonkderVierte ( MonkderVierte@lemmy.ml ) 
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    2 years ago

    echo $PATH

    And alias to be sure.

    • Ricky Rigatoni ( rickyrigatoni@lemm.ee ) 
      link
      fedilink
      arrow-up
      3
      ·
      2 years ago

      bash: echo: command not found

      bash: alias: command not found

      • Faresh ( Faresh@lemmy.ml ) 
        link
        fedilink
        English
        arrow-up
        6
        ·
        edit-2
        2 years ago

        echo and alias are both shell commands. If the shell is running (which it obviously still is), those commands should still work, as it does not involve reading data from disk, but from memory.

        Edit: I just noticed the picture said cd was not found, which is also a shell built-in. So, I don’t know.

        • dko1905 ( dko1905@discuss.tchncs.de ) 
          link
          fedilink
          arrow-up
          4
          ·
          2 years ago

          Just tested it in a container. The original screenshot is wrong:

          screenshot of them being wrong

        • Joe Cool ( joe_cool@lemmy.ml ) 
          link
          fedilink
          arrow-up
          4
          ·
          2 years ago

          Why would somebody lie on the internet?

      • MonkderVierte ( MonkderVierte@lemmy.ml ) 
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        (╯°□°)╯︵ ┻━┻

        Switch your calculator with a computer. Try again.

  • 0x0 ( 0x0@programming.dev ) 
    link
    fedilink
    arrow-up
    8
    ·
    2 years ago

    Empty $PATH.

  • Aniki 🌱🌿 ( aniki@discuss.tchncs.de ) 
    link
    fedilink
    English
    arrow-up
    7
    ·
    2 years ago

    This isn’t programming, just someone who sucks at bash.

    • zero_spelled_with_an_ecks ( zero_spelled_with_an_ecks@programming.dev ) 
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

      How else are you going to open your files in nano to do the programming on the prod server?

      • Aniki 🌱🌿 ( aniki@discuss.tchncs.de ) 
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 years ago

        what’s a nano?

        • DarkenLM ( DarkenLM@kbin.earth ) 
          link
          fedilink
          arrow-up
          3
          ·
          2 years ago

          A metric prefix that represents 10e-9 of a unit.

        • Appoxo ( Appoxo@lemmy.dbzer0.com ) 
          link
          fedilink
          arrow-up
          1
          ·
          2 years ago

          The beginner (and better) version of vim?

  • antonamo ( antonamo@feddit.org ) 
    link
    fedilink
    Deutsch
    arrow-up
    6
    ·
    2 years ago

    sudo dd if=. /rpi3-aarch64-archlinux.img status=progress of=/dev/sd[tab] [tab] [enter]

  • bitwolf ( bitwolf@lemmy.one ) 
    link
    fedilink
    arrow-up
    5
    ·
    2 years ago

    I remember being so scared the first time I screwed up my $PATH

  • mariusafa ( mariusafa@lemmy.sdf.org ) 
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    guix rollback

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 73 users / day
  • 1.44K users / week
  • 3.14K users / month
  • 7.32K users / 6 months
  • 463 local subscribers
  • 33.4K subscribers
  • 1.52K Posts
  • 25K Comments
  • Modlog
  • mods:
  • Feyter ( Feyter@programming.dev ) 
  • adr1an ( anzo@programming.dev ) 
  • BurningTurtle ( BurningTurtle@programming.dev ) 
  • Pierre-Yves Lapersonne ( pylapp@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code