Skip to content

Instantly share code, notes, and snippets.

View amscotti's full-sized avatar
😀

Anthony Scotti amscotti

😀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am amscotti on github.
  • I am amscotti (https://keybase.io/amscotti) on keybase.
  • I have a public key whose fingerprint is 3A0C E703 9982 AA6C 9048 6ED3 D2A9 0719 3B06 B986

To claim this, I am signing this object:

@amscotti
amscotti / capmon.rb
Created August 27, 2011 02:50 — forked from rgrove/capmon.rb
Ruby script to retrieve and display Comcast data usage. See http://www.128bitstudios.com/2011/08/27/comcast-data-usage-put-a-fork-in-it/
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
URL_PRELOADER = 'https://customer.comcast.com/Secure/Preload.aspx?backTo=%2fSecure%2fUsers.aspx&preload=true'
URL_USERS = 'https://customer.comcast.com/Secure/Users.aspx'
abort "Usage: #{$0} <username> <password>" unless ARGV.length == 2
@amscotti
amscotti / wowapi.coffee
Last active September 27, 2015 07:57
Code to use battle.net's RESTful API for pulling World of Warcraft guild rosters - http://www.128bitstudios.com/2011/09/22/updated-world-of-warcraft-armory-code/
http = require 'http'
rest = require 'restler'
realm = escape "Staghelm"
guild = escape "Controlled Chaos"
type = {
1: "Warrior", 2: "Paladin", 3: "Hunter",
4: "Rogue", 5: "Priest", 6: "Death Knight",
7: "Shaman", 8: "Mage", 9: "Warlock",
@amscotti
amscotti / publish.rb
Created November 11, 2011 01:19
This is a sample file for AWS-SDK gem that uses the Amazon Simple Notification Service. - http://www.128bitstudios.com/2011/11/10/playing-around-with-amazon-sns-in-ruby/
require File.expand_path(File.dirname(__FILE__) + '/../samples_config')
# Topic's arn can be found in AWS Management, under Topic Details.
(topic_arn, message) = ARGV
unless topic_arn && message
puts "Usage: upload.rb <TOPIC_ARN> <MESSAGE>"
exit 1
end
# Get an instance of the SNS interface using the default configuration
@amscotti
amscotti / sinatra_linkedin.rb
Created November 26, 2011 04:42
LinkedIn authentication with Sinatra
require "rubygems"
require "haml"
require "sinatra"
require "linkedin"
enable :sessions
helpers do
def login?
if session[:atoken].nil?
@amscotti
amscotti / wowapi_mongodb.rb
Created January 21, 2012 00:35
Pulling a World of Warcraft guild roster in to a MongoDB
require 'rubygems'
require 'nestful'
require 'mongo'
db = Mongo::Connection.new.db("wowstats")
coll = db.collection("character")
coll.drop
type = {
1 => "Warrior", 2 => "Paladin", 3 => "Hunter",
@amscotti
amscotti / wowapi_auction.rb
Created April 1, 2012 20:01
Using Redis to sort World of Warcraft's Auction House data. bit.ly/Hyxkq9
require 'rubygems'
require 'open-uri'
require 'yajl'
require 'redis'
realm = "Lothar"
filePath = Yajl::Parser.parse(open("http://us.battle.net/api/wow/auction/data/#{realm}"))["files"].first['url']
puts filePath
redis = Redis.new
@amscotti
amscotti / mongo_urlshortener.rb
Created April 2, 2012 20:04
Example of using MongoMapper and Sinatra to make an url shortener - http://bit.ly/wZw0TO
require "rubygems"
require "sinatra"
require "haml"
require "mongo_mapper"
class Shorten
include MongoMapper::Document
key :url, String
key :shorten_id, String
@amscotti
amscotti / node_send.coffee
Created June 3, 2012 17:24
Amazon's Simple Queue Service with Node.js and Ruby - http://bit.ly/Nwn0Q1
aws = require ('aws-lib')
access_key_id = "<Your access key id>"
secret_access_key = "<Your secret access key>"
options = {
"path" : "<Your queue URL, just the /accountid/queue_name is needed>"
}
sqs = aws.createSQSClient(access_key_id, secret_access_key, options)
@amscotti
amscotti / server.js
Last active December 15, 2015 09:09
Proxy server for working with Yeoman and a REST API. Install http-proxy by running 'npm install http-proxy' or add to your package.json and run 'npm install'
var httpProxy = require('http-proxy'),
staticDir = 'app',
apiHost = '<Your API Host>',
apiPort = 80,
apiPath = '/api';
var proxy = new httpProxy.RoutingProxy();
connect()
.use(connect.logger("dev"))
.use(function (req, res, next) {