{"id":680,"date":"2026-03-27T20:07:13","date_gmt":"2026-03-27T15:07:13","guid":{"rendered":"https:\/\/brainlessideas.com\/?p=680"},"modified":"2026-03-28T00:59:45","modified_gmt":"2026-03-27T19:59:45","slug":"quick-stresstest","status":"publish","type":"post","link":"https:\/\/brainlessideas.com\/index.php\/2026\/03\/27\/quick-stresstest\/","title":{"rendered":"Quick Stresstest"},"content":{"rendered":"<p>A quick python script to eat up some cpu.<\/p>\n<p>Run with this command to use more cores:<\/p>\n<p>powershell:<code><br \/>\nforeach ($i in 1..8) { Start-Job { python your_script.name.py } }<\/code><\/p>\n<p>linux:<br \/><code>for i in {1..8}; do python3 your_script_name.py &amp; done<\/code><\/p>\n<p>python:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>import sys\nfrom decimal import Decimal, getcontext<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<p><code>import sys<br>from decimal import Decimal, getcontext<\/code><\/p>\n\n\n\n<p>def stress_test_pi():<br># Set precision very high to force heavy CPU math<br># Increase this number for more RAM usage + CPU load<br>getcontext().prec = 10000<\/p>\n\n\n\n<p>print(&#8220;Starting Pi Stress Test&#8230; Press Ctrl+C to stop.&#8221;)<\/p>\n\n\n\n<p>pi = Decimal(0)<br>k = 0<\/p>\n\n\n\n<p>try:<br>while True:<br># Using Nilakantha Series for faster convergence\/heavy math<br># Formula: 3 + 4\/(2*3*4) &#8211; 4\/(4*5*6) + 4\/(6*7*8)&#8230;<br>if k == 0:<br>pi = Decimal(3)<br>else:<br>d = Decimal(2 * k)<br>term = Decimal(4) \/ (d * (d + 1) * (d + 2))<br>if k % 2 == 1:<br>pi += term<br>else:<br>pi -= term<\/p>\n\n\n\n<p># Print every 1000th iteration to avoid I\/O bottlenecks<br>if k % 1000 == 0:<br>sys.stdout.write(f&#8221;\\rCalculated {k} terms&#8230; Current Pi: {str(pi)[:50]}&#8230;&#8221;)<br>sys.stdout.flush()<\/p>\n\n\n\n<p>k += 1<br>except KeyboardInterrupt:<br>print(&#8220;\\n\\nTest stopped by user.&#8221;)<br>print(f&#8221;Final terms calculated: {k}&#8221;)<\/p>\n\n\n\n<p>if __name__ == &#8220;__main__&#8221;:<br>stress_test_pi()<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A quick python script to eat up some cpu.<\/p>\n<p>Run with this command to use more cores:<\/p>\n<p>powershell: foreach ($i in 1..8) { Start-Job { python your_script.name.py } }<\/p>\n<p>linux:for i in {1..8}; do python3 your_script_name.py &amp; done<\/p>\n<p>python:<\/p>\n<p> import sys from decimal import Decimal, getcontext <\/p>\n<p>import sysfrom decimal import Decimal, getcontext<\/p>\n<p>def stress_test_pi():# Set [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-680","post","type-post","status-publish","format-standard","hentry","category-uncategorized","odd"],"_links":{"self":[{"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":4,"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"predecessor-version":[{"id":685,"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/posts\/680\/revisions\/685"}],"wp:attachment":[{"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brainlessideas.com\/index.php\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}