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!
Tags: How Tos · perl · Programming
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!
Tags: How Tos
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!
Tags: How Tos · linux