Skip to content

Instantly share code, notes, and snippets.

#!/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
#!/bin/bash -e
/usr/bin/env ssh -q -2 -o "StrictHostKeyChecking=no" -i "/home/rightscale/.ssh/id_rsa" $1 $2
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():
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 = ''
# https://developers.facebook.com/apps
FACEBOOK_APP_ID = 'YOUR-APP-ID'
FACEBOOK_API_SECRET = 'YOUR-APP-SECRET'
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'))
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']:
import urllib
import urllib2
import urlparse
import json
from django.conf import settings
from django.core.urlresolvers import reverse
def get_user_data(request):
# https://dev.twitter.com/apps
TWITTER_CONSUMER_KEY = 'YOUR-APP-ID'
TWITTER_CONSUMER_SECRET = 'YOUR-APP-SECRET'
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')