Skip to content

Instantly share code, notes, and snippets.

View timothyslau's full-sized avatar
💭
There's data in my veins.

Timothy Lau timothyslau

💭
There's data in my veins.
View GitHub Profile
@thebecwar
thebecwar / chudnovsky.py
Created March 18, 2018 03:56
Chudnovsky Algorithm in Python
import decimal
# for reference, the first 100 digits of pi
pi = decimal.Decimal('3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679')
# Basic recursive factorial calculation. For large n switch to iterative.
def fact(n):
if n == 0:
return 1
largest = None
smallest = None
while True:
inp = raw_input("Enter a number: ")
if inp == "done" : break
try:
num = float(inp)
except:
print ("Invalid input")
@deanbot
deanbot / keepawake.ps1
Last active July 19, 2022 16:03 — forked from jamesfreeman959/keepawake.ps1
PowerShell script to keep a Windows PC awake
# PowerShell script to keep a Windows PC awake
Write-Host "Keeping PC awake... (send Ctrl+C to quit)"
while (1) {
$wsh = New-Object -ComObject WScript.Shell
$wsh.SendKeys('+{F15}')
Start-Sleep -seconds 59
}