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
| """ | |
| This file provides an eventlet based S3 uploader for django-ajax-uploader. It | |
| supports chunk retry and chunk parallelism for efficient uploads. | |
| This backend will only work with the forked django-ajax-uploader from my | |
| multipart-post branch which adds some efficiencies to file upload. | |
| django-ajax-uploader: https://github.com/brosner/django-ajax-uploader/tree/multipart-post | |
| Author: Brian Rosner <[email protected]> |
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 requests | |
| from requests.auth import OAuth1 | |
| url = u'https://api.twitter.com/1/account/settings.json' | |
| client_key = u'...' | |
| client_secret = u'...' | |
| resource_owner_key = u'...' | |
| resource_owner_secret = u'...' |
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
| Guess the output: | |
| >>> def exec_code_object_and_return_x(codeobj, x): | |
| ... exec codeobj | |
| ... return x | |
| ... | |
| >>> co1 = compile("""x = x + 1""", '<string>', 'exec') | |
| >>> co2 = compile("""del x""", '<string>', 'exec') | |
| >>> exec_code_object_and_return_x(co1, 1) | |
| # What do you get here? |
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
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
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
| heroku pgbackups:restore DATABASE `heroku pgbackups:url --app instruments2` --app instruments2-staging |
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 requests | |
| from urlparse import urlparse, urljoin | |
| URL_SHORTENERS = [ | |
| 'bit.ly', | |
| 'ow.ly', | |
| 'dlvr.it', | |
| 'fb.me', | |
| '4sq.com', | |
| 'is.gd', |
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
| mkdir -p bin | |
| bundle exec bash -c 'cat > bin/activate <<EOF | |
| #!/bin/sh | |
| export BUNDLE_BIN_PATH="$BUNDLE_BIN_PATH" | |
| export PATH="$PATH" | |
| export BUNDLE_GEMFILE="$BUNDLE_GEMFILE" | |
| export RUBYOPT="$RUBYOPT" | |
| EOF' | |
| source bin/activate |
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 boto | |
| s3 = boto.connect_s3() | |
| bucket = s3.lookup('mybucket') | |
| key = bucket.lookup('mykey') | |
| # Copy the key onto itself, preserving the ACL but changing the content-type | |
| key.copy(key.bucket, key.name, preserve_acl=True, metadata={'Content-Type': 'text/plain'}) | |
| key = bucket.lookup('mykey') |
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
| Dear soon-to-be-former user, | |
| We've got some fantastic news! Well, it's great news for us anyway. You, on | |
| the other hand, are fucked. | |
| We've just been acquired by: | |
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
| <!-- this usually goes in <project-root>/templates/uni_form/field.html --> | |
| {% if field.is_hidden %} | |
| {{ field }} | |
| {% else %} | |
| <div class="clearfix {% if field.errors %}error{% endif %}"> | |
| <label for="{{ field.auto_id }}" {% if field.field.required %}class="requiredField"{% endif %}> | |
| {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} | |
| </label> | |
| <div class="input"> |