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
# install homebrew | |
# http://sourabhbajaj.com/mac-setup/Homebrew/ | |
sudo xcode-select --install | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
# install iterm2 | |
brew cask install iterm2 | |
# install zsh |
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
# LICENSE MIT | |
import utime as time | |
from gates import GateIn | |
from leds import LED | |
print('RUN: main.py') | |
from machine import Pin, SPI |
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 gates import GateIn | |
from leds import LED | |
print('RUN: main.py') | |
led = LED(23) | |
gate = GateIn(22) | |
while True: | |
if gate.is_high(): |
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
# blink the given pin at 1Hz 50% duty cycle | |
# use ctrl-c to end | |
# notify | |
print('LOAD: leds.py') | |
import sys, time | |
from machine import Pin | |
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 machine import Pin | |
class GateIn(object): | |
def __init__(self, pin_num): | |
self.pin_num = pin_num | |
self.pin = Pin(self.pin_num, Pin.IN) | |
def is_high(self): | |
return self.pin.value() == 1 |
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
#!/usr/bin/python3 | |
# ---------------------------------------------------------------------------------- | |
# NOTE: You can also use the Adafruit ampy script or WebREPL to do the same thing. | |
# replace.py = REPLace.py = REPL Ace Uploder | |
# Copyright (c) 2017 Clayton Darwin | |
# claytondarwin.com claytondarwin@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
song_query = { | |
"query": { | |
"bool": { | |
"must": [ | |
{"match": {"name": "Careless"}} | |
] | |
} | |
} | |
} |
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
collection = Song.filter(name="Sour") | |
for item in collection: | |
print('{}: Album - {}'.format(item.name, item.album.name)) |
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 datetime | |
from examples.song.factory import ElasticSearchFactory | |
from examples.song.song import Song | |
factory = ElasticSearchFactory(os.environ.get('ES_HOST'), os.environ.get('ES_PORT')) | |
es_client = factory.create() | |
Song.having(es=es_client) | |
Song.init() |
NewerOlder