fool

joined 1 year ago
[–] fool@programming.dev 2 points 2 days ago* (last edited 2 days ago)

First thing I'd ever seen on the darknet was this bad boy. (Not that it was a terribly efficient way to get an epub.)

Such a bottom-up book. Almost gave up back then, thinking I wouldn't be able to handle assembly, but then what would the point of reading about the hacker mindset be?

[–] fool@programming.dev 7 points 2 days ago (1 children)

Lmao it's not Lemmy without Linux

~noh8~

[–] fool@programming.dev 2 points 2 days ago

Oh, you're right. You just pass the -d detach flag. I stand corrected!

[–] fool@programming.dev 3 points 3 days ago* (last edited 3 days ago) (1 children)

According to tab autocomplete...

$ git
zsh: do you wish to see all 141 possibilities (141 lines)?

But what about the sub options?

$ git clone https://github.com/git/git
$ cd git/builtin
# looking through source, options seem to be declared by OPT
# except for if statements, OPT_END, bug checks, etc.
$ grep -R OPT_ | grep --invert-match --count -E \
"OPT_END|BUG_ON_OPT|if |PARSE_OPT|;$|struct|#define"
1517

Maybe 1500 or so?

edit: Indeed, maybe this number is too low. git show has a huge amount of possibilities on its own, though some may be duplicates and rewords of others.

$ git show --
zsh: do you wish to see all 489 possibilities (163 lines)?
$ man git-show | col -b | grep -E "^       -" --count
98

An attempt at naively parsing the manpages gives a larger number.

$ man $(find /usr/share/man -name "git*") \
| col -b | grep -E "^       -" -c 
1849

Numbers all over the place. I dunno.

[–] fool@programming.dev 3 points 3 days ago* (last edited 2 days ago) (2 children)

Huh, TIL.

To be fair, git switch was also derived from the features of git checkout in >2.23, but like git restore, the manual page warns that behavior may change, and neither are in my muscle memory (lmao).

I'll probably keep using checkout since it takes less kb in my head. ~~Besides, we still have to use checkout for checking out a previous commit, even if I learn the more ergonomically appropriate switch and restore.~~ No deprecation here so...

edit: maybe I got that java 8 mindset

edit 2: Correction -- git switch --detach checks out previous commits. Git checkout may only be there for old scripts' sake, since all of its features have been split off into those two new functions... so there's nothing really keeping me from switch.

[–] fool@programming.dev 2 points 3 days ago

It probably is, but I think their main point is the protest against the age-old delineation into "GUI vs CLI" camps. I'm not saying that you're elitist, even if your statement might be interpreted as such (it's hard to communicate tone online but the quotations around "their workflow" could appear mocking), but regarding the structure of your statement, I had a "Windows users are all button-presser noobs" phase and would've typed something similar about the Git CLI if time was decently rewound (sans the kindness of a "use what you like" statement). They could be interpreting your statement as a propagation of the anti-GUI stereotyping.

Evidently they prefer GUI but can effectively use the CLI -- no one disagrees that the CLI is more functional.

[–] fool@programming.dev 5 points 3 days ago (1 children)

You prevent them from waking up earlier, huh? Youngsters definitely have infinite energy at the odder times. I sure did my fair share of waking up early to increase the fraction of the day I gamed for.

This is a pretty convincing stance in favor of timers, actually. The idea of transferring video-watching from the iPad to the television is a friendly way to prevent an unchecked iPad-kid situation. My opinion shifted a little. :P

Do you have timers on the iPad for any mobile games, or just YouTube?

[–] fool@programming.dev 2 points 3 days ago (1 children)

Your stance on the age-inappropriate reminds me of what @southsamurai commented! I've definitely seen a lot of "Don't protect your child too hard by concealing the inappropriate from them" lately. I wonder how many modern parents are shifting to that ideal.

"Kids respond well to being treated seriously." (from Vox, "Why safe playgrounds aren't great for kids", 3:17)

You mention that there are some cases where parental controls would help, but you also mentioned that, (1) regarding inapproriacy, you shouldn't baby children and (2) regarding screen time, BananaKing's take is the best route. Doesn't that cover both aspects of where parental controls would be used? What cases would you say parental controls would help with?

[–] fool@programming.dev 4 points 3 days ago

Someone downvoted but I want to hear your differing stance so I upvoted. (Come on fellow lemmings ` . ` let's melting-pot a little!)

Anyway -- your belief is interesting, though I feel like I might disagree! Seems similar to @Contramuffin's upbringing, but more extreme.

How would you train them beforehand? Or would you just drop them into the archetypal sink-or-swim? Don't you think the kid would feel lonely, say, if they stumbled on a jumpscare video and got the heebie-jeebies but you didn't help? Everyone makes mistakes. And outside of scarring -- what if your kid turns into one of those YouTube Kids jockeys?

Is your hypothetical "Tough shit, deal with it and get stronger" approach similar to how you were raised?

[–] fool@programming.dev 4 points 3 days ago* (last edited 3 days ago)

Click to view diffs is super ergonomic; on the other hand, I actually have a story about the Git CLI trumping the GUI (spoiler: reflog).

In high school we had gotten the funding to build a robot, and one of the adults in charge -- guy was brilliant -- was using GitHub Desktop to conduct a feature merge with the student who served as team lead. The thing was, he was used to older codebases, so all of his experience was with CVS instead of Git -- so when the two slightly messed up the git merge, they discussed recloning everything instead of wasting time plumbing the error (relevant xkcd).

That was one of the earliest times I had the cajones to walk up to a superior and say "No, you're doing this totally wrong. You don't have to do that."

He looked at me and nodded. "What would you do instead?"

"Reflog."

"Reflog? I've never heard of it before. Can you show us?"

I hopped onto the laptop and clicked around GitHub Desktop, but couldn't manage to find any buttons related to reflog... so I went straight to cmd.exe instead.

git reflog
git reset --hard "HEAD@{7}"

"Done. We can continue rebasing."

And after that, the advisor complimented me for using the command line tool!

"Lots of GUI apps are just limited frontends to the real meat and potatoes, the command line. Nice job!"

I felt like a wizard! And so I became the team's Git-inator.

edit: pruned story

[–] fool@programming.dev 20 points 3 days ago

That makes a lot of sense! Definitely much less friction in that approach -- clearly delineated boundaries, decently low pressure, and secure trust without the ethical quandary.

...don't attempt technical solutions to administrative problems.

Good advice.

[–] fool@programming.dev 4 points 3 days ago (1 children)

Thanks for the in-depth response!

My parents "let health class do the job" and kept their eyes closed -- regarding porn -- so your punishmentless one-on-ones are new and interesting to me. Trust is definitely the most vital here.

 

I saw a post recently about someone setting up parental controls -- screentime, blocked sites, etc. -- and it made me wonder.

In my childhood, my free time was very flexible. Within this low-pressure flexibility I was naturally curious, in all directions -- that meant both watching brainteaser videos, and watching Gmod brainrot. I had little exposure to video games other than Minecraft which ran poorly on my machine, so I tended to surf Flash games and YouTube.

Strikingly, while watching a brainteaser video, tiny me had a thought:

I'm glad my dad doesn't make me watch educational videos like the other kids in school have to.

For some reason, I wanted to remember that to "remember what my thought process was as a child" so that memory has stuck with me.

Onto the meat: if I had had a capped screentime, like a timer I could see, and knew that I was being watched in some way, I'd feel pressure. For example,

10 minutes left. Oh no. I didn't have fun yet. I didn't have fun yet!!

Oh no, I'm gonna get in so much trouble for watching another YTP...

and maybe that pressure wouldn't have made me into an independent, curious kid, to the person I am now. Maybe it would've made me fearful or suspicious instead. I was suspicious once, when one of my parents said "I can see what you browse from the other room" -- so I ran the scientific method to verify if they were. (I wrote "HI MOM" on Paint, and tested if her expression changed.)

So what about now? Were we too free, and now it's our job to tighten the next generation? I said "butthead" often. I loved asdfmovie, but my parents probably wouldn't have. I watched SpingeBill YTPs (at least it's not corporatized YouTube Kids).

Or differently: do we watch our kids without them knowing? Write a keylogger? Or just take router logs? Do we prosecute them like some sort of panopticon, for their own good?

Or do we completely forgo this? Take an Adventure Playground approach?

Of course, I don't expect a one-size-fits-all answer. Where do you stand, and why?

 

Git cheat sheets are a dime-a-dozen but I think this one is awfully concise for its scope.

  • Visually covers branching (WITH the commands -- rebasing the current branch can be confusing for the unfamiliar)
  • Covers reflog
  • Literally almost identical to how I use git (most sheets are either Too Much or Too Little)
74
submitted 2 weeks ago* (last edited 2 weeks ago) by fool@programming.dev to c/linux@lemmy.ml
 

What was your last RTFM adventure? Tinker this, read that, make something smoother! Or explodier.

As for me, I wanted to see how many videos I could run at once. (Answer: 60 frames per second or 60 frames per second?)

With my sights on GPUizing some ethically sourced motion pictures, I RTFW, graphed, and slapped on environment variables and flags like Lego bricks. I got the Intel VAAPI thingamabob to jaunt by (and found that it butterized my mpv videos)

$ pacman -S blahblahblahblahblahtfm
$ mpv --show-profile=fast
Profile fast: 
 scale=bilinear
 dscale=bilinear
 dither=no
 correct-downscaling=no
 linear-downscaling=no
 sigmoid-upscaling=no
 hdr-compute-peak=no
 allow-delayed-peak-detect=yes
$ mpv --hwdec=auto --profile=fast graphwar-god-4KEDIT.mp4
# fucking silk

But there was no pleasure without pain: Mr. Maxwell F. N. 940MX (the N stands for Nvidia) played hooky. So I employed the longest envvars ever

$ NVD_LOG=1 VDPAU_TRACE=2 VDPAU_NVIDIA_DEBUG=3 NVD_BACKEND=direct NVD_GPU=nvidia LIBVA_DRIVER_NAME=nvidia VDPAU_DRIVER=nvidia prime-run vdpauinfo
GPU at BusId 0x1 doesn't have a supported video decoder
Error creating VDPAU device: 1
# stfu

to try translating Nvidia VDPAU to VAAPI -- of course, here I realized I rtfmed backwards and should've tried to use just VDPAU instead. So I did.

Juice was still not acquired.

Finally, after a voracious DuckDuckGoing (quacking?), I was then blessed with the freeing knowledge that even though post-Kepler is supposed to support H264, Nvidia is full of lies...

 ______
< fudj >
 ------
          \   ‘^----^‘
           \ (◕(‘人‘)◕)
              (  8    )        ô
              (    8  )_______( )
              ( 8      8        )
              (_________________)
                ||          ||
               (||         (||

and then right before posting this, gut feeling: I can't read.

$ lspci | grep -i nvidia
... NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
# ArchWiki says that GM108 isn't supported.
# Facepalm

SO. What was your last RTFM adventure?

60
submitted 4 months ago* (last edited 3 months ago) by fool@programming.dev to c/linux@lemmy.ml
 

I have a little helper command in ~/.zshrc called stfu.

stfu() {
    if [ -z "$1" ]; then
        echo "Usage: stfu <program> [arguments...]"
        return 1
    fi

    nohup "$@" &>/dev/null &
    disown
}
complete -W "$(ls /usr/bin)" stfu

stfu will run some other command but also detach it from the terminal and make any output shut up. I use it for things such as starting a browser from the terminal without worrying about CTRL+Z, bg, and disown.

$ stfu firefox -safe-mode
# Will not output stuff to the terminal, and
# I can close the terminal too.

Here’s my issue:

On the second argument and above, when I hit tab, how do I let autocomplete suggest me the arguments and command line switches for the command I’m passing in?

e.g. stfu ls -<tab> should show me whatever ls’s completion function is, rather than listing every /usr/bin command again.

# Intended completion
$ stfu cat -<TAB>
-e                      -- equivalent to -vE                                                                                                                                                     
--help                  -- display help and exit                                                                                                                                                 
--number            -n  -- number all output lines                                                                                                                                               
--number-nonblank   -b  -- number nonempty output lines, overrides -n                                                                                                                            
--show-all          -A  -- equivalent to -vET                                                                                                                                                    
--show-ends         -E  -- display $ at end of each line                                                                                                                                         
--show-nonprinting  -v  -- use ^ and M- notation, except for LFD and TAB                                                                                                                         
--show-tabs         -T  -- display TAB characters as ^I                                                                                                                                          
--squeeze-blank     -s  -- suppress repeated empty output lines                                                                                                                                  
-t                      -- equivalent to -vT                                                                                                                                                     
-u                      -- ignored  

# Actual completion
$ stfu cat <tab>
...a list of all /usr/bin commands
$ stfu cat -<tab>
...nothing, since no /usr/bin commands start with -

(repost, prev was removed)

EDIT: Solved.

I needed to set the curcontext to the second word. Below is my (iffily annotated) zsh implementation, enjoy >:)

stfu() {
  if [ -z "$1" ]; then
    echo "Usage: stfu <program> [arguments...]"
    return 1
  fi

  nohup "$@" &>/dev/null &
  disown
}
#complete -W "$(ls /usr/bin)" stfu
_stfu() {
  # Curcontext looks like this:
  #   $ stfu <tab>
  #   :complete:stfu:
  local curcontext="$curcontext" 
  #typeset -A opt_args # idk what this does, i removed it

  _arguments \
    '1: :_command_names -e' \
    '*::args:->args'

  case $state in
    args)
      # idk where CURRENT came from
      if (( CURRENT > 1 )); then
        # $words is magic that splits up the "words" in a shell command.
        #   1. stfu
        #   2. yourSubCommand
        #   3. argument 1 to that subcommand
        local cmd=${words[2]}
        # We update the autocompletion curcontext to
        # pay attention to your subcommand instead
        curcontext="$cmd"

        # Call completion function
        _normal
      fi
      ;;
  esac
}
compdef _stfu stfu

Deduced via docs (look for The Dispatcher), this dude's docs, stackoverflow and overreliance on ChatGPT.

EDIT: Best solution (Andy)

stfu() {
  if [ -z "$1" ]; then
    echo "Usage: stfu <program> [arguments...]"
    return 1
  fi

  nohup "$@" &>/dev/null &
  disown
}
_stfu () {
  # shift autocomplete to right
  shift words
  (( CURRENT-=1 ))
  _normal
}
compdef _stfu stfu
view more: next ›