gamma

joined 1 year ago
MODERATOR OF
[–] gamma@programming.dev 6 points 5 days ago* (last edited 5 days ago)

Taking courses which involve subjects that you will likely never encounter in the workforce is a thing in every discipline. Most engineers don't need to manually solve differential equations in their day jobs, they just need to know that they exist and will often require numerical solutions.

Getting your hands dirty with the content provides a better understanding when dealing with higher level concepts.

[–] gamma@programming.dev 9 points 4 weeks ago

zsh-syntax-highlighting

There's also a fork called fast-syntax-highlighting, I use it.

[–] gamma@programming.dev 4 points 1 month ago

manually call the others

Yeah, most distros will set up source chains to make things nicer for users.

[–] gamma@programming.dev 1 points 1 month ago* (last edited 1 month ago)

Yeah, I'd write this as a single update script with options to update vimplugins or update pkg or update all.

I see that you want it to be a function so you can get the chdir as a side effect, but mixing that with updating doesn't make sense to me.

[–] gamma@programming.dev 13 points 1 month ago

When in doubt, ~/.zshrc. It's the right choice 99% of the time. Otherwise, there's a chance you fuck up scripts you've installed which assume no shell options have been changed in non-interactive contexts.

[–] gamma@programming.dev 2 points 1 month ago (4 children)

What kind of functions do you write which you share between your scripts? Generally if I'm wanting to reuse a non-trivial function, I extend the functionality of the first script instead.

[–] gamma@programming.dev 11 points 1 month ago* (last edited 1 month ago) (2 children)

Select the color which matches the steps before filenames ((non-)login and (non-)interactive), then follow that arrow the rest of the way. There's more colors in Bash because Bash makes a distinction between remote and local shells.

Another way to look at the same data for Zsh (note: $ZDOTDIR will be used instead of $HOME if it's defined at any step along the way):

File neither interactive login both
/etc/zshenv x x x x
${ZDOTDIR:-$HOME}/.zshenv x x x x
${ZDOTDIR:-$HOME}/.zprofile x x
${ZDOTDIR:-$HOME}/.zshrc x x
${ZDOTDIR:-$HOME}/.zlogin x x
${ZDOTDIR:-$HOME}/.zlogout x x

One confusion on the Bash side of the diagram is that you see branching paths into ~/.profile, ~/.bash_profile and ~/.bash_login. Bash will use for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and execute only the first one that exists and is readable.

[–] gamma@programming.dev 14 points 1 month ago* (last edited 1 month ago) (1 children)

Optional crash reporting was merged. Most of the backlash in the PR is about the significant dependencies (Google's BreakPad) which were pulled in with it.

However, by default Audacity isn't built with it, you need to specify a CMake with the URL to send data to. No distros that I know of enable reporting.

[–] gamma@programming.dev 4 points 1 month ago

Judging purely on the dependencies I see in pacman, nsxiv depends on imlib2, which pulls in a lot of libraries, while imv links to a subset of those libraries directly.

[–] gamma@programming.dev 9 points 2 months ago

CSS is turing conplete.

[–] gamma@programming.dev 1 points 2 months ago* (last edited 2 months ago)

Like a normal horsey, but the square it leaves behind remains on fire, destroying the next piece to land on it.

Only the most recent square it was on remains on fire.

 

The document itself is paywalled like all the POSIX specifications, so here are some highlights courtesy of some comments at HackerNews, especially from a-french-anon.

[–] gamma@programming.dev 1 points 3 months ago (2 children)

That's a latrine. They're talking about a fancy light fixture.

 

A huge part of programming in general is learning how to troubleshoot something, not just having someone else fix it for you. One of the basic ways to do that is by tracing. Not only can this help you figure out what your script is doing and how it's doing it, but in the event that you need help from another person, posting the output can be beneficial to the person attempting to help.

(If your shell isn't listed and you know how to enable tracing, comment below and I'll add it to the table!)

Shell How to enable tracing
Bash set -x or set -o xtrace
Fish set fish_trace on
sh set -x
Zsh set -x or setopt xtrace

Also, writing scripts in an IDE that supports your language. syntax highlighting can immediately tell you that you're doing something wrong.

If an IDE isn't an option and you're using Bash or Sh, you can paste your script into https://www.shellcheck.net/

(Inspired by this post on /r/bash)

view more: next ›