Tuesday, February 04, 2014

Why I love bash - simple remote connections

Bash is my go-to language for busting out sysadmin stuff.  I've been tamping up with python for a while now, and for more complicated tasks, it's fantastic;  it should probably even be fantastic for simple tasks.  But, there is one thing that I do all of the time in Bash that I have yet to find a way to replicate without unnecessary complexity in python:

agregateResults (); { while read line; do echo "Program Output: $line"; done; }
clientCode (); { echo "I am client $(hostname)."; }
if [[ "${1}" == "client" ]]; then
    for server in  ${*}; do
        cat ${0} | ssh ${server} -s client
    done | agregateResults

This is so freaking useful.  I have servers across multiple domains and I need to run script to aggregate data from all of them, but I can't always count on network file systems being available, etc.  This lets me have a script in once place and execute the same code everywhere without fumbling with copying it ahead of time, etc.   It's so clean and easy.

When I try to find out how to do this with Python, I read all kinds of stuff about parallels, Paramiko, blah blah blah... it's all so complicated.  There has to be a five-liner example out there somewhere of how to do the same kind of thing.  

Started a code-golf at stackexchange for this one: http://codegolf.stackexchange.com/questions/20008/self-execute-over-ssh

Monday, November 25, 2013

Commentary on the "Enders Game" movie

The producer tried to cram way too much stuff into 100 minutes of film.  There was no character development, huge elements of the story were omitted or glossed over, and who the heck knows what was going on the entire time...  That was a train-wreck.

I suspect that the film was going to be way over budget if they tried to create the battle-room scenes with squads of kids flying all over.  I don't believe that it's possible to create realistic zero-g interactions between mobs of people using wires...  The whole scenes would need to be animated, at huge cost.

I hope that, someday, this movie is re-done as a 3 part anime series, allowing more like 6 hrs to tell the whole story.  An animated format would let the characters be presented at proper ages, allow for way better zero-g fighting and battle room scenes, and so much of the story could be left true to the book.

Wednesday, October 23, 2013

Google Drive Cleint for Linux

It's been like two years now, and there is still no Google Drive client for Linux.  What gives, Google?

A lot of us Linux users use your services exhaustively, but we have to fall back to 3rd party tools to sync files into Google Drive.

Despite all of the privacy controversy, I would LOVE to have a central place where I can sync back (and edit) some of my scripts, application config files, etc.  I use gdrive for everything frikin' else.  It feels even less security having to grant some 3rd party middle-man access to my account so I can sync from my computers.... Argh...

Thursday, January 17, 2013

vCenter 5.1 is a pain!

I'm wishing I could just use 5.0, but I need some of the 5.1 functionality for nested virtual servers...

After running the Simple Setup, I get an error trying to log into the web client:

Failed to connect to VMware Lookup Service
https://:744/lookupservice/sdk - SSL certificate verification failed. 

Rebooting and waiting ten minutes for the service to start up fixes this.

After successfully logging into the web client with admin@System-Domain account, it doesn't list any available vCenter servers.  It appears that the vCenter service never registered with the Lookup Service, so this has to be done manually, per the doc at http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2033620.  See the "Registering vCenter Server with Inventory Service" section.

cd C:\Program Files\VMware\Infrastructure\VirtualCenter Server\isregtool

register-is.bat https://machinename.corp.com:443/sdk https://machinename.corp.com:10443 https://machinename.corp.com:7444/lookupservice/sdk

This seemed to work well.  Loads of text scrolling by during the register.  After connecing back up to teh Web Client, There was a message showing the following (not exactly, I didn't capture this verbatem):

Unable to connect to one or more vCenter Servers:

So I'm pretty back to where I was before trying to register the vCenter server with Inventory Manger.

Saturday, November 10, 2012

Linux Swap Create Init Script

I use an SSD as my primary drive.  I used to have a swap partition on it (I know, bad idea on SSD) and it had probs w/ data corruption and the swap randomly being disabled.  Linux supports trim for SSDs, but trim won't do anything for swap that's always on a specific set of blocks in the SSD...

If we need swap space, but don't want it to always hit the same part of the SSD, we should be able to use a swap file in /tmp, allocating 2GB at boot. At least in Ubuntu, /tmp is cleaned up each boot, so when we create our swap file, trim has the opportunity to put the file on some fresh SSD sectors.

Here's the init script for this:

# setup swap file init script

# Provides:          atop
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Should-Start:      $local_fs
# Should-Stop:       $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Monitor for system resources and process activity
# Description:       Atop is an ASCII full-screen performance monitor,
#                    similar to the top command, but atop only shows
#                    the active system-resources and processes, and
#                    only shows the deviations since the previous
#                    interval.

DESC="tmp swapfile creator"

case "$1" in
                echo -n "Starting $DESC: "
                if $0 status >/dev/null
                        echo "    Already Running."
                        exit 0

                test -f ${SWAPFILE} && rm ${SWAPFILE}
                dd if=/dev/zero of=${SWAPFILE} bs=1M count=2048
                mkswap ${SWAPFILE}
                swapon ${SWAPFILE}
                echo "        Done."
                echo -n "Stopping $DESC: "
                $0 status >/dev/null && swapoff ${SWAPFILE}
                test -f ${SWAPFILE} && rm ${SWAPFILE}
                echo "        Done."
                exit 0
                if swapon -s | grep -q ^/tmp/swapfile
                        echo "Swap is enabled"
                        exit 0
                        echo "Swap is not enabled"
                        exit 1
                echo "Usage: $N {start|status}" >&2
                exit 1

exit 0

Thursday, October 25, 2012

Way cool dream about freedom of information...

I find myself sitting in a college lecture hall, much like the old ones at Shasta College. There are two people up front, a man and a woman; I’m not sure which of them was actually the instructor. They seem more interested in each other than teaching and put on some music, using an iPod, that they want the class to listen to. It’s hard to hear and the class gets restless.

People in class start suggesting better things to listen to. I’m tired and slump down in my chair, half asleep. My friend Jon, sitting diagonally behind me says we should listen to something. I say lethargically that I can’t even hear him. He starts the song playing on his laptop.

As I glance over, I see the album cover on the screen and I’m pulled into the music!

I find myself on a floating airship, totally steam-punk style. It’s an elongated oval hewn from yellow wood, with two great propellers spinning underneath, one at each end, and the ship is probably fifteen feet long. Offset from the perimeter of the craft by a small walkway is a bookshelf that wraps most of the way around and is loaded with books facing outward. All of the ship’s wood paneling is carved with intricate symbols.

Listening to the music, I look into a gap between a coupe of the books, and it seems that the shelf is forever deep, despite the ship only being a few feet across.

Glancing around, I see that there are four well dressed and well mannered fantasy creatures, each a different species having a variety of ears and humanoid/animal faces.

As the music plays, the creatures chatter about how the Marxists, the Librists, and the Serialists are no longer being persecuted and that they can finally return to society.


The school scene is symbolic of the poor state of our educational systems, or perhaps any social program that’s in place that perpetuates the state of our society. The teachers work to satisfy their flesh while they do a crappy job of feeding the class whatever the system has given them to teach.

The students represent “society”. They are fed so much BS through the schools and the media that, although they know that there’s a problem, most can’t figure out what to do about it.

The magnificence of the airship stands for a golden age that will come when information flows freely. The truth speaks for itself, and dysfunction cannot be hidden by bureaucracy. The books are the wealth of information that is unavailable to us.

The persecution is our world’s corporate and political attacks on free speech, whistle blowing (reform), and on file sharing.

The Marxists bring social change or reform. The Librists are keepers and sharers of knowledge. The Serialists are those who digitize and preserve information.

That the persecution is over gives me great hope!

Saturday, May 14, 2011

Quick swim report from today - 1.3 miles, ~53deg water, ~45 min

I stopped wearing a wetsuit the week before last as Folsom lake was starting to warm up pretty good. We have had a few cloudy, cold, days since then, though. Today was one of those. I really didn't feel like getting in when I got to Beals Point today and was already feeling a little chilled before getting into the water. I'm really glad I got in, though. It always feels good swimming, running, etc. once I get moving.

There were five of us in the water today. We swam straight across to the tree and stopped to wait for the last two people to make it across. I was starting to feel pretty cold standing there so followed the levy making the return trip. My form felt a little sloppy, probably because I was thinking about being chilled and not staying as focused as I could have. About half way back, I could feel the blood-flow cut off to my forearms, hands, and lower legs; They didn't really feel any more cold than the rest of my skin, being in the chilly water, but all the muscles that far out became very sluggish and weak. Not a problems for swimming, though, since that uses all the bigger muscles in closer to the middle.

This used to happen to me when I rode motorcycle year round. To keep warm on rides in the winter, my body would restrict blood flow to the arms and legs, but the core would just be radiant with heat. When I'd get to where I was going and get off the bike, the valves controlling blood flow to my extremities would all open back up and I could feel hot blood flush through my arms again as circulation returned to normal.

It's interesting having a crash course in cold tolerance while swimming, but it's a little unnerving because it takes place out in the middle of the lake. I recall, back when I used to ride lots, that staying warm was mostly a matter of keeping focused and not worrying about how cold my fingers felt. I kind of expect that if I paid lots of attention to my form and kept my body calm, I could stay comfortable for quite a bit longer in these conditions. It's also good to know that the body goes through a predictable process as it starts to cool off, so one should be able to clearly assess when it starts to become a risk to stay in the water longer. The body is highly adaptable and robust, and our limits are mostly mental in unfamiliar environments.