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 -e | |
# switch to the attachment directory | |
cd $RS_ATTACH_DIR | |
# move the sync script | |
mv sync.sh /home/rightscale/.ssh/sync.sh | |
# make script executable | |
chmod u+x /home/rightscale/.ssh/sync.sh |
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 -e | |
/usr/bin/env ssh -q -2 -o "StrictHostKeyChecking=no" -i "/home/rightscale/.ssh/id_rsa" $1 $2 |
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 django.forms import Form | |
from django.forms import ValidationError | |
from django.forms import FileField | |
# Django 1.6 Version | |
class BaseForm(Form): | |
def _clean_fields(self): | |
for name, field in self.fields.items(): |
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
TWITTER_CONSUMER_KEY = '' | |
TWITTER_CONSUMER_SECRET = '' | |
FACEBOOK_APP_ID = '' | |
FACEBOOK_API_SECRET = '' | |
GOOGLE_OAUTH2_CLIENT_ID = '' | |
GOOGLE_OAUTH2_CLIENT_SECRET = '' | |
MICROSOFT_CLIENT_ID = '' | |
MICROSOFT_CLIENT_SECRET = '' | |
YAHOO_CONSUMER_KEY = '' | |
YAHOO_CONSUMER_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
# https://developers.facebook.com/apps | |
FACEBOOK_APP_ID = 'YOUR-APP-ID' | |
FACEBOOK_API_SECRET = 'YOUR-APP-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
import urllib | |
from django.conf import settings | |
from django.core.urlresolvers import reverse | |
from django.core.context_processors import csrf | |
def get_authorization_url(request): | |
# URL to where Facebook will redirect to | |
redirect_url = urllib.quote_plus(settings.SITE_URL + reverse('register_facebook')) |
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 verify(request): | |
# Facebook will direct with state and code in the URL | |
# ?state=ebK3Np...&code=AQDJEtIZEDU...#_=_ | |
# ensure we have a session state and the state value is the same as what facebook returned | |
# also ensure we have a code from facebook (not present if the user denied the application) | |
if 'facebook_state' not in request.session \ | |
or 'state' not in request.GET \ | |
or 'code' not in request.GET \ | |
or request.session['facebook_state'] != request.GET['state']: |
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 urllib | |
import urllib2 | |
import urlparse | |
import json | |
from django.conf import settings | |
from django.core.urlresolvers import reverse | |
def get_user_data(request): |
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
# https://dev.twitter.com/apps | |
TWITTER_CONSUMER_KEY = 'YOUR-APP-ID' | |
TWITTER_CONSUMER_SECRET = 'YOUR-APP-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
import tweepy | |
from django.conf import settings | |
from django.core.urlresolvers import reverse | |
from django.core.context_processors import csrf | |
def get_authorization_url(request): | |
# URL to where we will redirect to | |
redirect_url = settings.SITE_URL + reverse('register_twitter') |