Skip to content

Instantly share code, notes, and snippets.

@ishan1608
Last active November 8, 2024 12:22
Show Gist options
  • Save ishan1608/87cb762f31b7af70a867 to your computer and use it in GitHub Desktop.
Save ishan1608/87cb762f31b7af70a867 to your computer and use it in GitHub Desktop.
A python script to heat your computer so that your fingers can work upon your laptop in winter.
"""Heater
A program that spawns as much number of processes as there are CPUs on the computer.
This keeps the core temprature high.
I made this so that my fingers feel more comfortable while working on my laptop during winter.
Caution : An eye should be kept on the CPU temprature so that when it is getting too hot,
the prgoram needs to be killed; else it can damage the CPU.
Author : Ishan
Email : [email protected]
"""
import multiprocessing
import sys
def round_robin_count():
while(True):
number = 0
if(number >= sys.maxsize):
number = 0
else:
number = number + 1
if __name__ == "__main__":
if len(sys.argv) == 2 and sys.argv[1] == '--about':
print(__doc__)
elif len(sys.argv) == 2 and sys.argv[1] == '--help':
print('Heater', 'USAGE: python3 ' + sys.argv[0] + ' [option]', sep='\n')
print('To read about.', 'python3 ' + sys.argv[0] + ' --about' ,sep=' ')
print('To see this help message.', 'python3 ' + sys.argv[0] + ' --help', sep=' ')
else:
process_count = 1
print('Heating up the CPU')
while(process_count <= multiprocessing.cpu_count()):
process_to_be_not_seen_again = multiprocessing.Process(target=round_robin_count)
process_to_be_not_seen_again.start()
process_count += 1
@TreWade1469
Copy link

How do you use it or like turn it on or control it or whatever

@ishan1608
Copy link
Author

@TreWade1469 I execute the python script and when I feel my fingers are warm enough, I kill the process using ctrl + c.

@TreWade1469
Copy link

How do you download it, and turn it on?

@ishan1608
Copy link
Author

@TreWade1469 Running a python script is a pretty basic step. (Not that I am assuming anything here).
But, if you don't know how to do that. May I please ask you not to run this script and rather first learn the basics of python first.
There are tons of tutorials/courses available on the internet.
Please go through them first as running this script could be dangerous and kill your device.
I don't want you to mistakenly harm your device.

@TreWade1469
Copy link

Ok thanks

@Speed3k-python
Copy link

Speed3k-python commented May 1, 2024

@ishan1608
Instead of
process_to_be_not_seen_again = multiprocessing.Process(target=round_robin_count)
process_to_be_not_seen_again.start()
Use:
if __name__ == "__main__":
process_to_be_not_seen_again = multiprocessing.Process(target=round_robin_count)
process_to_be_not_seen_again.start()

@ishan1608
Copy link
Author

@Speed3k-python That piece of code is already inside the if __name__ == "__main__": block.
What would adding another redundant condition do?

@shylilguy
Copy link

This is for the ants in my laptop!

@ishan1608
Copy link
Author

This is for the ants in my laptop!

🤣 Never thought of this use case.

@FFUV
Copy link

FFUV commented Sep 2, 2024

man ur a life saver I was wearing shorts and using my MacBook so it hit me with an extreme cold so I am now using this much love!

@MinhDGuy
Copy link

MinhDGuy commented Nov 8, 2024

HOW TO STOP IT HELP!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment