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
| require "rubygems" | |
| require "net/http" | |
| require "uri" | |
| require "aws/s3" | |
| AWS::S3::Base.establish_connection!( | |
| :access_key_id => 'ACCESS KEY', | |
| :secret_access_key => 'SECRET KEY' | |
| ) |
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
| def new_method | |
| puts "YEAH" | |
| end |
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
| require 'aws-sdk' | |
| AWS_ACCESS_KEY = 'your_aws_access_key' | |
| AWS_SECRET_KEY = 'your_aws_secret_key' | |
| dynamo_db = AWS::DynamoDB.new(:access_key_id => AWS_ACCESS_KEY, :secret_access_key => AWS_SECRET_KEY) | |
| # create a table (50 read and 50 write capacity units) | |
| # create composite index using hash_key (:user_id) and range_key (:created_at) |
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
| require 'aws-sdk' | |
| AWS_ACCESS_KEY = 'your_aws_access_key' | |
| AWS_SECRET_KEY = 'your_aws_secret_key' | |
| dynamo_db = AWS::DynamoDB.new(:access_key_id => AWS_ACCESS_KEY, :secret_access_key => AWS_SECRET_KEY) | |
| # create a table (50 read and 50 write capacity units) | |
| # create primary key index using hash_key (:id) |
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
| require 'tweetstream' | |
| TweetStream.configure do |config| | |
| config.consumer_key = 'consumer_key' | |
| config.consumer_secret = 'consumer_secret' | |
| config.oauth_token = 'oauth_token' | |
| config.oauth_token_secret = 'oauth_token_secret' | |
| config.auth_method = :oauth | |
| config.parser = :json_pure | |
| end |
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
| require 'aws-sdk' | |
| require 'eventmachine' | |
| require 'tweetstream' | |
| AWS_ACCESS_KEY = 'your_aws_access_key' | |
| AWS_SECRET_KEY = 'your_aws_secret_key' | |
| dynamo_db = AWS::DynamoDB.new(:access_key_id => AWS_ACCESS_KEY, :secret_access_key => AWS_SECRET_KEY) | |
| table = dynamo_db.tables['tweets'] |
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
| require 'aws-sdk' | |
| AWS_ACCESS_KEY = 'your_aws_access_key' | |
| AWS_SECRET_KEY = 'your_aws_secret_key' | |
| dynamo_db = AWS::DynamoDB.new(:access_key_id => AWS_ACCESS_KEY, :secret_access_key => AWS_SECRET_KEY) | |
| table = dynamo_db.tables['tweets'] | |
| # don't forget to load the schema | |
| table.load_schema |
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
| require 'aws-sdk' | |
| require 'eventmachine' | |
| require 'tweetstream' | |
| AWS_ACCESS_KEY = 'your_aws_access_key' | |
| AWS_SECRET_KEY = 'your_aws_secret_key' | |
| dynamo_db = AWS::DynamoDB.new(:access_key_id => AWS_ACCESS_KEY, :secret_access_key => AWS_SECRET_KEY) | |
| table = dynamo_db.tables['tweets'] |
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
| require 'aws-sdk' | |
| AWS_ACCESS_KEY = 'your_aws_access_key' | |
| AWS_SECRET_KEY = 'your_aws_secret_key' | |
| dynamo_db = AWS::DynamoDB.new(:access_key_id => AWS_ACCESS_KEY, :secret_access_key => AWS_SECRET_KEY) | |
| table = dynamo_db.tables['tweets'] | |
| table.load_schema |
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
| results = ActiveRecord::Base.connection.execute("select light_curve_id from classifications where zooniverse_user_id=#{user.id}") | |
| results.each { |r| ids << r.first } | |
| ids_to_process = ids.flatten.uniq | |
| require 'enumerator' | |
| unless ids.empty? | |
| ids.each_slice(1000) do |a| | |
| RedisConnect.redis.sadd("zooniverse_user_#{user.id}", *a) | |
| end | |
| end |
OlderNewer