refresher on jq

jq is an awesome tool for parsing JSON. Today I was searching for an AMI via the aws cli and was able to get a bunch of JSON back from:

aws ec2 describe-images \
    --region us-west-2 \
    --filters "Name=name,Values=amazon-eks-node-1.16*"

I was looking for the most recent release and noticed that the CreationDate in the AMI listings was not sorted. No biggie, right? We’ll just break out jq for some quick cleanup.

aws ec2 describe-images \
    --region us-west-2 \
    --filters "Name=name,Values=amazon-eks-node-1.16*" \
| jq '.Images|=sort_by(.CreationDate)'

Okay now we have the AMI listings in JSON sorted by CreationDate, but there’s an awful lot of info to sift through still.

I decided to just grab the Name and Description fields to make it easier to see the differences between these AMIs:

aws ec2 describe-images \
    --region us-west-2 
    --filters "Name=name,Values=amazon-eks-node-1.16*" \
| jq '.Images|=sort_by(.CreationDate)|.Images[]|.Name,.Description'

and by tacking on the |.Name,.Description to the end of the jq expression, we’re now filtering out the info I needed!

"amazon-eks-node-1.16-v20200423"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.8, docker:18.09.9ce-2.amzn2)"
"amazon-eks-node-1.16-v20200507"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.8, docker:18.09.9ce-2.amzn2)"
"amazon-eks-node-1.16-v20200531"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.8, docker:18.09.9ce-2.amzn2)"
"amazon-eks-node-1.16-v20200609"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.8, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200618"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.8, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200709"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.12, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200710"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.12, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200723"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.13, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200814"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.13, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200821"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.13, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200904"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.13, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20200921"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.13, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20201002"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.13, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20201007"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.13, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20201112"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20201117"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20201126"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker:19.03.6ce-4.amzn2)"
"amazon-eks-node-1.16-v20201211"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker: 19.03.6ce-4.amzn2, containerd: 1.4.1-2.amzn2)"
"amazon-eks-node-1.16-v20210112"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker: 19.03.6ce-4.amzn2, containerd: 1.4.1-2.amzn2)"
"amazon-eks-node-1.16-v20210125"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker: 19.03.6ce-4.amzn2, containerd: 1.4.1-2.amzn2)"
"amazon-eks-node-1.16-v20210208"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker: 19.03.6ce-4.amzn2, containerd: 1.4.1-2.amzn2)"
"amazon-eks-node-1.16-v20210302"
"EKS Kubernetes Worker AMI with AmazonLinux2 image, (k8s: 1.16.15, docker: 19.03.13ce-1.amzn2, containerd: 1.4.1-2.amzn2)"

youtube-dl to download audio

You can use youtube-dl to download only the audio of a given youtube video’s URL.

Check the available formats of the video with the -F flag:

youtube-dl -F <video_url>

Some of the formats available will have “audio only” indicated in the listing.

Once you have the format number you would like to download use the -f to perform the actual download:

youtube-dl -f <format_number_id> <video_url>

Internet access from an RV?

A lot of friends have asked us how we are able to access the web while we’re traveling around in an RV. When we started, this was a major concern for us. We booked our “break-in” trip at a local park in San Antonio, and learned the hard way that RV Parks do not typically offer great wifi.

Cell Data on our phones

We tried using the cell data from our Google Fi phone plans, but we chewed through the 20GB of data that came with our plans. After you use 20GB of data on Google Fi, they throttle you down to 256kbps. This is incredibly slow compared to typical 4G/5G speeds, but was surprisingly good enough for my development work. (logging into remote servers and working on the command line) Video calls were definitely out though.

Why are cell data plans still so expensive?

Aside from the bandwidth cap, we also had signal problems with T-Mobile anytime we left town. Most of our campsite destinations have been out in the boonies, so I set out to do more research. It turns out there’s really not a single great solution to this problem. AT&T and Verizon appear to provide the best coverage, but in different areas of the country. Verizon seemed to provide stronger coverage in the areas that we wanted to travel so I dug into pricing and plan details and was blown away. Anytime you see the word “unlimited” on modern cell phone plans, just pretend an asterisk is missing. Much the same as our Google Fi data plan, Verizon offers plans up to 30GB of full speed data transfer and then throttles connectivity to 600kbps. The throttled speed is far better than Fi, and the network coverage is also waaay better, but the cost is 2 to 3 times what we’ve been spending.

Reseller plans FTW!

So we know there’s a better option, but there’s a cost problem. I started considering that there are a lot of MVNOs reselling larger cellular networks under a different brand (e.g. MetroPCS or Boost reselling the T-Mobile network, or Pure Talk or Cricket reselling the AT&T network) and found Visible reselling the Verizon network. We would have to buy new, compatible, phones though. What seemed more ideal would be to get some hotspots that we could plug some antennas into to improve tower signal. Visible is definitely still on our radar, but I need to look into them further before switching away from the Google Fi goodness.

Things looked a little shady (too good to be true) on ebay when I found some truly unlimited Verizon data plan offerings from resellers for $60 per line per month. We would have to purchase our own hotspots and then plug in the sim and hope that it all worked. I’m working to be more optimistic and I figured it wasn’t a huge amount of money so I took a gamble and signed up! I bought some Verizon 8800L hotspots used on ebay for much less than retail. The sims arrived quickly and I was able to follow the simple instructions from the reseller to configure the hotspots. Here I am 6 months later with the same setup and we’re pretty happy with it.

Better signal

These Verizon 8800L hotspots have TS-9 antenna connector prongs. This allows us to connect to MIMO (multiple input/output for higher bandwidth) 4G antennas (like this one from Netgear) to improve our line of sight to close cell towers. Opensignal makes a great smartphone app that points the direction to the nearest cell tower. There’s also https://www.cellmapper.net/map that displays cell towers on a map so you can try pointing at other towers if the closest one doesn’t pan out.

Pros of using this setup:

  • This has been significantly cheaper than using Verizon
  • We’re able to use this hotspot setup to provide internet to all of our devices
  • Sharing internet from phones over wifi drained our cell batteries really quickly. The hotspots seem to last the majority of the day before needing a charge

Cons:

  • It’s not always convenient to carry arround and keep an extra device charged
  • Even with all of this setup, we still have internet connectivity problems at certain locations. Depending on what our work schedule looks like, we’ve needed to skip some of the better looking options and relocate to areas with better cell coverage.

Improvements; “one day we’ll….”

We have a Weboost 4G cell signal booster with an omnidirectional OTR antenna, but it honestly only works well when we’re driving over flat terrain. We’ve not had as much luck with it in the mountains. And of course, if you’re out of range for cell tower connectivity, there’s not much you can do except relocate. We’re considering getting a Weboost antenna pole that would attach to the side of the RV when camped out, to improve our signal in very remote places. If we go this route, I believe we’ll end up getting a stronger MIMO antenna (like a Poyning XPOL) to mount. (These would be a significantly larger investment than we’ve made so far though)

The Anne Pro 2 mechanical keyboard is awesome

Santa brought me an Anne Pro 2 keyboard for Christmas, and it’s awesome!

Love this mechanical keyboard!

This is my first 60% keyboard, and I’m really liking it so far. Most the keys I use on a regular basis are either directly available. There are a few keys that require an FN key combo though, so a little bit of muscle memory touch up. Overall, I think it’s well worth the saved space while we’re travelling. I opted for Cherry MX brown switches + some rubber o-rings to quiet some of the mechanical noise while not sacrificing the tactile feedback.

Bonus: I’ve been using it with my ipad via bluetooth also. <3

new mattress on the cheap!

We’ve been full time RV’ing for about 6 months now and found ourselves in need of upgrading our bed. The cushions that came with the RV quickly deflated and even the mattress topper we setup was simply not offering enough cushion. We started looking around and found plenty of options on Amazon….and then I rememebered that Costco sells mattresses in store. After doing some research online, we finally made a trip to Costco for a serious sleep upgrade!

https://www.costco.com/simmons-8%22-medium-gel-memory-foam-mattress.product.100535894.html

In store it was was $199 minus a temporary promotion $40 off. When we factored in how great Costco’s return policy is, it was a no brainer to give them a shot before ordering anything from Amazon.

We’ll see how it turns out.

pretty printing xml

tidy is a nice CLI tool that can be used to pretty up some XML

I was interested in reviewing the raw format of CNN’s rss feed. tidy made it a lot easier to grok the structure of the XML:

curl http://rss.cnn.com/rss/cnn_latest.rss 2>&1 | tidy -xml -iq
  • -xml — specify the input is well formed xml
  • -i — auto indent
  • -q — quiet: don’t display tool comments

before
after

Getting more battery from Windows

With CPU clock speeds and core counts both reaching new highs, everyone seems to want more performance out of their PC. I set out to do the exact opposite today: I want to get bettery battery life by killing off some of the performance. I’m attempting to tune the performance of a gaming laptop so that I can use it while on the go and away from the wall.

For the past 8-ish years I’ve been using Linux distributions on my daily driver laptops for development purposes. I find myself doing less and less directly on my local machine and more in the cloud through command line terminal sessions. There are a bunch of different reasons for this, but I find that my local OS doesn’t matter nearly as much as it used to. On our last trip to Mexico, I did the majority of my work in a terminal on my iPad Pro 11″. I’m looking to cut down on what I carry as we continue our RV travels, so let’s see how we can dial up the battery life on a gaming laptop.

Tweaking Windows performance settings

If you have a Windows laptop, you’ve likely seen the battery icon in the bottom right corner of your screen. If you click it, you can drag a lever back and forth to choose which “Power mode” you want to use.

Select a “Power mode”

Inside each of these Power modes is a LOT of settings that you can change to tweak how your machine will behave when A) your machine is configured to use that power mode and B) when your machine is either plugged into the wall or running on battery power.

Navigate to power settings

Navigate there quickly by pasting this into your explorer bar:

Control Panel\Hardware and Sound\Power Options\Edit Plan Settings
My current tweaks to minimize power draw

Graphics related tweaks

I completely disabled the integrated Intel graphics when I bought this laptop. This means that by default, I’ve used the Nvidia RTX 2070 card for everything. It’s no surprise that my battery life took a hit for this. Changing the “Preferred graphics processor” back to Auto-select will allow me to benefit from the integrated card when I’m away from the wall, and the Nvidia card when I need to crank up some graphics.

Allowing the machine to detect which graphics card to use on it’s own.

My laptop also has the ability to change the refresh rate of the screen. I don’t benefit a great deal from the 240Hz refresh rate while I’m hacking around in terminals, so I can swap that backto 60Hz and save some battery life there as well. I wish Razer’s synapse software could auto-tune this setting by power source detection.

swapping down to 60Hz refresh rate

How much does this all really help?

I found a way to determine power draw while on battery power through an app called BatteryBar. This app estimates discharge rate by talking to your battery controller. Before I started tweaking power plan settings, I was somewhere north of 35,600mW (35.6W). After a bit of tuning, I was able to bring my discharge rtate down to ~9.7W – 12.2W, depending on screen brightness settings.

~9.7W discharge

Before making any changes, my battery would only last about 3 hours. If the estimated runtime that BatteryBar is reporting turns out to be accurate, that would be a little over 2.5x my current runtime. We’ll see how it goes!