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 'json' | |
subdomain="CHANGE_THIS" | |
api_key="CHANGE_THIS" | |
endpoint="https://CHANGE_THIS.pagerduty.com/api/v1/services" | |
service_name="CHANGE_THIS" | |
key_service="CHANGE_THIS" | |
about="CHANGE_THIS." | |
escalation_policy="CHANGE_THIS" |
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 'json' | |
#csv needs to be in this format | |
#role,name,email_address | |
#with real-looking values: | |
#user,Aaron,aaronexample@gmail.com | |
#to add more fields, see the API, then add them to your csv file and add fields below in user_json | |
#the four variables below need to be changed; nothing else | |
usercsv="CHANGE_THIS" |
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 'rubygems' | |
require 'gmail' | |
require 'curb' | |
require 'json' | |
#credentials to login to PagerDuty and resolve incidents | |
subdomain="CHANGE_THIS" | |
api_token="CHANGE_THIS" | |
user_id_resolver = "CHANGE_THIS" |
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 'json' | |
subdomain="change_this" | |
api_key="change_this" | |
endpoint="https://events.pagerduty.com/generic/2010-04-15/create_event.json" | |
service_id="change_this" | |
service_access_key="change_this" | |
incident_key="change_this" | |
subject="change_this" |
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
filename="CHANGE_THIS.txt" | |
lines=File.readlines(filename) | |
puts lines.sort | |
file_rewrite=File.open(filename,"w") | |
file_rewrite.puts lines.sort |
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 'json' | |
#where to print your file output to | |
filename="CHANGE_THIS.txt" | |
subdomain="CHANGE_THIS" | |
service_id="CHANGE_THIS" | |
api_key="CHANGE_THIS" | |
endpoint="https://#{subdomain}.pagerduty.com/api/v1/incidents/" |
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 'json' | |
incident_id="CHANGE_THIS" | |
subdomain="CHANGE_THIS" | |
api_key="CHANGE_THIS" | |
endpoint="https://#{subdomain}.pagerduty.com/api/v1/incidents/#{incident_id}" | |
def curl_get_id(tokennum,endpoint) |
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 'curb' | |
require 'json' | |
subdomain="CHANGE_THIS" | |
api_access_key="CHANGE_THIS" | |
since_date="CHANGE_THIS_EXAMPLE_2014-04-01T01:00Z" | |
until_date="CHANGE_THIS_EXAMPLE_2014-04-05T01:00Z" | |
endpoint="https://#{subdomain}.pagerduty.com/api/v1/alerts" | |
endpoint << "?since=#{since_date}&until=#{until_date}" |
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 'open-uri' | |
# Get a Nokogiri::HTML:Document for the page we’re interested in... | |
def space_replace(word) | |
word = word.gsub(' ',"+") | |
end | |
term=ARGV[0] |
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
base=1000 | |
mult=1.01 | |
10.times do |x| | |
base *= mult | |
year = x/12 | |
month=x%12 | |
nice_number=base.round(0) | |
comma_number=nice_number.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse | |
puts "#{comma_number} #{year} #{month}" | |
end |