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 | |
import sys | |
from max31855 import MAX31855, MAX31855Error | |
import time | |
import atexit | |
import RPi.GPIO as GPIO | |
from datetime import datetime | |
atexit.register(GPIO.cleanup) # 終了時にピンを落とす |
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 | |
import RPi.GPIO as GPIO | |
import time | |
import sys | |
import atexit | |
atexit.register(GPIO.cleanup) | |
pin = 35 # as board | |
GPIO.setmode(GPIO.BOARD) |
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
[program:cooker] | |
command=/etc/cooker/script/cooker-daemon.py | |
process_name=%(program_name)s_%(process_num)02d | |
numprocs=1 | |
autostart=false | |
autorestart=true | |
redirect_stderr=true |
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 _on_exit(): | |
print ("at exit") | |
turn_off() | |
time.sleep(1) | |
GPIO.cleanup() | |
print ("exit handler triggered") | |
time.sleep(1) | |
def on_exit(sig, func=None): | |
_on_exit() |
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 redis | |
redis_db = redis.Redis(host='127.0.0.1', port=6379, db=0) | |
new_setpoint = 0.0 | |
try: | |
new_setpoint = float(redis_db.get('cooker_target_temperature')) | |
except ValueError: | |
new_setpoint = 0.0 | |
if (new_setpoint > 0 and new_setpoint != setpoint): | |
print ("setpoint updated from " + str(setpoint) + " to " + str(new_setpoint)) |
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 | |
import redis | |
import sys | |
argvs = sys.argv | |
if (len(argvs) < 2): | |
print ("specify target temerature for first argument.") | |
sys.exit(1) | |
r = redis.Redis(host='127.0.0.1', port=6379, db=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
[program:front] | |
command=/etc/cooker/front/cooker-front.sh | |
process_name=%(program_name)s_%(process_num)02d | |
numprocs=1 | |
autostart=false | |
autorestart=true | |
redirect_stderr=true | |
environment=GOROOT="/usr/bin/go",GOPATH="/home/user/go_path" |
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
#!/bin/bash | |
event=$1 | |
device=$2 | |
curl -s --data "[mdadm]: @naotaco $event $device" $'https://[slack id].slack.com/services/hooks/slackbot?token=[token]&channel=%23[channel]' >/dev/null |
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
<Page | |
... | |
Loaded="Page_Loaded"> | |
<Grid x:Name="LayoutRoot"> | |
<Grid> | |
<Image x:Name="Image01" Source="your_source" /> | |
</Grid> | |
<VisualStateManager.VisualStateGroups> | |
<VisualStateGroup x:Name="WindowWidthStates"> |
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
private void Page_Loaded(object sender, RoutedEventArgs e) | |
{ | |
InitializeVisualStates(); | |
} | |
private void InitializeVisualStates() | |
{ | |
var groups = VisualStateManager.GetVisualStateGroups(LayoutRoot); | |
groups[0].CurrentStateChanged += (sender, e) => | |
{ |
OlderNewer