Ask HN: Can I see your scripts?
Here&#x27;s my script for playing videos in a folder. The command is , (comma)<p>When you download a video from certain sites, ctime is the time you created the file (so the time you downloaded) but the video still comes with a timestamp which is saved as the mtime (I&#x27;m not sure why this happens, maybe there&#x27;s a http header for that?), and I presume it&#x27;s the time when the video was first uploaded to the site?<p>Here&#x27;s a favorite of mine: all my scripts&#x27; -h simply show the source code<p><pre><code>    $ cat $(which ,)
    #!&#x2F;bin&#x2F;sh
    
    #export DRI_PRIME=1
    
    cmd=mpv
    
    param=&#x27;-fs --msg-level=all=no,cplayer=info&#x27;
    filter=&#x27;&#x2F;Playing&#x2F;!d; s&#x2F;^Playing: &#x2F;&#x2F;&#x27;
    
    order=&#x27;%C@&#x27; # by default, order by ctime
    sort=-n     # (which is a numeric sort)
    reverse=-r  # ... show newer videos first
    depth=      # ... and do it recursively
    loop=       # ... without looping
    
    [[ -n $MYT_MUTE ]] &amp;&amp; set -- -u &quot;$@&quot;
    [[ -n $MYT_1 ]] &amp;&amp; set -- -1 &quot;$@&quot;
    [[ -n $MYT_REC ]] &amp;&amp; set -- -r &quot;$@&quot;
    
    while getopts 1rcmsaRnolugh o; do
        case &quot;$o&quot; in
        1) depth=&#x27;-maxdepth 1&#x27;;;  # just the current directory
        r) depth=;;               # recursively
    
            # a video uploaded in 2009 but downloaded in 2015 will have
            # mtime in 2009 and ctime in 2015
        #
        # (note: moving the video to another directory actually bumps
        # the ctime)
    
        c) order=&#x27;%C@&#x27;; sort=-n;;    # order by ctime (download time)
        m) order=&#x27;%T@&#x27;; sort=-n;;    # order by mtime (upload time)
    
        s) order=&#x27;%s&#x27;; sort=-n;;     # order by size
        a) order=&#x27;alpha&#x27;; sort=;;    # order lexicographically
        R) order=&#x27;random&#x27;; sort=-n;; # order at random
    
        n) reverse=-r;; # newer first
        o) reverse=;;   # older first
    
            l) loop=--loop=inf;; # infinite loop
    
        u) mute=--mute=yes;; # no sound
    
        g) filter=; param=;;    # debug
    
        h) ${PAGER-less} &quot;$0&quot;; exit;;
        esac
    done
    shift $((OPTIND-1))
    
    find -L &quot;$@&quot; $depth -mindepth 0 \
         -not -path &#x27;*&#x2F;\.*&#x27; \
         -type f \
         -name &#x27;*.*&#x27; \
         -printf &quot;$order %p\0&quot; \
        | awk &#x27;BEGIN { RS=&quot;\0&quot;; srand() } {
            if ($1 == &quot;random&quot;)
              sub ($1, int(rand()*100000));
            printf &quot;%s\0&quot;, $0
          }&#x27; \
        | sort -z $sort $reverse \
        | sed -zr &#x27;s&#x2F;^[^ ]+ &#x2F;&#x2F;&#x27; \
        | xargs -0 $cmd $loop $mute $param 2&gt;&amp;1 \
        | sed &quot;$filter&quot;
    
    
    #     -exec $cmd {} + | sed &quot;$sed&quot;</code></pre>