This file contains 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
from picamera import PiCamera, Color | |
from time import sleep | |
import datetime as dt | |
camera = PiCamera() | |
# 8 hour timeplase with image taken every 10 seconds | |
for i in range(2880): | |
camera.annotate_background = Color("black") | |
camera.annotate_text = dt.datetime.now().strftime("PiLapse %m-%d-%Y %H:%M:%S") |
This file contains 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
from picamera import PiCamera, Color | |
from time import sleep | |
import datetime as dt | |
camera = PiCamera() | |
camera.annotate_background = Color("black") | |
start = dt.datetime.now() | |
camera.start_recording("recording.h264") | |
while (dt.datetime.now() - start).seconds < 3600: # total seconds for length of recording |
This file contains 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
# Allow less secure apps to access your Gmail account | |
# https://en.wikipedia.org/wiki/List_of_SMS_gateways | |
# 10digitNumber@mms.att.net for AT&T | |
# 10digitNumber@pm.sprint.com for Sprint | |
# 10digitNumber@tmomail.net for T-Mobile | |
# 10digitNumber@vzwpix.com for Verizon | |
from gpiozero import MotionSensor |
This file contains 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
# allow less secure apps to access your Gmail at: https://support.google.com/accounts/answer/6010255?hl=en | |
# https://en.wikipedia.org/wiki/List_of_SMS_gateways | |
# ten_digit_number@mms.att.net for AT&T | |
# ten_digit_number@pm.sprint.com for Sprint | |
# ten_digit_number@tmomail.net for T-Mobile | |
# ten_digit_number@vzwpix.com for Verizon | |
import smtplib | |
username = "your_address@gmail.com" |
This file contains 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
def fizz_buzz(): | |
for num in range(1,101): | |
if num % 5 == 0 and num % 3 == 0: | |
print("FizzBuzz") | |
elif num % 3 == 0: | |
print("Fizz") | |
elif num % 5 == 0: | |
print("Buzz") |
This file contains 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
# Enable less secure apps in Gmail | |
import os | |
import smtplib | |
import email | |
import sys | |
import picamera | |
import time | |
from datetime import datetime | |
from email.mime.multipart import MIMEMultipart |
This file contains 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
words = ["hello", "Break", "cat", "blue", "brown", "zoo", "baby", "pie", "BOOM!"] | |
def b_count(lst): | |
# prints index and string of every element in a list that starts with the letter 'b' or 'B' | |
for i in lst: | |
if i.startswith("b") or i.startswith("B"): | |
print("Index " + str(lst.index(i)) + ": " + i) | |
b_count(words) |
This file contains 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
# Allow less secure apps to access your gmail account | |
import email | |
import smtplib | |
fromaddr = "yourAddress@gmail.com" | |
toaddr = "toAddress@domain.com" | |
msg = "Content of your email message." | |
username = "yourGmailAddress" |
This file contains 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
import random | |
with open("eight_ball_answers.txt", "r") as f: | |
answers = f.read() # read in text as string | |
answers = answers.strip().replace('"', '') # remove white space and double quotes | |
answers = answers.strip('[]').split(', ') # remove the square brackets and split on separator | |
question = input("Ask a question or enter \"N\" to quit: ") | |
while not(question.upper().startswith("N")): |
This file contains 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
# tutorial to connect PIR sensor to RPi at: https://www.raspberrypi.org/learning/parent-detector/worksheet/ | |
# download the Pygame package at: http://www.pygame.org/download.shtml | |
# download free .wav audio files at: http://soundbible.com/ | |
# this scream horror .wav file is a favoriate: http://soundbible.com/1627-Female-Scream-Horror.html | |
from gpiozero import MotionSensor | |
import pygame.mixer | |
from pygame.mixer import Sound | |
import random | |
from time import sleep |
OlderNewer