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
//Add OnClickAJAX to Switches | |
$(".bootstrap-switch").on('switchChange,boostrapSwitch',function(event,state) { | |
alert("Toggled!"); | |
$.ajax({ | |
url: '/togglelamp', | |
data: 'TEST', | |
type: 'POST' | |
}); | |
}); |
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 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 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 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 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
upstream php-handler { | |
server 127.0.0.1:9000; | |
#server unix:/var/run/php5-fpm.sock; | |
} | |
server { | |
listen 80; | |
server_name cloud.ars-artificia.com; | |
# enforce https | |
return 301 https://$server_name$request_uri; |
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: latin-1 -*- | |
#:kivy 1.9.0 | |
#:import NavigationDrawer kivy.garden.navigationdrawer | |
#:import RandChar chargen.randchar | |
<WrapLabel@Label>: | |
text_size: self.size | |
<SidePanel@GridLayout>: |
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
ExifTool Version Number : 10.10 | |
File Name : DSC_0040.NEF | |
Directory : . | |
File Size : 19 MB | |
File Modification Date/Time : 2016:06:14 10:32:06+02:00 | |
File Access Date/Time : 2016:06:14 10:32:06+02:00 | |
File Inode Change Date/Time : 2016:06:14 10:32:06+02:00 | |
File Permissions : rwx------ | |
File Type : NEF | |
File Type Extension : nef |
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 json | |
>>> f = open("somefile.json") | |
>>> d = json.load(f) | |
>>> print d | |
{u'95659045': {u'90': False}} | |
>>> f.seek(0) | |
>>> l = f.readlines() | |
>>> print l | |
['{"95659045": {"1": false}, "95659045": {"90": false}}'] | |
>>> |
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 unique(iterable): | |
# http://stackoverflow.com/questions/6534430/why-does-pythons-itertools-permutations-contain-duplicates-when-the-original | |
seen = set() | |
for i in iterable: | |
if str(i) in seen: | |
continue | |
seen.add(str(i)) | |
yield i | |
states = [i for i in unique(itertools.permutations([[2,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
... | |
['like', 'feel', 'girls', 'cause', 'make', 'said', 'shit', 'bitch', 'chorus', 'em'] | |
['que', 'el', 'te', 'yo', 'tu', 'en', 'lo', 'mi', 'se', 'es'] | |
['oh', 'gonna', 'ah', 'uh', 'ooh', 'whoa', 've', 'hands', 'woah', 'beautiful'] | |
['love', 'want', 'heart', 'need', 'real', 'way', 'cause', 'live', 'boy', 'game'] | |
['la', 'el', 'en', 'los', 'ella', 'ooh', 'hey', 'es', 'pa', 'las'] | |
['na', 'music', 'choose', 'cool', 'bump', 'ready', 'hey', 'bad', 'shine', 'shoe'] | |
['don', 'wanna', 'want', 'stop', 'need', 'say', 'cause', 'care', 'think', 'tell'] | |
['yeah', 'hard', 'ah', 'ooh', 'hey', 'right', 'money', 'woah', 'party', 'whoa'] | |
['got', 've', 'money', 'party', 'cause', 'boy', 'em', 'look', 'bitch', 'damn'] |
OlderNewer