OLW: Executing #Rails Scripts From IRB

This is a #ruby #one-liner if you need to execute an unknown script that requires a Rails context from a location that does not have access to a Rails context (e.g. a Rake task) and also need to retrieve a return value of that script, you can use a line as follows:

result = system "echo 'require \"#{path.to_s}\"' | rails c"

Here the path variable corresponds to the path to the ruby script you want to execute. The system command gives a return value based on if your script aborts or succeeds so you can check for failures.

“From now on, ending a sentence with a preposition is something up with which I will not put.” – Winston Churchill

Advertisements

Charcoal Grilled Pizza

#Grilling is great for #pizza because it requires very high heat – one of the most important factors when making pizza. Here is a simple way to make great grilled pizzas on your charcoal grill.

1) Get your ingredients (use nowcado.com for the best deals!) ready as you will need to work quickly. Pick toppings like cheeses, sauces, meats and vegetables and have them all ready to go by your grill.
a) If you want to use any vegetables or cured meats as toppings, you may want to par-cook them prior to putting on the pie. Simply grill by themselves prior to continuing to the next steps.
2) Use your favorite dough recipe and roll the dough out by hand into a round shape. Cover with light coating of olive oil and hint of salt and pepper.
3) Get your grill hot and put the dough over the hot coals, oil side down. Rotate every 15 seconds. You can optionally flatten the largest bubbles if you like. While it cooks, lightly oil the top side.
4) Flip the dough when the bottom is cooked (it will happen fast!) and move it to the cool side of the grill. Top quickly with not too much cheese (about 2 oz cheese for a 12 inch pizza) first, then dot with sauce, and add any other toppings last. If you want the cheese extra melted, cover the grill and cook for 30 seconds now.
5) Move the pizza over to the hot charcoal side and finish cooking, rotating as with the first side.
6) Remove from grill, slice, and enjoy!

 

Applewood Smoked #Salmon

Using the smoking instructions from yesterday, here is a great recipe for applewood smoked salmon.

Ingredients

  • 1.5 lb salmon, cut in to ~6 portions
  • 1 quart apple cider
  • 8 oz applewood smoking chips
  • 2 Granny Smith apples
  • 2 tbsp butter
  • Salt and pepper
  • 1 bunch watercress

Instructions

Simply follow the smoking instructions for 1.5 lb fish with these notes:

  • Marinade – Pour apple cider into a medium sauté pan over medium-low heat and reduce until it becomes syrupy, about 15 minutes.
  • Use applewood smoking chips for the smoking wood
  • Rub – simple mix of salt and pepper
  • Sauce at the end – Peel, core, quarter, and slice Granny Smith apples. Melt butter in a medium sauté pan over medium heat. Add the apples and season with salt. Cook the apples, gently stirring, until tender but not soft, about 4 minutes.
  • Serve at the end with watercress

Charcoal Grill Smoker Hack

Did you know that you can use your old kettle grill as a smoker? We found a great link describing how to do it!

1. Prep your meat and wood.

Let your meat soak in your preferred marinade for a few hours. Get your smoking wood ready by soaking it in water for at least 2 hours. Anywhere from an hour to a day before you start cooking you can optionally apply a rub to your meat.

2. Place water pans in the grill.

Fill disposable tin pans halfway with water and place them beneath the meat you are barbecuing. You want the pan or pans to take about half the space at the bottom of the grill.

3. Get the coals hot and put water-soaked wood chips on the coals.

Once the coals are hot, add a couple handfuls of the soaked wood on the coals. Place the top grill grate on the grill. Position the grill grate in a way that if you are using a hinged grill grate, one of the hinged areas lifts up over the coals so you can easily get to them.

 4. Put the meat on the grill away from the coals.

Lay the meat over the water pans as far away from the coals as possible. Under no circumstances should you let the meat rest directly over the coals. Cook in batches if you have to, and keep the finished meat in an oven set to “warm” while you do more.

Cover the grill, positioning the vent on the cover directly over the meat. This helps direct the smoke over the meat. Close all vents (bottom one, too!) to keep the temperature as low as you can go; if you have an especially tight lid, keep the vents open just a little.

5. Watch the temperature, check coals, and rotate meat.

Make sure the temperature of the grill lid never exceeds 325 F and that the meat generally stays in the 225-250 range.

If your temperatures get too high, open the lid and let the coals burn off, then add more soaked wood and close the lid again. If your temperature goes below 225, open the vents, and if that does not work open the lid and add more coals and soaked wood.

Every 60-90 minutes, rotate the meat and add more soaked wood.

6. Timing.

Different meats will take different amount of cooking times. The key thing to look for is meat on the bones pulling away or falling off the bones or easily separating. Here are a few examples.

Fish: 45-90 minutes
Chicken: 1-2 hours
Baby back ribs: 1.5-2.25 hours
Boston butt, beef brisket or tri-tip: Up to 6 hours

Do not add barbecue sauce until the last 30-45 minutes of cooking (except fish, which you should not add until the last 15 minutes).

If your meat is charred but not completely cooked yet, you can finish it in a 225 degree oven.

Once your meat is done, remove it to a platter, add more sauce and let it rest for 10-15 minutes. Let a big tri-tip or Boston butt rest for 20-25 minutes. Add even more sauce right at service and enjoy!

Meat Cooking Levels

There is an old #myth that you can use the so-called “squish test” on your hand to determine how well-done a piece of meat is. The problem with this is people’s hands are different – the only real test is to use a thermometer. Here is a handy guide to tell you how well done your meat actually is:

Level Temperature (F) Description
Rare 120 cold red center; soft
Medium Rare 130 warm red center; firmer
Medium 140 Pink and firm
Medium Well 150 Small amount of pink in the center
Well Done 160 Gray-brown throughout; firm

Note the Department of Agriculture generally recommends cooking most meat to 145 F to prevent illness.

 

OLW: Print gzipped, logrotated files together

Looking for #oneliners to scan some log files in #bash on #Linux that are automatically logrotated and gzipped along with the currently running log which is unzipped? This is a script that will print them all together so that you can pipe it to some custom grep/awk/sed logic to scan for information across your current and old logs simultaneously.

Put this logic in a file called xcat.sh (and of course give it execute permission):

for i in $@;do
[ ! -z “$(file -i $i | grep “gzip”)” ] && zcat $i || cat $i
done

Use it like so to scan all nginx logs:
$ ./xcat.sh /var/log/nginx/access.log*

“Fish and visitors smell in three days.” – Benjamin Franklin