Skip to content

Instantly share code, notes, and snippets.

View opethe1st's full-sized avatar
🕶️
.

Ope opethe1st

🕶️
.
View GitHub Profile
def flip(s):
res = []
for l in s:
if l=='+':
res.append('-')
else:
res.append('+')
return "".join(res)
def countFlips(s,k):
@opethe1st
opethe1st / lastword.py
Created April 11, 2017 11:27
lastword function
def lastWord(word):
if len(word)==1:
return word
lastletter = word[-1]
restOfWord = lastWord(word[:-1])
if ord(lastletter)>=ord(restOfWord[0]):
return lastletter+restOfWord
else:
return restOfWord+lastletter
@opethe1st
opethe1st / makehub
Last active August 29, 2015 14:17
Smart Farm
# Title
Smart Farm
# Picture
media: http://www.deviantsart.com/38fdru4.jpg
# Objective
A lot of people don't have the time or resources to grow their own food even though they would like to.
The goal of this project is to help ordinary people take care of their farms. It automatically waters the plants when it detects that the soil moisture level has gone below a certain treshold.
# Duration
2 hours
# Age Group
@opethe1st
opethe1st / gist:10490989
Created April 11, 2014 18:39
Arduino based PIR Motion sensor
// Uses a PIR sensor to detect movement, buzzes a buzzer
int ledPin = 13; // choose the pin for the LED
int inputPin = 2; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
int pinSpeaker = 10; //Set up a speaker on a PWM pin (digital 9, 10, or 11)
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
@opethe1st
opethe1st / makehub
Created April 11, 2014 16:29
Arduino Powered Burglar Alarm
# Title
Arduino Powered Burglar Alarm
# Picture
media: http://www.deviantsart.com/3099afr.jpg
# Objective
Nigeria is a very hot place. Temperature averages 30 degree Celsius and even at Night the temperature is hot. The aim of this project is to regulate temperature by turning on the fan whenever the temperature reaches a certain level and turn it off whenever the temperature drops. This helps to conserve energy and also to improve comfort for the owner.
# Duration
40min
# Age Group
all