Skip to content

Instantly share code, notes, and snippets.

View amscotti's full-sized avatar
😀

Anthony Scotti amscotti

😀
View GitHub Profile
@jdh30
jdh30 / JsonParser.fs
Last active January 30, 2024 14:06
Simple JSON parser written in F# using active patterns
type Json =
| Null
| Bool of bool
| Number of float
| String of string
| Array of Json list
| Object of (string * Json) list
type Bracket = Open | Close
@karmi
karmi / .gitignore
Created March 16, 2012 16:09
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@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 / login.rb
Created November 22, 2011 00:45
Sample of Sinatra authentication
require 'rubygems'
require 'bcrypt'
require 'haml'
require 'sinatra'
enable :sessions
userTable = {}
helpers do
@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 / 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 / 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
@peterc
peterc / gist:40234
Created December 27, 2008 10:39
CAPTCHA plugin for Sinatra apps
# NAME: recaptcha
# VERSION: 1.0
# AUTHOR: Peter Cooper [ http://www.rubyinside.com/ github:peterc twitter:peterc ]
# DESCRIPTION: Sinatra plugin to provide CAPTCHA support through recaptcha.net
# COMPATIBILITY: 0.3.2 /and/ latest rtomayko Hoboken builds!
# LICENSE: Use for what you want, just don't claim full credit unless you make significant changes
#
# INSTRUCTIONS:
# 0. Check out an extended client code example at the footer of this file
# 1. Ensure _this_ file is lib/recaptcha.rb within your app's directory structure