梦想一言

人都有一梦想,无论男女,老少,至于已经深藏多久,在无人独处那一刻,总会想起那遥远的梦想,似乎还在昨天,却远去多时。

能还在一直追逐梦想,虽然个中滋味自知,但那是幸福是事。是一生中最大的勇气与幸福。

年至不惑,方悟,努力实现自己的梦想,和帮助世人实现他们的梦想,都是很值得每天去想,去做,去经营的事情。

因,梦想带来希望,漆黑中,梦想是那引路明灯,照着你我一路前行

ssh 免密码登录

ssh-keygen -t rsa

公钥复制进authorized_keys文件里:

cat id_rsa.pub >> ~/.ssh/authorized_keys

私钥文件id_rsa复制到windows上,用puttygen.exe生成对应的ppk文件,然后在putty configuration->category->connection->SSH->Auth->private key file for authentication里指定这个ppk文件,然后登录时只需要输入用户名就能登录过去

树莓派温控风扇

#coding=utf-8
#!/usr/bin/python
import sys
import time
try:
	import RPi.GPIO as GPIO
except RuntimeError:
    print("Error importing RPi.GPIO!  This is probably because you need superuser privileges.  You can achieve this by using 'sudo' to run your script")
def cpu_temp():
    with open("/sys/class/thermal/thermal_zone0/temp", 'r') as f:
        return float(f.read())/1000
def main():
    # Simplex use BCM-->4 pin control the fan 
    channel = 4
    # Duplex use BCM-->17 pin control the fan
    #channel = 17

# GPIO.setmode(GPIO.BOARD)#也许使用扩展board导致标注的数字是BCM的,猜测而已。
    GPIO.setmode(GPIO.BCM)
    GPIO.setwarnings(False)
    # close air fan first
    GPIO.setup(channel, GPIO.OUT, initial=GPIO.LOW)
    is_close = True
    while True:
        temp = cpu_temp()
        if is_close:
            if temp > 49.0:
                print time.ctime(), temp, '℃ open air fan'
                GPIO.output(channel, 1)
                is_close = False
        else:
            if temp < 47.0:
                print time.ctime(), temp, '℃ close air fan'
                GPIO.output(channel, 0)
                is_close = True
        time.sleep(2.0)
        print time.ctime(), temp, '℃'
if __name__ == '__main__':
    main()

https://blog.csdn.net/brucewata/article/details/88076312

https://www.jianshu.com/p/20fea50cf483