This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # computer activity data collection for http://jehiah.cz/one-two/ | |
| # Originally by Jehiah Czebotar. This verison by Luca Spiller, then RJ Pittman. | |
| FILE="$HOME/Dropbox/activity_log/`hostname`-`date +%Y%m%d`.log" | |
| function log_activity() | |
| { | |
| local TIME=`date "+%Y-%m-%dT%H:%M:%S%z"` | |
| local IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 )) | |
| FILE="$HOME/Dropbox/daily_photo/`date +%Y%m%d`.png" | |
| if [ $IDLE -lt 61 ]; then | |
| PID=`ps auxww |grep loginwindow | grep -v grep | awk '{print $2}'` | |
| D=`date +%Y%m%d_%H%M%S` | |
| imagesnap $FILE | |
| fi |