David Whiteside

"Most people overestimate what they can achieve in a year and underestimate what they can achieve in ten years." - Bill Gates

Simple Tool to Create Throw-Away Python Virtual Environments

Managing Python dependencies in isolated environments is a common practice in software development. But what if you need a quick, temporary virtual environment that you can discard after use? Here’s a simple tool and workflow to create throw-away Python virtual environments.


The Problem

While Python’s built-in venv or tools like virtualenv are excellent for managing environments, they require setup and cleanup. For quick experiments or isolated dependency installations, this process can feel cumbersome.


Using a Smartcard (PIV or CAC) with Ansible

As part of the Ansible 2.12 release, pkcs11/smartcards are now supported by Ansible. Now you can use smartcards and other devices that support pkcs11 (Yubikey) to configure systems with Ansible.

Setup your middleware for pkcs11, below is how to install opensc on a Mac using homebrew.

$ brew install opensc

To use pkcs11 for authentication set the ANSIBLE_PKCS11_PROVIDER environment variable

$ export ANSIBLE_PKCS11_PROVIDER=/usr/local/lib/opensc-pkcs11.so
$ ansible-playbook -u USERNAME -b -k -K PLAYBOOK.yml --connection=ssh
SSH password: << Enter your PKCS11 Pin for your smartcard
SUDO password[defaults to SSH password]: << Enter your user account password for sudo

For more details see the feature PR.


Setting the InfiniBand (IB) Node Description on Solaris

In Solaris, configuring the InfiniBand (IB) node description can make your network easier to manage by assigning meaningful names to nodes. This guide explains how to set the IB node description.


View the current IB node description

$ set_nodedesc.sh

You can set the IB node description to whatever you want using the -N option with set_nodedesc.sh.

$ set_nodedesc.sh -N 'something'

You can reference the man page for the set_nodedesc.sh command to see the full command reference.


Solaris Shutdown, Reboot, Init, and Halt Command Differences

The init and shutdown commands cleanly shutdown the system by running the shutdown rc scripts.

The advantage of shutdown is that you can set a shutdown delay and warning message.

halt and reboot are not as clean, no shutdown rc scripts are run so applications will not be brought down clean, I generally do not use these commands unless its a last resort.

$ init   # runs the shutdown scripts in /etc/rc*
$ init 0 # shutdown (on sparc it takes it to the ok prompt)
$ init s # single user mode
$ init 5 # shutdown
$ init 6 # reboot
$ shutdown # runs the shutdown scripts in /etc/rc*, prints message warning users
$ shutdown -y -g 0
$ shutdown -y -i 0 # shutdown to ok prompt
$ shutdown -y -i S # single user mode
$ shutdown -y -i 5 # shutdown
$ shutdown -y -i 6 # reboot
$ sync; sync; halt # (ungraceful shutdown, use sync;sync;halt)
$ sync; sync; reboot # (ungraceful reboot. Always run sync;sync;reboot. The prefered method is using init.)
$ sync; sync; reboot -- -r  # reconfiguration reboot
$ sync; sync; reboot -- -s # reboot into single usermode

SPARC OK Prompt Command Reference

Maybe you don’t care about the forth programming language, but if you work on Sparc systems long enough you are going to have to work from the ok prompt.

Here are the essentials commands you must know.

Boot the system normally

ok> boot

Boot the system and allow for discovery of new devices (reconfiguration boot)

ok> boot -r

Boot into Single-User Mode

ok> boot -s

Boot into a ROM, useful if your system isn’t bootable