This time, in Miscellaneous Findings, we’ve got some command line things, plus a huge Raspberry Pi setup dump, with some related stuff about hard drives and filesystems mixed in.
This is a roundup of miscellaneous things that I’ve found out about (or have rediscovered). I take notes on findings regularly, and I put the findings that translate well to speech on my podcast, Small Findings. The rest (which are often technical findings), I put here. They’re not always written up for maximum comprehension as a blog post, but if anything is hard to understand, please email me if you need clarification.
It’s surprisingly nice to read. e.g.:
Jim Kang (54): Hacked up Field. Have a minimally viable TypeScript rollup config. Add make target and rollup config for working on a small piece of the app independetly. Renaming again. Start basic card layout. Start move to svelte. Get watch working. Convert card to svelte component. Move experiments to vats. Stub out stores vat. Type checking finally working in Svelte components?? Next: Single multi-page rollup config for vats. Get multiple rollup configs to work. Start stores. Bind to card store in component. Drop unneeded crud. Stub in all cards store. Start persisting to localStorage in stores. Hack in a delete. Move persistent state stuff into state, take that out of the stores to make them responsible for mostly notifying subscribers. Start an export cards component. Start import component. Reporting conflicts but not doing anything with them yet. Fix wrong set of cards being imported (cards from file, not the ones already in the store), enable Card component to render read-only.
Excluding dirs from find
Say you want to find all of the directories in which you have a
You could try
find . -name rollup.config.js
But that would also search all of the
node_modules directories, and you mean to find projects in which you’ve used rollup directly.
You can add
-not to exclude them from the search:
find . -name rollup.config.js -and -not \( -path '*/node_modules/*' \) -prune
#search #unix #command #find
Raspberry Pi setup
With a pre-loaded Canakit boot SD card inserted:
- Connect keyboard, mouse, and display, then power.
- Pick your wifi network in the wizard.
- Select “Raspbian Stretch” as the OS to install in the wizard.
- Open terminal and change password for
- [Get a Raspberry Pi OS image onto an SD card]
- Hook it up to a TV or display with an HDMI cable
- Connect a mouse and keyboard
- Connect a power supply
- Create an empty file in
sudo touch /boot/ssh.
- On another computer:
arp -aor (sudo nmap -sn [ROUTER-IP]/24 | grep -i raspberry -B 2)
- SSH in with the user pi
cd ~ && install -d -m 700 ~/.ssh
- Creates the .ssh dir with the right permissions.
- From a computer where you already have your public key:
cat ~/.ssh/id_rsa.pub | ssh <USERNAME>@<IP-ADDRESS> 'cat >> .ssh/authorized_keys'
/etc/ssh/sshd_configwith these settings:
ChallengeResponseAuthentication no PasswordAuthentication no UsePAM no
sudo /etc/init.d/ssh reload
External USB hard drive
- Connect the hard drive to the Pi
- Make sure the HD appears on /sda1 and /sda2
- Format it.
sudo fdisk /dev/sdato enter interactive fdisk. Reference
d(I think) to delete the /sda1 and /sda2 partitions.
nto create a new big partition that spans the whole HD. Accept defaults.
wto commit this.
- Set up automatic mounting.
sudo vi /etc/fstab. Add the line: -
/dev/sda1 /mnt/storage ext4 defaults,nofail 0 0
- (Manual mounting would go like this:
sudo mkdir /mnt/usb && sudo mount /dev/sdb1 /mnt/usb, unmount:
sudo umount /dev/sdb1)
nofailis what lets the OS boot even if the HD is not plugged in.
- (Manual mounting would go like this:
- If the HD looks like it has nothing on it after a power outage
If you use a vfat filesystem, I don’t think you can change owners?
The consequences of this is that everything is owned by root, and everything, including rsync, must run as root.
Also also wildcards only go so far if they are in the middle of a specification.
ls sm*.js will work, but
ls smi*.js will not.
Warning: If you reformat your external drive, you may not be able to boot, even if you have
nofail in the fstab entry! It happented to me.
Changing the wifi password
- Edit /etc/wpa_supplicant/wpa-supplicant.conf
- Change the
pskvalue under the
Getting a static ip on the WiFi
The following steps from Raspberry Pi static ip worked:
- Get the router ip from
ip r | grep default(It’s the first ip listed.)
cat /etc/resolv.confto get the nameserver ip.
Add this to
interface wlan0 static ip_address=<desired ip>/24 static routers=<router ip> static domain_name_servers=<router ip> 126.96.36.199
You can substitute an external DNS server ip in
Turning off the wifi
/boot/config.txt to add this line:
root user does not have a password by default. You can give it a password, but the
pi user can sudo, so using
sudo su may be easier.
sudo apt update
sudo apt install apt-transport-https ca-certificates curl
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
sudo apt update
sudo apt install plexmediaserver
sudo systemctl status plexmediaserver
Set up dirs
sudo mkdir -p /mnt/smidgeocloud/plexmedia
sudo chown -R plex /mnt/smidgeocloud/plexmedia(But not for a FAT drive)
- Config in browser at http://server-ip:32400/web
I somehow ended up with
music in the media directory being owned by the
503 user, which prevented the
pi user from creating dirs there.
drwxrwxr-x 587 503 staff 20480 Mar 27 01:52 music
I chmodded it to pi.