Sunday, October 9, 2022

Reminder - VS Code - simultaneous edits (aka Multiple selections / multi cursor)

 Reminder - VS Code - simultaneous edits  (aka Multiple selections / multi cursor)

TL;DR shift command L 

I always see VS code highlighting the same key words while editing, but forget how to use that highlighting for simultaneous edits. So I resort to find and replace

VS Code supports multiple cursors for fast simultaneous edits

 But to me, it's really unclear how you then start editing the selected words. On a mac - it is shift command L (⇧⌘L)


Tuesday, September 20, 2022

Unifi 7.2.94 on MacOS Error When Saving Settings

 Unifi 7.2.94 on MacOS Error When Saving Settings

After finally getting around to patching my mac mini, everything came up except for the Unifi network application. So, I downloaded the latest version and it failed to start up, so I uninstalled and reinstalled the application (Unifi 7.2.94 on MacOS Catalina 10.15.7) from https://www.ui.com/download-software/

After restoring from a backup, I tried to make the backups run weekly, and got an error message when trying to save settings

An error occurred when applying changes to System settings. This action could not be completed. Please ensure you've entered all information correctly.

Removed, reinstalled application and Java

Java install instructions from https://community.ui.com/questions/Shell-script-for-adding-Java-RE-path-to-local-UniFi-controller-on-macOS/adb1194c-cca4-4a50-8e79-cf805fdd70b3 but Java temurin8 is no longer available so used openjdk@8

$ brew install openjdk@8
$ sudo ln -s /Library/Java/JavaVirtualMachines/openjdk-8.jdk/ /Applications/UniFi.app/Contents/PlugIns/ 
$ sudo /usr/libexec/PlistBuddy -c "Add :JVMRuntime string 'openjdk-8.jdk'" /Applications/UniFi.app/Contents/Info.plist

That didn't help, but the genius in this Ubiquiti Unifi forum link - https://community.ui.com/questions/Cannot-change-save-system-settings-Unifi-Network-on-cloudkey-gen-2-pro/916daacb-39cc-4ecf-a09a-c07fee7cc23d was a cloud key error, but the solution was the same:

Switch back to Legacy Interface (Settings > System > Legacy System > Enable), make any change, then switch back to new Interface (Settings > User Interface > New User Interface > Apply Changes)

Thanks to Corey Quinn for motivating me to publish this just in case anyone else out there has this same problem - https://www.lastweekinaws.com/blog/the-harrowing-search-for-the-elusive-technical-answer/

Sunday, September 11, 2022

Reminder - Low Latency Linux Kernel Boot Options

 Reminder - Low Latency Linux Kernel Boot Options

Terrible name for the web site https://make-linux-fast-again.com/

noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off

Covers many kernel versions as noted in Hacker News article - https://news.ycombinator.com/item?id=25668990

Sunday, September 4, 2022

Today I learned - Dell Server Warranty Lookups

Today I learned - Dell Server Warranty Lookups


In the past, Dell made it hard to access their API for warranty lookups. Even the signup process at https://developer.dell.com/ to get a key was dire - once, they said having 1000 servers wasn't enough to justify API access!


This gist has a working example if you have an API key - https://gist.github.com/teroka/0720274b87b77fe7171f (as well as takes of woe) dealing with the webiste


I also found out that this set of URLs is the one company and it sort of should have a paid option, but doesn't, so I don't understand how it works. I assume they have a Dell API key, or they screen scrpae:

  • http://www.updatewarranty.com
  • http://www.lookupwarranty.com

$ /usr/bin/curl -s --max-time 30 -H "Referer: http://www.lookupwarranty.com/" 'http://www.lookupwarranty.com/updatewarranty/server/lookup?serviceTag=STAGXXX&modelNumber=&mfg=&email=&platform=Website&key' | jq .

{
  "serviceTag": "HT9K6R3",
  "mfg": "Dell",
  "expires": 1234567890,
  "shipped": 1234567890,
  "outOfWarranty": null,
  "error": null,
  "url": "http://www.dell.com/support/my-support/us/en/19/product-support/servicetag/STAGXXX"
}

Tuesday, May 17, 2022

Today I Learned - Power On Linux Server at a Particular Time

So today I learned that it is possible to set an alarm in the future for the motherboard to wake up and a poweroff - and the ability has been around for years (since around 2000)!

This article - https://www.linux.com/training-tutorials/wake-linux-rtc-alarm-clock/ - gives a great demonstration on how to set real time clock wakeup by playing with /sys/class/rtc/rtc0/wakealarm. Some good pointers on cleaning out any BIOS based wake ups as well

This article - https://www.maketecheasier.com/alarm-automatically-power-on-linux/ - introduces the command line tool rtcwake which is a little more user friendly


Wednesday, February 26, 2020

BIND script to create PTR records

BIND script to create PTR records


Just in case you ever need to manage an instance of BIND manually, you will have the pain of remembering to update the PTR records. Here's a quick script to create the PTR records

For those of you that are looking for an alternative, I suggest you use PowerDNS as a backend and PowerDNSAdmin as a nice front end

Here's the script

#!/bin/sh

NETWORKS=$(cat << ENDNET
10.10.1
10.10.2
.
.
.
10.10.99
ENDNET
)

REV_HEADER=$(cat <;
; BIND reverse data file for NETWORK
; Do not edit manually, but run /etc/bin/zones/$0
; after editing /etc/bin/zones/mydomain.tld.db
;
\$TTL    604800
@       IN      SOA     mydns-server.mydomain.tld. root.mydns-server.mydomain.tld. (
                         SERIAL         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      mydns-server.mydomain.tld.
END
)

for NETWORK in $NETWORKS ; do
    echo $NETWORK
    NEWSERIAL=`grep Serial db.${NETWORK} | awk '{printf "%6s", $1+1}'`
    echo $NEWSERIAL
    echo "$REV_HEADER" | sed -e "s/SERIAL/$NEWSERIAL/" -e "s/NETWORK/$NETWORK/" > db.${NETWORK}.new
    egrep "$NETWORK\." mydomain.tld.db | grep -v '^;' | awk 'split($4, ipaddr, ".") {printf "%-3s     IN      PTR     %s.mydomain.tld.\n", ipaddr[4], $1}' | sort -n >> db.${NETWORK}.new
    mv db.${NETWORK}.new db.${NETWORK}
done

Wednesday, January 22, 2020

New devices and updating their names with lspci

New devices and updating their names with lspci


We just received a new Exablaze X25 card to review and found lspci was reporting the device as "Exablaze Device 0009"

I just found out that lspci doesn't interrogate the card for the name, but uses a lookup table that can be updated with the update-pciids command, which simply downloads from http://pciids.sourceforge.net/v2.2/pci.ids (on my Ubuntu 16 box), but https://github.com/pciutils/pciids says it takes it from http://pci-ids.ucw.cz/pci.ids.

And here is my X25 card as device 0009:

1ce4  Exablaze
 0001  ExaNIC X4
 0002  ExaNIC X2
 0003  ExaNIC X10
 0004  ExaNIC X10-GM
 0005  ExaNIC X40
 0006  ExaNIC X10-HPT
 0007  ExaNIC X40
 0008  ExaNIC V5P
 0009  ExaNIC X25