Tyrel's Blog

Code, Flying, Tech, Automation

Sep 26, 2023

Which which is which?

I had a bit of a "Tyrel you know nothing" moment today with some commandline tooling.

I have been an avid user of ZSH for a decade now, but recently I tried to swap to fish shell. Along the years, I've maintained a lot of different iterations of dotfiles, and shell aliases/functions. I was talking to a friend [citation needed] about updating from exa to eza and then noticed I didn't have my aliases loaded, so I was still using ls directly, as I have alias ls="exa -lhFgxUm --git --time-style long-iso --group-directories-first" in my .shell_aliases file.

I did this by showing the following output:

$ which ls
/usr/bin/ls

Because I expected it to show me which alias was being pointed to by ls.

My friend pointed out that "Which doesn't show aliases, it only points to files" to which I replied along the lines of "What? No way, I've used which to show me aliases and functions loads of times."

And promptly sent a screenshot of my system NOT showing that for other aliases I have set up. Things then got conversational and me being confused, to the point of me questioning if "Had I ever successfully done that? Maybe my macbook is set up differrently" and went and grabbed that.

Friend then looked at the man page for which, and noticed that there's the --read-alias and --read-functions flags on which, and I didn't have those set. I then swapped over to bash "Maybe it's a bash thing only? I'm using Fish".

Nope, still nothing! Then went to google, and it turns out that ZSH is what has this setup by default. Thank you "Althorion" from Stackoverflow for settling my "Yes you've done this before" confusion.

It turns out that ZSH's which is equivalent to the ZSH shell built-in whence -c which shows aliases and functions.

After running /usr/bin/zsh and sourcing my aliases (I don't have a zshrc file anymore, I need to set that back up), I was able to settle my fears and prove to myself that I wasn't making things up. There is a which which shows you which aliases you have set up, which is default for ZSH.

$ which ls
ls: aliased to exa -lhFgxUm --git --time-style long-iso --group-directories-first
 · · ·  linux  macos  zsh

Jun 19, 2023

Jun 08, 2023

Netgear WAC104

I recently bought four Netgear WAC104 devices, and am flashing OpenWRT onto them. I have struggled a lot to get the firmware on, due to the not great interface they provide.

The issue is, that it prompts you to change the password, but then when you change it on the page you land on, nothing connects anymore and you can't access the router.

The solution is to click "Set Password" in the Administration menu on the left, and set it there. Even though there is a prompt to set the password on every page, that will change other settings too and break things.

The router isn't great, and the software is awful so thats why I'm installing OpenWRT anyway.

Two down, two more to go!

 · · ·  networking

Jun 07, 2023

pfSense

This week I finally got a machine that is solely to run pfSense. I didn't want to spend _too_ much money so I bought a $200.00 Qotom Firewall Q330G4. This was great and easy to set up.

First I bought a Netgear WAC104 and installed OpenWRT on it. Simple enough. Then I put that into bridge mode, so it's just an Access Point and not a "smart" router too.

Then I put my Linksys EA9300 into bridge mode and behind the pfSense machine (into a switch) and couldn't access any of my server's sites.

After futzing with that for a couple days, I finally figured out the problem. I thought I was behind a double NAT, but I wasn't. When I moved my EA9300 from my sole WiFi router, to behind the pfSense machine, I neglected to change some settings on my AT&T modem.

You see — dear reader— when I set up this network on my AT&T Modem, I had to enable Passthrough mode. This, was set to a MAC Address, not an IP Address. So when I was making sure to keep my IP network on the same 192.168.1.1/24, I thought that was all I needed.

Alas, there's a dropdown to pick the MAC address of the machine that everything passes through. I can now access my bookmarks, notes, ebooks, and plex server!

Thanks to my friend Daniel (@sanitybit) - who was a great rubber duck and gave me some pointers when I was debugging, and also helped me find the hardware for the pfSense box!

 · · ·  networking
Next → Page 1 of 8