Skip to content

Instantly share code, notes, and snippets.

import water
if __name__ == "__main__":
water.auto_water()
<!DOCTYPE html>
<head>
<title>{{ title }}</title>
</head>
<body>
<h1>PLANT HELPLINE</h1>
<h2>The date and time on the server is: {{ time }}</h2>
<h2> {{ text }} </h2>
<a href="/auto/water/ON"><button>Turn ON Auto Watering</button></a>
@benrules2
benrules2 / flicker.py
Last active October 14, 2024 17:21
Causes Philips Hue lights to flicker
from qhue import Bridge
import time
import random
import sys
bridge_ip = "<hue_ip_address>"
username = "<username>"
my_lights = [light_id_1, light_id_2]
def flicker(bridge, elapsed_time, lights_list = [], transition = 10):
@benrules2
benrules2 / haunted.sh
Created October 14, 2017 19:39
Play video file and flicker lights
omxplayer -b haunted.mp4&
python3.4 flicker.py 45
@benrules2
benrules2 / ThingShadow.ino
Last active April 3, 2021 22:19
Alexa Smart Home and Arduino Yun Smart Light Code
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
@benrules2
benrules2 / fire.ino
Created December 11, 2017 03:33
Arduino Fireplace Code
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
@benrules2
benrules2 / shift_1.py
Last active September 27, 2018 01:54
Shift Cipher
class ShiftCipher:
def __init__(self, N = 13):
self.original_alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m",
"n","o","p","q","r","s","t","u","v","w","x","y","z"]
self.cipher_alphabet = self.original_alphabet[N:]
self.cipher_alphabet.extend(self.original_alphabet[0:N])
@benrules2
benrules2 / shift_2.py
Last active September 27, 2018 02:20
Shift Cipher
class ShiftCipher:
def __init__(self, N = 13):
[...]
def encrypt_message(self, message):
encrypted = ""
#lowercase the message as alphabets are lowercase
message = message.lower()
for letter in message:
if self.original_alphabet.count(letter) > 0:
@benrules2
benrules2 / shift_3.py
Last active September 27, 2018 11:39
Shift Cipher
class ShiftCipher:
[...]
import sys
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Not enough arguments, please provide e/d followed by the message")
N = 13
cipher = ShiftCipher(N)
@benrules2
benrules2 / shift.py
Created September 27, 2018 02:17
Shift Cipher
class ShiftCipher:
def __init__(self, N = 13):
self.original_alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m",
"n","o","p","q","r","s","t","u","v","w","x","y","z"]
self.cipher_alphabet = self.original_alphabet[N:]
self.cipher_alphabet.extend(self.original_alphabet[0:N])
def encrypt_message(self, message):
encrypted = ""
#lowercase the message as alphabets are lowercase