Monday, September 11, 2023

Updated Terminal Setup

 I used to think I knew what I was doing. I thought using Fish as my Terminal was the right choice because people said it was "Mac-like" or whatever. For what I do day-to-day doesn't matter that much so it really just adds complexity because nobody gives examples in for Fish really at all and it means I have to build things myself. So I'm switching to Zsh.

  • Install iTerm. I haven't found any reason to try anything else. Download it from their website. That's how they want you to consume it.
  • It already comes defaulting to Zsh so you shouldn't have to do anything. Use " > echo $0 " to confirm the shell you are using.
  • Install Homebrew so you can get all the good linux things you need. Copy/paste the curl command and let it ride. Trust the systems.
  • You need Git because everything else uses it so get it early. " > brew install git " and celebrate.
  • Install Oh My Zsh by copy/pasting the curl command.
  • Download and install the Hack Nerd Font from Nerd Fonts. There isn't an easy way to get this from Homebrew yet so sticking to direct downloads is the most reliable. Installing 
  • Edit the iTerm Profile so it uses the new Font. Bump the size up to 14. Set the color scheme to "Smoooooth".
  • Update your ~/.zshrc file to use the clean Zsh theme.
I think that's it. My terminal is ready to rock and roll.

Sunday, September 6, 2020

Macvlan bridge STILL doesn't work for Wifi

Got my new Raspberry Pi 4 and I installed the 64-bit Raspberry Pi OS and was playing with Docker.

I was having problems getting macvlan working. I struggled. I reinstalled. Nothing seemed to work. On a whim I looked to see if this might just be a problem with me experimenting with bare bones installs so googled a couple things and found the Blog from Barry Kauler titled Macvlan bridge does not work for wifi. Sure enough. If you try and share the connection with wlan0 instead of eth0 it just doesn't work.

So I plugged it in and forced it to use eth0 and sure enough now everything works as expected. 

Thanks Barry!

Saturday, September 5, 2020

Update Firmware on Prusa MK2 through MK3S from OctoPrint/OctoPi

The tools and instructions that Prusa gives you to update your firmware are really good unless your printer is attached to a remote Linux box then it's a little problematic. So here you go. This is pretty barebones because it is written for me.

Required Reading:

Your printer is probably on /dev/ttyACM0 but if it isn't it should really matter. The system should work anyway because it is preselected.

The official tooling is really just a wrapper around AVRDUDE so doing it on your own shouldn't make you nervous.

The control unit on the MK2, MK2S, MK2.5, MK2.5S, MK3 and MK3S are all based on the ATmega2560.

Instructions: 

SSH into your OctoPrint box and install AVRDUDE. Probably sudo apt install avrdude but depending on your OS it might be different. You'll want to know the exact path of your install so which avrdude will give you that info. 

Using the Plugin Manager in OctoPrint install Firmware Updater. It is an officially supported plugin so it is easy to find it.

After OctoPrint forces a restart open up the Firmware Updater plugin and click the wrench inside the plugin box to configure the plugin. Enter the data below and hit Save.

  • Flash Method: avrdude
  • AVR MCU: ATmega2650
  • Path to avrdude: /usr/bin/avrdude (that's probably what it is, but step 1 would confirm)
  • AVR Programming Type: wiring

Go download the firmware for your printer here. The download is pretty big because it contains multilingual instructions that you are going to ignore. https://www.prusa3d.com/drivers/

Extract the prusa3d_fw_ABC_123.hex file some where you can find it and using the Firmware Updater plugin hit that Browse button to locate your hex file and the Flash From File button to finalize things.

Friday, August 14, 2020

My Mac Terminal Setup (Homebrew, iTerm2, Fish, )

I did this twice in 2 weeks, so I've got a feel for what I like now and the least sucky way to do it. If I did it more often I'd probably write a script for it, but since I don't plan to do this for another 2 years here's a quick blog. Including sources so that if things change you can find them yourself and you don't have to trust this blog.

First install brew because having a *nix computer without up to date versions of things sucks. (source)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Now install iTerm2 because even if you don't end up using it's features you might some day so you may as well use it instead of the default terminal. (source)

brew cask install iterm2 

iTerm2 should be in your Applications folder, open it up as your new terminal. 

Now install fish because it's the shell script that makes the most sense to me. It comes configured out of the box closer to what I want so I use it. (source)

brew install fish

Now add fish to your list of allowable shells and make fish your default shell.

echo "/usr/local/bin/fish" | sudo tee -a /etc/shells

chsh -s /usr/local/bin/fish

I don't know if I have enough of an opinion to care, but Oh My Fish and Fisher are both ways to get more out of fish. I installed Oh My Fish because it seemed to be the thing more people are using. Fisher is probably the correct tool for what I need, but whatever. (source)

curl -L https://get.oh-my.fish | fish

Now install bobthefish because it is a good theme that supports stuff like git out of the box. (source)

omf install bobthefish

That theme might throw some odd characters at us because it looks cool, so you need a font that will keep up. The font called Hack looks he most like I expect a font to look, so I use the version supplied via Nerd Fonts. (source)

brew tap homebrew/cask-fonts

brew cask install font-hack-nerd-font

Now you have to go into your iTerm preferences and select the new font.

As long as you are in the preferences menu you should find a color scheme that you like. I really couldn't find something I liked a lot but Smoooooth was the one I disliked the least so I went with it.

Saturday, January 19, 2019

Automatically Mount USB Drive in Raspbian

This blog is mostly information for myself but maybe the powers of google will bless you with this search result. If you use Raspbian for only command line USB devices don't mount automatically.
Luckily the process to get it to work is pretty easy.
Unfortunately there are lots of documented processes that aren't very good. You should use a udev rule for this not any of the other funky junk.

You should be able to do most of this by installing the usbmount package (https://github.com/rbrito/usbmount) but it doesn't always work perfectly out of the box so I've been sticking to this solution because it has always worked for me.

The biggest piece is to use this automount rule from Axllent.org

Create a file /etc/udev/rules.d/11-media-by-label-auto-mount.rules that contains the following.

 KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"   
 # Import FS infos   
 IMPORT{program}="/sbin/blkid -o udev -p %N"   
 # Get a label if present, otherwise specify one   
 ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"   
 ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"   
 # Global mount options   
 ACTION=="add", ENV{mount_options}="relatime"   
 # Filesystem-specific mount options   
 ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"   
 # Mount the device   
 ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"   
 # Clean up after removal   
 ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"   
 # Exit   
 LABEL="media_by_label_auto_mount_end"  

Edit the udev config:  sudo nano /lib/systemd/system/systemd-udevd.service 
Comment out the last 7 lines and everything works normally. Comment below if you actually know what these do. Otherwise I'm not terribly worried.

 #KillMode=mixed  
 #WatchdogSec=3min  
 #TasksMax=infinity  
 #MountFlags=slave  
 #MemoryDenyWriteExecute=yes  
 #RestrictRealtime=yes  
 #RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6  

Restart udev with the command:  sudo udevadm control --reload-rules
Restart the box with the command command:  sudo reboot

Saturday, November 10, 2018

iPhone XS and iPhone XR Black Friday Deals 2018

Sam's Club Member Event
Stores Open 7am on Saturday, November 10, 2018

$300 Gift Card with Activation & Payment Plan (AppleCare required for Payment Plan?)
iPhone 8, 8+, X, XS, XS Max, XR

Target Black Friday Circular
Stores Open 5pm on Thanksgiving

$150 Gift Card with Activation (requiring Payment Plan?)
iPhone 8, 8+, X

$250 Gift Card with Activation (requiring Payment Plan?)
iPhone XS, XS Max

Best Buy Black Friday Ad
Stores Open 5pm on Thanksgiving

"Up to" $150 Gift Card with Activation (requiring Payment Plan?)
iPhone XR, XS XS Max

Walmart Black Friday Ad
Stores Open 6pm on Thanksgiving

$400 Gift Card with Activation & Payment Plan
iPhone 8, 8+, X

$300 Gift Card with Activation & Payment Plan
iPhone XR, XS XS Max

Tuesday, February 6, 2018

Docker for Script Kiddies


Do you want to easily write some code and run it and not foul up your normal desktop with funky environment variables or versions of scripting languages that aren't officially supported? Yes.

Do you want to use Docker because it is the cool thing that all the other kids are running now? Yes.

Alpine Linux is built to be super super small so it is perfect for things like Docker where you might have a lot of your systems running in parallel. So I build my examples on top of Alpine Linux because why not. I picked the "most popular" programming languages that can be easily installed in vanilla Alpine Linux. This means that Go,  Java, and C# are left out because Alpine Linux uses musl instead of gnu libc and that's not something easily supported out of the box (much respect for Rust for supporting this).

So here are all my GitHub repos with some basic shell scripts for you to run so you can see a HelloWorld run in the languages that are easily supported in vanilla Alpine Linux

GitHub Repos

File Size Comparison

Of all the ways to measure a programming language probably the worst way is to compare the file size needed on disk to get a Hello World program running. But it was easy to do so I went ahead and did it. The base Alpine Linux weighs in at 4.15MB so everything else is on top of that.
  • COMPILER: GCC 6.4.0
    • SIZE: 100MB
  • COMPILER: G++ 6.4.0
    • SIZE: 152MB
  • LANGUAGE: Node.js v8.9.3
    • SIZE: 50.2MB
  • LANGUAGE: PHP 7.1.12
    • SIZE: 14.2MB
  • LANGUAGE: Python 2.7.14
    • SIZE: 44.3MB
  • LANGUAGE: Python 3.6.3
    • SIZE: 55.4MB
  • LANGUAGE: Ruby 2.4.3
    • SIZE: 20.4MB
  • LANGUAGE: Rust 1.22.1
    • SIZE: 267MB