Skip to content

Instantly share code, notes, and snippets.

View DeastinY's full-sized avatar
🏠
Working from home

DeastinY DeastinY

🏠
Working from home
View GitHub Profile
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;
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
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'),
//Add OnClickAJAX to Switches
$(".bootstrap-switch").on('switchChange,boostrapSwitch',function(event,state) {
alert("Toggled!");
$.ajax({
url: '/togglelamp',
data: 'TEST',
type: 'POST'
});
});