Skip to content

Instantly share code, notes, and snippets.

@ryaz
ryaz / aws-multipartUpload.js
Created September 22, 2016 22:36 — forked from sevastos/aws-multipartUpload.js
Example AWS S3 Multipart Upload with aws-sdk for Node.js - Retries to upload failing parts
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;
@ryaz
ryaz / login_helper.rb
Created August 5, 2016 23:48 — forked from theotherdon/login_helper.rb
Login a User programatically with ng-token-auth.
def login_user_programatically
# User or whatever the name of the model is that you're trying to authenticate
@request.env['devise.mapping'] = Devise.mappings[:user]
@resource = FactoryGirl.create(:confirmed_user)
# The following two lines are where the magic happens.
@auth_headers = @resource.create_new_auth_token
@request.headers.merge!(@auth_headers)
end
@ryaz
ryaz / aws-transcode.rb
Created October 14, 2015 16:46 — forked from bgkittrell/aws-transcode.rb
Uploads a directory of files to s3 and creates elastic transcoder jobs. Requires the aws-sdk gem. Usage ruby aws-transcode.rb /path/to/videos
require 'aws'
AWS.config(:access_key_id => 'XXXXX', :secret_access_key => 'XXXXX')
pipeline_id = 'XXXXXXX'
preset_id = 'XXXXXX'
s3 = AWS::S3.new
bin = s3.buckets['XXXXXX-in']
bout = s3.buckets['XXXXXX-out']