Top-rated recipes tagged "power"http://code.activestate.com/recipes/tags/power/top/2011-08-28T12:25:49-07:00ActiveState Code RecipesChek if a number is a power of two (Python)
2010-12-23T11:29:38-08:00A. Polinohttp://code.activestate.com/recipes/users/4176317/http://code.activestate.com/recipes/577514-chek-if-a-number-is-a-power-of-two/
<p style="color: grey">
Python
recipe 577514
by <a href="/recipes/users/4176317/">A. Polino</a>
(<a href="/recipes/tags/2/">2</a>, <a href="/recipes/tags/check/">check</a>, <a href="/recipes/tags/number/">number</a>, <a href="/recipes/tags/power/">power</a>, <a href="/recipes/tags/python/">python</a>).
Revision 2.
</p>
<p>Pretty good way to check if a number is a power of two or not.</p>
Check PC Power (Python)
2011-08-28T12:25:49-07:00Frank Larkinhttp://code.activestate.com/recipes/users/4179117/http://code.activestate.com/recipes/577861-check-pc-power/
<p style="color: grey">
Python
recipe 577861
by <a href="/recipes/users/4179117/">Frank Larkin</a>
(<a href="/recipes/tags/api/">api</a>, <a href="/recipes/tags/computer/">computer</a>, <a href="/recipes/tags/passing/">passing</a>, <a href="/recipes/tags/pointers/">pointers</a>, <a href="/recipes/tags/power/">power</a>, <a href="/recipes/tags/widows/">widows</a>).
</p>
<p>Call windows API GetSystemPowerStatus to determine if the AC power is on or off. Great example of calling Windows APIs using Ptyhon.</p>
Pad images to power-of-two dimensions. (Python)
2008-08-12T18:46:40-07:00Martin Wilsonhttp://code.activestate.com/recipes/users/4166376/http://code.activestate.com/recipes/576416-pad-images-to-power-of-two-dimensions/
<p style="color: grey">
Python
recipe 576416
by <a href="/recipes/users/4166376/">Martin Wilson</a>
(<a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/imaging/">imaging</a>, <a href="/recipes/tags/library/">library</a>, <a href="/recipes/tags/of/">of</a>, <a href="/recipes/tags/opengl/">opengl</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/power/">power</a>, <a href="/recipes/tags/power_of_two/">power_of_two</a>, <a href="/recipes/tags/python_imaging_library/">python_imaging_library</a>, <a href="/recipes/tags/two/">two</a>).
Revision 4.
</p>
<p>Pads any amount of images each to power-of-two dimensions, useful for OpenGL programming.</p>