Skip to content

Instantly share code, notes, and snippets.

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;
[supervisord]
nodaemon=true
logfile=supervisord.log
[supervisorctl]
[inet_http_server]
port = 127.0.0.1:9001
[rpcinterface:supervisor]
example.com/
example-dango/
homepage/
#!/bin/bash
WORKING_DIR=/home/myuser/example.com/example-django
cd ${WORKING_DIR}
source .server.envrc
source ENV/bin/activate
exec $@
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
"""
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
"""
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
{
"consumer_key": "YOUR CONSUMER KEY",
"consumer_secret": "YOUR CUSTOMER SECRET",
"access_token_key": "YOUR ACCESS TOKEN KEY",
"access_token_secret": "YOUR ACCESS TOKEN SECRET"
}
with open('sample.json') as f:
myJson = json.load(f)
f = open('sample.json')
myJson = json.load(f)
f.close()