Using WonderWare Script to Check for Correct Number Format

Here is how I used a WonderWare window script to check to make sure the batch number entered by the operator meets the following requirements:

  • must be 9 digits
  • first digit is a 8
  • 2nd and 3rd digit are the 2-digit year number
  • 4th to 9th digits are numbers

Screenshot from 2014-04-22 15:50:21 Continue reading

Posted in Industrial Automation | Tagged , | Leave a comment

Wood Repair Using Plastic Filler (bondo)

The house we just bought had damage to several of the stair trim pieces of wood from a dog.  Here are some pictures I took of my fix.  I started with a dowel glued in a hole I drilled, then added fiberglass bondo.  I used a rasp and double cut file to shape the bondo after it hardened.  Once I had the basic shape, I switched to an all-purpose bondo that went on much thinner.  More filing and finally sanding and painting.


Posted in How-To, Projects | Tagged , | 1 Comment

Use cron, grep, ps to monitor and restart a program (x11vnc)

As a band-aid to check if a program stopped running, and then restart it if it did stop, here is what I came up with.  x11vnc is the program that gave me trouble, seems like every once in a while, usually while I’m logging in as a user and the X11 screen changes, the VNC server loses its mind and quits.  Being lazy, I don’t want to remember the command to type in to restart it correctly, so this does it for me:

Step 1:

create a shell script (/root/check-x11vnc-running)(and chmod +x to make executable):

 # Check to see if x11vnc is running
 if ps cax | grep x11vnc | grep -v check >; /dev/null
      echo "x11vnc running when checked at $(date)" >> /var/log/x11vnc-checker.log
      x11vnc -usepw -nap -wait 50 -noxdamage -display :0 -forever -o /var/log/x11vnc.log -bg
      echo "Restarted x11vnc at $(date)" >> /var/log/x11vnc-checker.log
  • ps cax lists all the processes running, grep finds all the lines that mention x11vnc, and the second grep command removes the instance of this script running.
  • if the statement was > 0, we think the program is running, make an entry to a log file (have to create the file to start with —  use ‘touch /var/log/xxxxx’)
  • if the statement was false (a zero), issue the command to restart the vnc server, and make a log entry

Step 2:

add a entry to crontab to run the script above once every minute

 > crontab -e
*/1 * * * * /root/check-x11vnc-running  

I had fits getting this to work, and finally figured it out.  The first entry represents the minute, so I figured ‘run every minute’ would be a ‘*’.  But, it won’t run with all *’s, the ‘*/1′ makes it run once per minute.  ’*/2′ is every two minutes.  ’2′ would be at H:02 of every hour.

Posted in Uncategorized | Leave a comment

Redirect, Pipe, and Tee

Redirect – ls command creates file called file_list.txt instead of sending to stdout:
$ ls > file_list.txt

Redirect Append – ls command appends file_list.txt instead of sending to stdout:

$ ls >> file_list.txt

Pipe – sends output of ls command to less command:

$ ls | less

Pipes can be stacked:

$ ps aux | grep conky | grep -v grep | awk '{print $2}' | xargs kill

If you pipe to the command ‘tee’, the command output goes to stdout and a file of your choice:

$ ls | tee file_list.txt

Posted in Information | Tagged , , , , | Leave a comment

Fire Hose Pants

firehosepantsAmber bought me a pair of fire hose pants for Christmas.  I wore them today to do some clean-up work outside.  Right off the bat, there are two things that are awesome about these pants:  1) There is a diamond-cut panel in the crotch area that gives the boys the room they need when you bend down.  This feature alone makes them worth their premium cost.  It works, makes a huge, noticeable difference in comfort.  2) There are about 12 belt loops on the waistband.  Not the typical wussy belt loops either.  These things will let you say no to butt crack if you have a decent belt.  The material they are made of seems very tough, they claim they outlast all other pants by 3x.  The pockets are deep, and easy to get your hands and stuff in and out.  I rarely get very excited about clothes, but these pants have some promise!


Posted in Things I Like | Tagged , | Leave a comment

Government Can Not Grant Freedom

from Adrian Murry’s facebook post

One thing I have learned over the last five years of politically righteous indignation is that if we protest from a position of victimhood we too easily enable ourselves to be victims. My outrage since The Great Mistake of 2008 has been the government’s increasing ability to victimize its people, to turn citizens into subject and subjects into serfs. It dawned on me all too slowly that there is little point and no avail protesting to the government about this on the grounds of the virtues of liberty, just as there is little to be gain from petitioning the rapist for passion and decency. Both will merely turn a deaf ear.

… With some inspiring exceptions, politicians have primarily excelled at being self-serving hucksters, going back to the Roman Senate. Indeed, who could not envision the backroom dealing, ruthless ambition and deliberate betrayals of Shakespeare’s Julius Caesar playing out in today’s United States Congress?

Such was true in America a century and a half ago, when the open and honest corruption and bribery of the day paled in comparison to the sophistry of the sleaze creatively not on display in government today. One need only consider that when you have Wall Street bankers regulating the banking industry, executives from agribusiness running the Food and Drug Administration, union flacks heading the Department of Education, military contractors in charge of the Pentagon and, of all people, insurance and pharmaceutical companies controlling our healthcare system, you can pretty much take it as a given that the country has been lost. Stick a fork in it. The United States of America is done.

But that does not mean we need to give in. We just need to understand that the dark side is playing a different game than we are. They’ve moved on to a higher form of chess while we’re all arguing about the proper rules for Go Fish. They are not listening to what you’re saying because they don’t care what you want, except to the extent that you might possibly though not probably impede their ability at being reelected to the House of Calliopes and Cascading Cash. The best way to ensure that is to divide you up into so many interests and factions and spheres that you will never be able to mount an effective opposition. We’re all too busy fighting among ourselves to fight them.

To live lives of free and independent people, beholden and bound only to our God, we must first free ourselves from the notion that we must be dependent on government to grant us our freedom. Government has no such power and, if it did, is unlikely to exercise it. By believing we must petition government for freedom, we are conceding that we are either prisoners or slaves.

Posted in Politics | Tagged , , , | Leave a comment

blinksticks showing opposite colors

A few hours of tinkering with the new blinksticks, here is what I came up with:

The light on the right is set to a random color every 1/2 second.  The stick on the left morphs to the opposite color.  Pretty cheesy, but I’m learning to program in python!

code available at:

Posted in Projects | Tagged , , | 4 Comments

Blinkstick – a single pixel controlled by USB

I ordered 2 blinkstick kits a while back — they came in today!  I dug out the soldering iron and assembled them.  Within a few minutes I had the blinkstick python libraries installed on my computer.  Now I’m wondering what gEEky task I’m going to make these LEDs do.

Posted in Projects | Tagged , , , , | 2 Comments

Subversion (svn) on shared web host (bluehost) and Linux client setup

This explains how to configure and use a Subversion client from a GNU/Linux box*  to connect to a Subversion server on a shared web host account.  (  If you have already set up a shared key for password-less ssh access (see use ssh without a password post), then step 3 can be omitted, but step 3 is useful in case you want to give other people access to a repository on the web host server without giving them full ssh access.

* = I’m guessing any flavor of *nix will work– I use LinuxMint, which is based on Ubuntu

Steps 1 to 3 are performed from the web server (a ssh session to the server)

Step 1 Check to make sure Subversion is installed, or install it.

[~]# svn --version
svn, version 1.7.4 (r1295709)
 compiled Apr 5 2012, 16:46:24

Continue reading

Posted in How-To | Tagged , , , , , , , , | Leave a comment

use ssh without a password

Use a public/private key pair to avoid having to type in your password every time you open up a ssh session:

1- Generate a keypair, install the public key on the server and ‘authorize’ it.

2- Copy the private key(s) to the ‘~/.ssh’ directory on your local machine.

3- Set the permission of your private key files to no access for group and world.  (600)

brian@Mint13desktop ~/.ssh $ ls -l
-rw------- 1 brian brian 1743 Dec 19 20:40 id_dsa
-rw------- 1 brian brian 1768 Dec 19 21:28 known_hosts
-rw------- 1 brian brian 1424 Jun 1 2013 known_hosts.old

4- Edit ‘/etc/ssh/ssh_config’ with a line starting with ‘IdentityFile’ for each of your private keys

 IdentityFile ~/.ssh/id_dsa

5- connect without having to type a password!

brian@Mint13desktop ~ $ ssh
Last login: Thu Dec 19 20:28:15 2013 from ****.net [~]#

(local computer is LinuxMint 13, remote is Linux web host)

Posted in How-To | Tagged , , , | 3 Comments