Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am strife25 on github.
  • I am jryding (https://keybase.io/jryding) on keybase.
  • I have a public key whose fingerprint is 0F0E 61AC AD6F BB41 6060 D052 953A 1B0C BB0C 5BB7

To claim this, I am signing this object:

@linusthe3rd
linusthe3rd / aws_creds_export.sh
Last active September 1, 2016 16:57
Export AWS Credentials into Environment Vars
# If you use multiple AWS environments, change this to your profile name to export a different set of credentials
export AWS_PROFILE=default
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
@linusthe3rd
linusthe3rd / gist:432c8354d293d1ad4713
Created July 20, 2015 19:29
Check if Import/Dependency is Available at Runtime
from __future__ import print_function
// ...other dependencies...
try:
import requests
except ImportError:
print('You must install the "requests" package in order to use '
'the sync writer: `pip install requests`')
from boto.dynamodb2 import connect_to_region
from boto.provider import Provider
aws_settings_provider = Provider('aws')
def create_connection():
aws_region = # get the AWS region of the EC2 instance
# connect_to_region passes along the named arguments to the DynamoDBConnection class that gets created
return connect_to_region(
input[type="submit"],
input[type="reset"],
input[type="button"],
button,
textarea {
font-family: inherit;
-webkit-font-smoothing: inherit;
}
// ...other instantiation logic...
var userID = getIDFromPageURI();
var user = null;
var loadUser = function (id) {
// GET the latest state of the user from the backend
$.get("/api/user" + id)
.done(function (response) {
if (!user) {
fill(myModel, newData);
// myModel's new value:
// {
// "foo": 1, // the "foo" attribute was not modified
// "bar": "baz"
// }
merge(myModel, newData);
// myModel's new value:
// {
// "foo": "newValue", // the "foo" attribute has a new value
// "bar": "baz"
// }
var myModel = {
"foo": 1
}
var newData = {
"foo": "newValue",
"bar": "baz"
}
var attempts = 1;
function createWebSocket () {
var connection = new WebSocket();
connection.onopen = function () {
// reset the tries back to 1 since we have a new connection opened.
attempts = 1;
// ...Your app's logic...