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
server { | |
server_name www.example.com; | |
access_log /var/log/nginx/example.com.log; | |
error_log /var/log/nginx/example.com.error.log debug; | |
root /home/myuser/example.com/homepage; | |
sendfile on; | |
# if the uri is not found, look for index.html, else pass everthing to gunicorn | |
location / { | |
index index.html; |
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
[supervisord] | |
nodaemon=true | |
logfile=supervisord.log | |
[supervisorctl] | |
[inet_http_server] | |
port = 127.0.0.1:9001 | |
[rpcinterface:supervisor] |
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
example.com/ | |
example-dango/ | |
homepage/ | |
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 | |
WORKING_DIR=/home/myuser/example.com/example-django | |
cd ${WORKING_DIR} | |
source .server.envrc | |
source ENV/bin/activate | |
exec $@ |
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 environ | |
import os | |
root = environ.Path(__file__) - 2 # two folders back (/a/b/ - 2 = /) | |
env = environ.Env(DEBUG=(bool, False),) # set default values and casting | |
GOOGLE_ANALYTICS_ID=env('GOOGLE_ANALYTICS_ID') | |
SITE_DOMAIN = env('SITE_DOMAIN') | |
SITE_ROOT = root() | |
DEBUG = env('DEBUG') # False if not in os.environ |
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
""" | |
To evaluate the good or bad score of a tweet, we first tokenize the tweet, and then | |
stemmize each word in our tweet. We also associate each stem with positive and negative values, | |
respectively, using a dictionary. | |
Finally, we caculate the average word weight of a tweet, and decide if it's a good or bad one | |
based on that. | |
""" | |
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
""" | |
To evaluate the good or bad score of a tweet, we count the number of good and | |
bad words in it. | |
if a word is good, increase the value of good_words by one | |
else if a word is bad, increase the value of bad_words by one | |
if good_words > bad_words then it's a good tweet otherwise it's a bad tweet | |
""" | |
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
{ | |
"consumer_key": "YOUR CONSUMER KEY", | |
"consumer_secret": "YOUR CUSTOMER SECRET", | |
"access_token_key": "YOUR ACCESS TOKEN KEY", | |
"access_token_secret": "YOUR ACCESS TOKEN SECRET" | |
} |
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
with open('sample.json') as f: | |
myJson = json.load(f) |
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
f = open('sample.json') | |
myJson = json.load(f) | |
f.close() |
NewerOlder