This file contains 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 'nokogiri' | |
require 'pg' | |
require 'json' | |
require 'parallel' | |
require 'timeout' | |
def score( array ) | |
array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1} | |
end |
This file contains 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 'posix/spawn' | |
require 'pry' | |
require 'active_support/all' | |
years = (2010..2016).to_a | |
quarters = (1..4).to_a | |
This file contains 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 'unirest' | |
require 'pp' | |
STOCKTWITS_QUEUE_URL = 'PATH TO YOUR QUEUE GOES HERE...' # looks like https://sqs.REGION.amazonaws.com/######/name | |
STOCKTWITS_API_URL = 'https://api.stocktwits.com/api/2/messages/create.json?access_token=ACCESS_TOKEN_OF_STOCKTWITS_USER_TO_POST' | |
Aws.config.update({ | |
region: 'REGION', | |
credentials: Aws::Credentials.new('ACCESS KEY', 'SECRET') |
This file contains 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
# credit to this person for a js implementation of the function, http://stackoverflow.com/users/3473058/user3473058 | |
def find_local_maxima(input_array) | |
goAsc = false # ascending move | |
goDesc = false # descending move | |
local_maxima = [] | |
index = 0 | |
while (index < (input_array.length - 1)) do |
This file contains 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 'mysql2' | |
client = Mysql2::Client.new(:host => "localhost", :username => "*USERNAME*", :password => "*PASSWORD*", :database => "*DATABASENAME*", :local_infile => true) | |
puts 'Downloading EOD data' | |
system('curl -J -L -oeod https://www.quandl.com/api/v3/databases/EOD/data?auth_token=**AUTHTOKEN**') | |
puts 'UnZIPPING EOD Data' | |
system('unzip -p eod > eod2') | |
puts 'Filtering out EOD Data before 2014' | |
system('awk -F, \'$2 > "2014" {print}\' eod2 > eod_since_2014') | |
puts 'Dropping the EOD table' | |
client.query("DROP TABLE adj_eod") |
This file contains 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
hermione@localhost:/var/www/laduree/current$ ls -la public/assets/ | |
total 836 | |
drwxrwxr-x 11 hermione hermione 4096 Feb 20 01:10 . | |
drwxrwxr-x 3 hermione hermione 4096 Feb 20 01:07 .. | |
-rw-rw-r-- 1 hermione hermione 493891 Jan 29 21:38 application-96cd30a6dfe95592f924694e874e8ac3.js | |
-rw-rw-r-- 1 hermione hermione 132384 Jan 29 21:38 application-96cd30a6dfe95592f924694e874e8ac3.js.gz | |
-rw-rw-r-- 1 hermione hermione 105384 Feb 20 00:23 application-d5d25d4b43c2c8534e0fedfdc933c0d4.css | |
-rw-rw-r-- 1 hermione hermione 18242 Feb 20 00:23 application-d5d25d4b43c2c8534e0fedfdc933c0d4.css.gz | |
drwxrwxr-x 2 hermione hermione 4096 Feb 20 01:10 blue-on-light | |
drwxrwxr-x 2 hermione hermione 4096 Feb 20 01:10 brand_logos |
This file contains 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
Zackattack::Application.configure do | |
# Settings specified here will take precedence over those in config/application.rb | |
# Code is not reloaded between requests | |
config.cache_classes = true | |
# Full error reports are disabled and caching is turned on | |
config.consider_all_requests_local = false | |
config.action_controller.perform_caching = true |
This file contains 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
csv: | |
time, price | |
read in csv; populate array: | |
price_data = [[time,price],[time,price]] | |
sort array on time | |
pct_aggregate = []; | |
pct_aggregate_summed = []; |
This file contains 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
sample input | |
vol, time, price | |
10, 1:00pm, 5 | |
10, 1:01pm, 5.05 | |
10, 1:03pm, 5.025 | |
10, 1:04pm, 4.99 | |
10, 1:05pm, 4.99499 | |
should give output of... |
This file contains 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
root@localhost:/usr/local/rvm/gems/ruby-2.0.0-p0/gems# gem install memcached | |
Building native extensions. This could take a while... | |
ERROR: Error installing memcached: | |
ERROR: Failed to build gem native extension. | |
/usr/local/rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb | |
extconf.rb:7:in `<main>': Use RbConfig instead of obsolete and deprecated Config. | |
extconf.rb:7:in `<main>': Use RbConfig instead of obsolete and deprecated Config. | |
extconf.rb:8:in `<main>': Use RbConfig instead of obsolete and deprecated Config. | |
extconf.rb:10:in `<main>': Use RbConfig instead of obsolete and deprecated Config. |