Using the salt data module in a salt runner
Salt runners don’t start with the full complement of salt modules loaded at start, but it is possible to load up some (many? all?) of the modules if they are needed.
I wanted to use the data module to store the result of a runner execution to reduce duplicate processing, but just adding an
import salt.modules.data did not work, when the
data.update() call was made, it threw an exception (something about
__opts__. It took a bit of time and experimenting, but I found that I could load the module and call it like so:
import salt.client import salt.config __opts__ = salt.config.minion_config('/etc/salt/minion') datamod = salt.loader.raw_mod(__opts__, 'data', None) datamod['data.update']('keyname', 'value')
Hopefully this will help someone else, as when I looked in Google for answers (late August 2015) it was difficult to find anything about using modules in salt runner scripts.
Tuesday September 1, 2015 · Permalink
Running Textpattern on OpenShift
Yes, it is possible to run Textpattern on Red Hat’s OpenShift platform, this weblog is running there right now.
- Sign up for an OpenShift account and install the command line tools
- Create an application:
rhc app create txpblog php-5.4 mysql-5.5 cron-1.4
- cd into txpblog
- Unpack your version of textpattern and place the textpattern directory, other directories, and php files into the base directory of the project
- commit the change to git
- push to OpenShfit with a git push
- visit txpblog-domain.rhcloud.com/textpattern/setup.php in your browser to do the setup (you’ll need the mysql username, password, and database name from the output of
rhc app showto pass the setup test to get to step 2)
- edit the config.php file, but use OpenShift env variables for the mysql connection information and the root directory as shown below
- commit and push the change to your OpenShift repo
- continue with the setup and when it says to remove setup.php (in step 4), remove it from your local git repo (
git rm -r textpattern/setup) and then commit and push the change to the OpenShift repo
Here’s what a config.php file running on OpenShift will look like using the environment variables:
<?php $txpcfg['db'] = 'txpblog'; $txpcfg['user'] = getenv('OPENSHIFT_MYSQL_DB_USERNAME'); $txpcfg['pass'] = getenv('OPENSHIFT_MYSQL_DB_PASSWORD'); $txpcfg['host'] = getenv('OPENSHIFT_MYSQL_DB_HOST'); $txpcfg['table_prefix'] = ''; $txpcfg['txpath'] = getenv('OPENSHIFT_HOMEDIR') . '/app-root/runtime/repo/php/textpattern'; $txpcfg['dbcharset'] = 'utf8'; ?>
Using the environment variables makes it easier to use the same config file if you want to use the same git repo to be both your staging site for changes and for your production site running on a different gear.
Friday August 14, 2015 · Permalink
Party Mix (aka Chex Mix)
Making Chex mix at the holidays is a tradition at our home, as I suspect it is in many homes. I like a bit more Worcestershire sauce in my Chex mix than most recipes call for, so here’s the recipe that I use.
2¼ cups rice chex
2¼ cups corn chex
2¼ cups wheat chex
1 cup pretzel sticks
1 cup mixed nuts
½ cup butter or margarine
4 Tbs Worcestershire sauce
1½ tsp seasoned salt
¾ tsp garlic powder
½ tsp onion powder
Melt the butter in a 2 cup glass measuring cup in the microwave, add the Worcestershire sauce and mix thoroughly, then add the seasoned salt, garlic and onion powders and mix again. Pour over the chex, pretzels, & nuts and stir to coat as evenly as possible. Bake in a 275° oven for 60 minutes, stirring every 15 minutes. Pour out onto paper towels backed with newspapers to cool.
Saturday December 29, 2012 · Permalink
Multiple Monitors on a Laptop with Ubuntu 9.10 (Karmic Koala)
Recent movement of machines around left me with an extra monitor that I could use as an external display with my laptop running Ubuntu 9.10 (Karmic Koala).
From reading numerous websites, I guess that multiple monitor support didn’t improve with 9.10 over 9.04, but I did find a couple of articles that helped me craft a setup that works for me.
The original articles are:
- Karmic dual monitors now assigns second monitor as primary specifically post #3
- Adding universal shortcuts in ubuntu/gnome (view the google cache version)
What I ended up with was a couple of small scripts in my bin directory called ext-on and ext-off:
#!/bin/sh xrandr --output LVDS1 --primary xrandr --output LVDS1 --auto --pos 0x0 --output VGA1 --auto --right-of LVDS1
#!/bin/sh xrandr --output VGA1 --off --output LVDS1 --auto
I then used
gconf-edit to bind those commands to <Super>-2 and <Super>-1 respectively to turn on and off the external monitor.
Hope this helps someone else looking for an easier way to manage a second monitor than having to go into display properties every time you connect to an external monitor.
Sunday January 17, 2010 · Permalink
Carved Golf Balls
Getting ready for an upcoming carving class that #2 and I will be attending, I was looking around for carving info on the web. I wandered onto the forums at Woodcarving Illustrated where I found a golf ball carving tutorial by Gene Messer.
After some more searching around the net, I ended up on YouTube where I found that Gene has recorded lots of video tutorials, including a series on carving and painting a golf ball.
Here are links to the golf ball series to make it easier to find:
- Carving A Face On A Golf Ball Part 1
- Carving A Face On A Golf Ball Part 2
- Carving A Face On A Golf Ball Part 3
- Painting The Carved Golf Ball Part 1
- Painting The Carved Golf Ball Part 2
- Painting The Carved Golf Ball Part 3
The ball on the right is the one I carved after reading the tutorial. It was painted after I’d found Gene’s videos. After thinking about it and watching some of Gene’s Santa carving videos, I came up with the Santa face on the left.
Saturday November 22, 2008 · Permalink
Projects posted at LumberJocks
I’ve posted three projects over at my LumberJocks project page.
Tuesday December 4, 2007 · Permalink
Woot-Off Helper Greasemonkey Script
Woot-Off Helper does just two simple things to make it easier to follow a Woot-Off from your browser:
- Reads the size of the bar between the flashing orange lights and places the percentage at the beginning of the page title
- Reloads the page every 90 seconds
Now you can just keep a tab open with the Woot page and easily glance at what percentage is left. If you switch to the Woot tab before minimizing it, you should be able to catch the item changes too.
Thursday August 30, 2007 · Permalink
District Pinewood Derby
The District Pinewood Derby was held the last Saturday of March this year. Since #2 had finished in the top three at the pack races, he got to participate in districts for his third year in a row. Until two days before the districts, the car just sat in our carrying box. I took a little bit of the lead weight out of the car, since the districts use a scale that measures to 0.005 of an ounce and our pack just measures to 0.1 of an ounce. On Friday night, we added some more graphite to the wheels and #2 spent time spinning the wheels on our wheel polishing rig.
On race day, #2’s car “The Natural” was just one of 118 cars in the event. First race is typically against your pack mates and #2’s car won the heat and beat the first and second place cars from his pack. It looked like his car was pretty fast and when the standings went up, his car was in 13th place overall. The Natural won it’s second heat and moved up to 12th in the standings (running faster that the first heat). The Natural won the third heat too (running faster than the first two heats) and moved to 8th place overall and fourth fastest bear. The Natural won the fourth heat too, but we had to wait for the awards ceremony to tell where he might place. As the awards went on, we found out that he finished as the fastest bear in the derby (after the top three which included two bears) and got to take home a great trophy.
Sunday April 8, 2007 · Permalink
Pinewood Derby 2007
The pack’s 2007 Pinewood Derby was held the first Saturday in February this year. Only #2 was competing this year as #1 had moved onto Boy Scouts. At left is #2’s car “The Natural.” He wanted a thin wedge car again this year, so I cut the block to the shape he wanted. Once he was done sanding the saw marks off, he liked the grain pattern so just went with a clear coat. Much work was done on the axles and wheels to get them just so. At the practice day, the car was running straight, but a little slow, so we added more graphite and #2 spun the wheels on our wheel polishing setup.
The day of the race came and The Natural seemed to be running well. He won most of the heats he was in (though the scoring is on time alone) and ended up finishing third overall in the pack. This means another trip to the district pinewood derby (he’s qualified every year in scouts for the district race).
I built three cars for the open class races, two for the stock class and one for the unlimited class.
Sunday April 8, 2007 · Permalink
Aunt Ruth's Graham Cracker Pie
My great aunt Ruth made the most wonderful pie she called Graham Cracker Pie. She used to sell this and other pies to local restaurants in West Virginia and guarded her recipes pretty closely. Thankfully, she taught my grandmother (her sister) how to make the pie, then my grandmother secretly taught my sister, who then secretly taught me (since I was the pie fiend).
I typically make some Graham Cracker pies around the holidays. So in addition to making the pies, I thought I should document the recipe so anyone can try a Graham Cracker pie. Since Aunt Ruth passed away last year, I figured its finally safe to admit I know how to make this pie.
- 3 cups graham cracker crumbs
- 3 tsp. cinnamon
- 3 tsp. cornstarch
- 3 tsp. sugar
- 1 cup melted butter
Combine the dry ingredients and mix well. Add the butter and mix so everything is coated. Reserve about 1 Tbsp of mixture for the toping and press the rest into two 9” pie plates to form the crusts.
- 1 qt. whole milk
- 1.5 cups sugar
- 6 Tbsp. cornstarch
- 4 egg yolks
- 1 tsp vanilla extract
Place the milk in the top of a double boiler and set the heat to medium high and let the milk set until it starts forming a skin on top as it heats. While the milk is heating mix the sugar and cornstarch and separate the egg yolks and whites. Set aside the egg whites for the meringue. Beat the egg yolks. Once the milk has started to form a skin, start mixing in the sugar/cornstarch mixture very slowly and continue mixing until mixture starts to thicken like a pudding. Dip out about a 1/2 cup of the mixture and add it slowly to the egg yolks and mix to heat up the yolks. Add another 1/2 cup mixture to the egg yolks and mix, then pour the egg yolk mixture slowly back into the double boiler while continuing to stir. Keep cooking until the mixture is very thick. Add the vanilla extract at this time, stir in and divide between the pie crusts.
- 4 egg whites
- 4 Tbsp. sugar
Start beating the eggs whites and slowly add the sugar and beat until soft peaks form. Spread the meringue over the pies and sprinkle on the reserved pie crust material to decorate.
Brown the meringue slightly in a 375 degree oven for around 6 to 7 minutes.
Cool and refrigerate for a couple of hours before serving.
Monday December 11, 2006 · Permalink