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
# coding: utf-8 | |
# Imports | |
import os | |
import cPickle | |
import numpy as np | |
import theano | |
import theano.tensor as T |
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 RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
ADDRESS_PINS = [ | |
4, 17, 27, 22, 10, 9, 11, 5, 6, 13, 19, 26, 21, 20, 16, 12, | |
] | |
for pin in ADDRESS_PINS: | |
GPIO.setup(pin, GPIO.IN) |
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
# -*- coding:utf-8 -*- | |
""" | |
6502 cpu driver for python | |
""" | |
from Adafruit.I2C.Adafruit_I2C import Adafruit_I2C | |
from Adafruit.MCP230xx.Adafruit_MCP230xx import Adafruit_MCP230XX as MCP230XX | |
from logging import (getLogger, StreamHandler, DEBUG) | |
import time | |
import os |
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
root@raspberrypi:~# cat ./cpu6502.py | |
#!/usr/bin/env python | |
""" | |
run as root :) | |
""" | |
import RPi.GPIO as GPIO | |
import signal, sys, os, time | |
GPIO.setmode(GPIO.BCM) |
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 pathlib | |
import multiprocessing | |
from more_itertools import chunked | |
from bs4 import BeautifulSoup | |
HTML_DIR = "./html" | |
PROCESS_NUM = 8 | |
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 flask_wtf↲ | |
from wtforms import validators, StringField↲ | |
↲ | |
↲ | |
class SlackForm(flask_wtf.Form):↲ | |
trigger_word = StringField(u'trigger_word', [validators.required(), validators.length(max=10)])↲ | |
text = StringField(u'trigger_word', [validators.required()])↲ | |
user_name = StringField(u'user_name', [validators.required()])↲ | |
token = StringField(u'token', [validators.required()])↲ | |
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/env python | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" | |
if __name__ == "__main__": | |
app.run(host='0.0.0.0') |
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 remove_five(dl): | |
dl.remove(5) | |
return dl | |
def test_decorator(func): | |
print("now test_decorator") | |
def _wrapper(dl): | |
dl = remove_five(dl) | |
return func(dl) |
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 test_decorator(func): | |
print("now test_decorator") | |
def _wrapper(dl): | |
print("now _wapper func") | |
dl.remove(5) | |
func(dl) | |
return _wrapper | |
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/python | |
# -*- coding:utf-8 -*- | |
import RPi.GPIO as GPIO | |
import time | |
# 使うGPIOピンの番号 | |
IO_NO = 15 | |
IO_NO2 = 14 | |
IO_NO3 = 18 | |
sleep_time = 0.18 |