Brain Goo

Carpe Crap ‘em

Brain Goo header image 1

How To Prevent A PERL Script From Running As Root

March 29th, 2011 · No Comments

At or near the top of your app, before it executes anything sensitive, place the following code:

if((getpwuid($<) eq "root") || ($< == 0)){
print STDOUT "Cannot run as root!\n";
exit(1);
}

Did you find this post useful or have questions or comments? Please let me know!

→ No CommentsTags: How Tos · perl · Programming

How to Calculate BTU from Watts

February 2nd, 2011 · 2 Comments

This post came about because I got a lot of hits from people looking for this information on the How To Calculate Server Heat post.

1 Watt will produce 3.412 BTU per hour

To calculate the BTU/heat output of an electrical system, substitute BTUs for Watts and use the following equation:

BTU/h = (V * I) * 3.412

Where:
V = Volts
I = Amperes (Amps or Current)

Using the simple math above, we can calculate the heat produced by an appliance on a 120v (US Standard) system drawing 2 Amps for 60 minutes (1 hour).

BTU/h = 3.412 * (120 * 2) = 818.88BTU

Did you find this post useful or have questions or comments? Please let me know!

→ 2 CommentsTags: How Tos

HOWTO Turn off Line Numbers in VI

May 20th, 2010 · No Comments

I always forget how to turn off line numbers in VI. The answer is: set nonumbers or set nonu. It’s all about the little things…

Did you find this post useful or have questions or comments? Please let me know!

→ No CommentsTags: How Tos · linux