导读:美国一位名叫扎拉·达尔(Zara Dar)的计算机科学女硕士放弃攻读博士学位,转而全职经营 OnlyFans 平台,成功赚取百万美元并还清学生贷款。
扎拉解释说,学术压力和经济不稳定促使她探索其他的道路。
Python 源代码如下:
import RPi.GPIO as GPIO
import time
import imaplib
import email
import pygame # import pygame library
# define the pins that will connect to the stepper motor driver
# GPIO pins
pin_seq = [17, 18, 27, 22]
# Setup GPIO
GPIO.setmode(GPIO.BCM)
for pin in pin_seq:
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, False)
# Motor sequence
step_seq = [
[1, 0, 0, 1],
[1, 0, 0, 0],
[1, 1, 0, 0],
[0, 1, 0, 0],
[0, 1, 1, 0],
[0, 0, 1, 0],
[0, 0, 1, 1],
[0, 0, 0, 1],
]
# Function to perform one step
def step(index):
for pin, value in zip(pin_seq, step_seq[index]):
GPIO.output(pin, value)
# Gmail IMAP server details
USERNAME = 'my-email@gmail.com' #replace with your email
APP_PASSWORD = '000000' # replace with your app password
MAIL_SERVER = 'imap.gmail.com'
SENDER_EMAIL = 'no-reply@email.com' #replace with the email account you want to receive a notification from
# Initialize pygame mixer
pygame.mixer.init()
# Load the sound file
sound = pygame.mixer.Sound("sound.wav") #replace with the name of the audio file you want to play
def check_email(user, app_pwd, mail_server, sender):
# connect to the server and go to its inbox
mail = imaplib.IMAP4_SSL(mail_server)
mail.login(user, app_pwd)
mail.select('inbox')
# search for the mail from the given sender and mark as unseen
result, data = mail.uid('search', None, '(FROM "{}" UNSEEN)'.format(sender))
mail_ids = data[0]
# if new mail, perform the stepper motor action
if mail_ids:
email_ids = mail_ids.split()
latest_email_id = email_ids[-1]
# mark the latest email as seen
mail.uid('store', latest_email_id, '+FLAGS', '(\Seen)')
# Play the sound
sound.play()
# Rotate motor 512 steps
for _ in range(512*4):
for i in range(len(step_seq)):
step(i)
time.sleep(0.0007) # Motor moves faster
while True:
check_email(USERNAME, APP_PASSWORD, MAIL_SERVER, SENDER_EMAIL)
time.sleep(20) # check every 20 seconds
# Cleanup
GPIO.cleanup()
作者:菜鸟教程
参考:https://ottrelease.org/zara-dar-viral-video/
本文为 @ 场长 创作并授权 21CTO 发布,未经许可,请勿转载。
内容授权事宜请您联系 webmaster@21cto.com或关注 21CTO 公众号。
该文观点仅代表作者本人,21CTO 平台仅提供信息存储空间服务。