"""
Intended to run on Windows resume. Scans for bluetooth devices and if a
particular device is not present, locks the computer.
"""
import bluetooth
import ctypes
import sys
# Bluetooth UID of "token" device
wanted = "XX:XX:XX:XX:XX:XX"
print "performing inquiry..."
# Hack.... if 0 devices are present, pybluez throws an exception
passed = False
try:
discovered = bluetooth.discover_devices()
if wanted in discovered:
print "Found phone"
passed = True
else:
passed = False
except:
passed = False
if not passed:
print "Locking"
ctypes.windll.user32.LockWorkStation()
另一个想法:从“joelonsoftware”中读取The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!),然后编写一个实用程序来扫描系统上的所有HTML文件,并确保它们被正确编码。也就是说,确保页面声明的内容类型与实际使用的内容类型相同。在
使用Python2.5,我编写了一个脚本,用于转储我的Subversion存储库,压缩转储文件,并将scp的转储文件转移到两个备份服务器上。把备份结果发邮件给我。这是每天都要做的。做了这些之后,我意识到我有多么喜欢Python,它有多么强大。在
下一步是修改脚本以使用rsync,并通过一些网站备份进行复制。在
当然向我展示了Python的实用性。在
我写了一个脚本,用我手机的蓝牙ID作为一种物理安全令牌。当电脑(Windows)从睡眠状态恢复时,它会扫描附近的蓝牙设备,如果找不到我的手机,就会锁定工作站。在
老掉牙的,不太安全,但符合目的。在
要求:
相关问题 更多 >
编程相关推荐