This file contains hidden or 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
\documentclass[a4paper]{report} %tipo de documento | |
\usepackage[utf8]{inputenc} | |
\usepackage[portuges]{babel} | |
\usepackage{graphicx} | |
\title{Título do documento} | |
\author{autor Nuno Khan \and autor Tales For The Unspoken} | |
\begin{document} | |
\maketitle |
This file contains hidden or 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
#On local machine | |
cd foo (your project folder parent) | |
git init | |
git add -A * (doesnt add empty folders, be carefull with netbeans config files) | |
git commit -m "My initial commit message" | |
#On local machine, in your git project | |
git remote add origin https://[email protected]/psychok7/human-computer-interaction.git | |
git push origin master |
This file contains hidden or 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 urllib2 ,argparse, shutil, urlparse , os , zipfile, os.path | |
from zipfile import ZipFile as zip | |
parser = argparse.ArgumentParser(description="Download and Unzip") | |
parser.add_argument('url', help='The action to take (e.g. install, remove, etc.)') | |
args = parser.parse_args() | |
url = args.url | |
def extractAll(zipName): | |
z = zip(zipName) |
This file contains hidden or 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 urllib2, json | |
def post(): | |
def basic_authorization(user, password): | |
s = user + ":" + password | |
return "Basic " + s.encode("base64").rstrip() | |
data = json.dumps({'username':'david2', 'email':'[email protected]' , 'password':'mypassword'}) |
This file contains hidden or 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
SETTINGS.PY: | |
from datetime import timedelta | |
CELERYBEAT_SCHEDULE = { | |
'add-every-30-seconds': { | |
'task': 'yourapp.tasks.teste', | |
'schedule': timedelta(seconds=5), | |
'args': (16, 16) | |
}, |
This file contains hidden or 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 re | |
class StripHtmlMixin(object): | |
#based on http://stackoverflow.com/a/3398894/977622 | |
def strip_html(self, data): | |
p = re.compile(r'<.*?>') | |
return p.sub('', data) |
This file contains hidden or 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 subprocess | |
import time | |
import smtplib | |
import string | |
# Author Nuno Khan | |
# Utility to check dynamic ip addresses | |
def save_new_Ip(p): | |
ip="" |
This file contains hidden or 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" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<AllowedMethod>PUT</AllowedMethod> | |
<AllowedMethod>POST</AllowedMethod> | |
<AllowedMethod>DELETE</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>Authorization</AllowedHeader> |
This file contains hidden or 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
DEFAULT_FILE_STORAGE = 'app.s3utils.MediaRootS3BotoStorage' | |
STATICFILES_STORAGE = 'app.s3utils.StaticRootS3BotoStorage' | |
AWS_ACCESS_KEY_ID = 'XXXXXXXXXXX' | |
AWS_SECRET_ACCESS_KEY = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' | |
AWS_STORAGE_BUCKET_NAME = 'app-bucket' | |
AWS_S3_SECURE_URLS = False # use http instead of https | |
AWS_QUERYSTRING_AUTH = False # we dont have any private files | |
S3_URL = 'http://s3-eu-west-1.amazonaws.com/%s' % AWS_STORAGE_BUCKET_NAME | |
MEDIA_ROOT = '/media/' |
This file contains hidden or 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
# hvad compatibility for rest_framework - JHA | |
class TranslatableModelSerializerOptions(serializers.ModelSerializerOptions): | |
def __init__(self, meta): | |
super(TranslatableModelSerializerOptions, self).__init__(meta) | |
# We need this ugly hack as ModelSerializer hardcodes a read_only_fields check | |
self.translated_read_only_fields = getattr(meta, 'translated_read_only_fields', ()) | |
self.translated_write_only_fields = getattr(meta, 'translated_write_only_fields', ()) | |
class HyperlinkedTranslatableModelSerializerOptions(serializers.HyperlinkedModelSerializerOptions): |
OlderNewer