This file contains hidden or 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
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; | |
server { | |
listen 80; | |
listen [::]:80; | |
return 301 https://blog.$server_name$request_uri; | |
server_name ars-artificia.com; | |
root /usr/share/nginx/html; | |
index index.html index.htm; |
This file contains hidden or 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 collections import namedtuple | |
import os | |
import phue | |
import json | |
import logging | |
Lamp = namedtuple('Lamp', 'name state') | |
# setup lamps on first startup | |
bridge = phue.Bridge("192.168.0.10") # TODO: Bad hardcoded string |
This file contains hidden or 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 flask import Flask, render_template, redirect, request,jsonify | |
from flask.ext.navigation import Navigation | |
from lampcontrol import lampcontrol | |
app = Flask(__name__) | |
nav = Navigation(app) | |
# Create Navigation | |
nav.Bar('top', [ | |
nav.Item('Lamps', 'index'), |
This file contains hidden or 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
//Add OnClickAJAX to Switches | |
$(".bootstrap-switch").on('switchChange,boostrapSwitch',function(event,state) { | |
alert("Toggled!"); | |
$.ajax({ | |
url: '/togglelamp', | |
data: 'TEST', | |
type: 'POST' | |
}); | |
}); |
NewerOlder