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 twython import Twython | |
from picamera import PiCamera | |
from time import sleep | |
from datetime import datetime | |
import RPi.GPIO as GPIO | |
import random | |
from auth import ( | |
consumer_key, | |
consumer_secret, | |
access_token, |
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 space import Mission | |
from time import sleep | |
with Mission() as mission: | |
mission.launch() | |
while mission.explore(): | |
mission.discover() | |
mission.learn() | |
mission.phone_home() |
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 | |
from picamera.array import PiRGBArray | |
from astro_pi import AstroPi | |
ap = AstroPi() | |
while True: | |
with PiCamera() as camera: | |
camera.resolution = (64, 64) | |
with PiRGBArray(camera, size=(8, 8)) as stream: |
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 | |
sockets = [1, 2, 3, 4] | |
random.shuffle(sockets] # sockets is now e.g [4, 2, 1, 3] | |
sockets_1 = sockets[:1] # sockets_1 is now [4] | |
random.shuffle(sockets] # sockets is now e.g [2, 4, 3, 1] | |
sockets_2 = sockets[:2] # sockets_2 is now [2, 4] |
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
# instead of... | |
import RPi.GPIO as GPIO | |
from time import sleep | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setwarnings(False) | |
led = 2 | |
GPIO.setup(led, GPIO.OUT) |
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 gpiozero import PiTraffic | |
traffic = PiTraffic() | |
traffic.red.on() |
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
# Original | |
# 16 lines | |
from gpiozero import RyanteckRobot, Button | |
from signal import pause | |
robot = RyanteckRobot() | |
left = Button(26) | |
right = Button(16) |
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 gpiozero import LED | |
from time import sleep | |
red = LED(2) | |
blue = LED(3) | |
while True: | |
red.on() | |
sleep(1) | |
red.off() |
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 gpiozero import LED, Button | |
from time import sleep | |
from signal import pause | |
red = LED(21) | |
green = LED(24) | |
switch = Button(14, pull_up=False) | |
while True: | |
switch.wait_for_active() |
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
<?php $search_criteria = array( | |
"status" => "active", | |
"field_filters" => array( | |
"mode" => "all", | |
array( | |
"key" => "2", | |
"value" => date('Y-m-d'), | |
"operator" => ">", | |
), | |
array( |