• 0 Posts
  • 26 Comments
Joined 2 months ago
cake
Cake day: July 27th, 2026

help-circle




  • SHA1 has a fairly even distribution, it produces 160 bit digests, so each possible variation of a chunk will have a roughly 2-160 probability to hit your hash. Now assuming you have some insane computing device that can do an exahash per hour (that’s 1018 hashes, a lot more than any modern hardware can do), finding one would take around 1.7E+26 years. Now the funniest part. Assuming your chunk is 32KiB large (practically nobody uses such small chunks today, so it’s the best-case scenario), there are 2^(32×210×23)/2160 possible variations of the chunk that would produce your exact hash. That’s roughly 1.1E+78865 fitting chunks with only one being correct. And it takes you 1.7E+26 years to get to just one of them.

    absolutely could be brute forced

    Yea, I wouldn’t say that.


  • Picard mentioned in the other comment is great. If you want a more manual approach, on a Linux machine you can use exiftool to extract the metadata and then use that information to do whatever, e.g. organise them by folders.

    A bit long code block
    $ exiftool -j 救世主.ogg 
    [{
      "SourceFile": "救世主.ogg",
      "FileName": "救世主.ogg",
      "FileSize": "3.4 MB",
      "FileType": "OPUS",
      "FileTypeExtension": "opus",
      "MIMEType": "audio/ogg",
      "OpusVersion": 1,
      "AudioChannels": 2,
      "SampleRate": 48000,
      "OutputGain": 1,
      "Vendor": "Lavf60.9.100",
      "PictureType": "Front Cover",
      "PictureMIMEType": "image/jpeg",
      "PictureDescription": "",
      "PictureWidth": 0,
      "PictureHeight": 0,
      "PictureBitsPerPixel": 0,
      "PictureIndexedColors": 0,
      "PictureLength": 102126,
      "Picture": "(Binary data 102126 bytes, use -b option to extract)",
      "Totaldiscs": 1,
      "Genre": "J-POP",
      "Encoder": "Lavf60.9.100",
      "Releasetype": "single",
      "Album": "救世主",
      "Language": "jpn",
      "Date": "2023-05-07",
      "Title": "救世主",
      "Totaltracks": 1,
      "Artist": "月詠み",
      "Duration": "00:03:20.868000000",
      "TrackNumber": 1,
      "Tracktotal": 1,
      "Disctotal": 1
    }]
    









  • || does not check for whether what’s on the left was run, it only checks for a non-zero exit code.

    In this case the left operand for || is &&, not the rm command. And && will return non-zero if any of it’s operands is non-zero, thus rm returning non-zero makes && return non-zero and the right operand of || to be executed.

    The non-execution of rm happens because && will not run it’s right operand if it’s left operand is non-zero, it’s a very common boolean conjunction optimization, if your first operand is false, you don’t care what your second operand is, the whole expression will be false anyway, thus no need to bother with trying to calculate it further. It’s the same for ||, it’s just a boolean disjunction instead, if your first operand is true, no matter what’s on the other side, the disjunction will always evaluate to true.






  • I entrust you with this horror, go figure out what to blame.

    shutdown-analyze.sh
    #! /usr/bin/env bash
    shutdown_start=$(journalctl -b -1 -u systemd-logind --grep="System is (powering down|rebooting)" --output=cat --no-pager --output-fields=_SOURCE_REALTIME_TIMESTAMP)
    shutdown_start=$((shutdown_start / 1000000))
    units=$(journalctl -b -1 --since=@$shutdown_start --output=cat --no-pager --output-fields=UNIT JOB_TYPE=stop CODE_FUNC=job_emit_start_message)
    
    for u in $units; do
        stopping_start=$(journalctl -b -1 --since=@$shutdown_start -u "$u" --output=cat --no-pager --output-fields=_SOURCE_REALTIME_TIMESTAMP JOB_TYPE=stop CODE_FUNC=job_emit_start_message _SYSTEMD_UNIT=init.scope)
        stopping_end=$(journalctl -b -1 --since=@$shutdown_start -u "$u" --output=cat --no-pager --output-fields=_SOURCE_REALTIME_TIMESTAMP JOB_TYPE=stop CODE_FUNC=job_emit_done_message _SYSTEMD_UNIT=init.scope)
        duration_human=$(systemd-analyze timespan $((stopping_end - stopping_start))us | tail -1 | sed 's/.*: //')
        printf "%s\t%10s %s\n" $((stopping_end - stopping_start)) "$duration_human" "$u"
    done | sort -rn | cut -f 2