Flashing the screen on Mac OS X
Here’s one way. There’s a C program to adjust the screen’s brightness written by Nicholas Riley, also available from this blog post by Matt (Danger) West. Get it. The rest is obvious. For instance, here’s a Python script, which should have probably been written in Perl:
import os, re, time s = os.popen('./brightness -l').read() ob = re.findall('brightness (\d.\d+)', s)[0] w = 0.2 for i in range(10): os.system('./brightness 0'); time.sleep(w) os.system('./brightness 1'); time.sleep(w) if(i==4): os.system("say beep") os.system('./brightness ' + ob)
Tune parameters to avoid epileptic seizures.
Or, to flash screen and say “beep” every 15 minutes:
#!/usr/bin/env python import datetime import re, time, subprocess def do(cmd): return subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) last = None while True: time.sleep(1) t = datetime.datetime.now() if t.minute % 15: continue if last==None or (t-last).seconds >= 60: last = t print "Flashing at ", t s = do(['./brightness', '-l']).stdout.read() brightnesses = re.findall('brightness (\d.\d+)', s) if not brightnesses: continue ob = brightnesses[0] for i in range(6): do(['./brightness', '0']); time.sleep(0.2) do(['./brightness', '1']); time.sleep(0.2) if i==3: do(['say', 'beep']) do(['./brightness', ob])
doesn’t work anymore
ithihasm
Mon, 2016-03-21 at 06:51:24
Still works for me (macOS Sierra, 10.12.6).
S
Sat, 2017-09-30 at 16:19:00