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 errno | |
import functools | |
import socket | |
from tornado import ioloop, web, httpserver, options | |
from couchbase.client import Couchbase | |
import json | |
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 twisted.web import server, resource | |
from twisted.internet import reactor | |
class HelloResource(resource.Resource): | |
isLeaf = True | |
numberRequests = 0 | |
def render_GET(self, request): | |
self.numberRequests += 1 | |
request.setHeader("content-type", "text/plain") |
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 twisted.web import server, resource | |
from twisted.internet import reactor | |
from couchbase.client import Couchbase | |
couchbase = Couchbase("ubuntumartini03:8091", "martini-tag-manager", "") | |
bucket = couchbase["martini-tag-manager"] | |
class HelloResource(resource.Resource): | |
isLeaf = 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
t=$(date +%s) | |
s=3600 | |
t=$(expr $t - $s) | |
filename="analytics.log."$(date -d @$t +%Y-%m-%d_%H) | |
echo $filename | |
networkfilename=$(date +%Y%m%d%H)-$(hostname).log | |
echo $networkfilename | |
python mtornado.py & | |
sleep 3900 | |
while true; do |
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
# primary server - proxypass to Django | |
server { | |
listen 80; | |
server_name dev.testproject.com; | |
access_log off; | |
error_log off; | |
# proxy to Apache 2 and mod_python | |
location / { |
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
#SETUP Instructions on ec2 machine | |
1. ssh into tornado machine | |
2. Run following commands: | |
sudo apt-get isntall pip | |
sudo pip install couchbase | |
sudo pip install tornado | |
3. fetch code from repository or copy paste | |
#HOW to START tornado? | |
Run following commands in mtornado folder: |
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
transaction,item | |
440081,Drama | |
440081,Romance | |
440082,Drama | |
440083,Drama | |
440083,Romance | |
440084,Short | |
440085,Drama | |
440086,Drama | |
440089,Action |
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
<?xml version="1.0"?> | |
<PMML version="4.1" xmlns="http://www.dmg.org/PMML-4_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dmg.org/PMML-4_1 http://www.dmg.org/v4-1/pmml-4-1.xsd"> | |
<Header copyright="Copyright (c) 2013 super-computer" description="arules association rules model"> | |
<Extension name="user" value="super-computer" extender="Rattle/PMML"/> | |
<Application name="Rattle/PMML" version="1.2.34r27"/> | |
<Timestamp>2013-06-19 20:39:58</Timestamp> | |
</Header> | |
<DataDictionary numberOfFields="2"> | |
<DataField name="transaction" optype="categorical" dataType="string"/> | |
<DataField name="item" optype="categorical" dataType="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
#!/usr/bin/env python | |
# Copyright (C) 2006-2013 Open Data ("Open Data" refers to | |
# one or more of the following companies: Open Data Partners LLC, | |
# Open Data Research LLC, or Open Data Capital LLC.) | |
# | |
# This file is part of Augustus. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. |
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 requests | |
key = "X-CT-API-KEY" | |
value = "13465408b353ba36ca5fd2dfa5246ef3" | |
url = "http://api.staging.cleartrip.com/air/1.0/search?from=BOM&to=DEL&depart-date=2013-09-09&return-date=2013-12-12" | |
headers = {key: value} | |
r = requests.get(url, headers=headers) | |
print r |
OlderNewer