require "rest_client"
10.times do
puts Time.now
RestClient.get("https://api.data.gov/sam/v1/registrations/1459697830000?api_key=#{ENV["API_KEY"]}") do |response|
puts "Response: #{response.code}"
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 "typhoeus" | |
2.times do |i| | |
puts "\n==== RUN #{i} ====" | |
e = Typhoeus::Easy.new | |
e.url = "http://example.com/" | |
e.method = :put | |
e.verbose = true | |
e.perform | |
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 "rubygems" | |
require "sinatra" | |
set :server, "thin" | |
set :port, "4568" | |
put "/" do | |
"Hi" | |
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
#!/bin/bash | |
# Script for placing sudoers.d files with syntax-checking | |
# Making a temporary file to contain the sudoers-changes to be pre-checked | |
TMP=$(mktemp -t vagrant_sudoers) | |
cat /etc/sudoers > $TMP | |
cat >> $TMP <<EOF | |
# Allow passwordless startup of Vagrant when using NFS. | |
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/su root -c echo '*' >> /etc/exports |
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
{ | |
"apis": [ | |
{ | |
"title": "Alternative Fuel Stations - List All", | |
"description": "Get all alternative fuel stations that match your query", | |
"keywords": ["alternative fuel", "transportation"], | |
"agency": "Department of Energy", | |
"dataDictionary": "http://developer.nrel.gov/doc/api/alt-fuel-stations/v1", | |
"accessURL": { | |
"absoluteURI": "http://developer.nrel.gov/doc/api/alt-fuel-stations/v1.{format}", |
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
{ | |
"apiVersion":"1.0.0", | |
"swaggerVersion":"1.2", | |
"basePath":"http://petstore.swagger.wordnik.com/api", | |
"resourcePath":"/pet", | |
"produces":[ | |
"application/json", | |
"application/xml", | |
"text/plain", | |
"text/html" |
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 foo | |
if("moo" =~ /(\w+)/) | |
puts " inside foo: #{$1.inspect} #{Regexp.last_match.inspect}" | |
end | |
end | |
def replace | |
"something".gsub(/(foo)/, "bar") | |
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
def fast_string_to_time(string) | |
matches = string.match(Format::ISO_DATETIME) | |
if matches | |
microsec = (matches[7].to_r * 1_000_000).to_i | |
new_time matches[1].to_i, matches[2].to_i, matches[3].to_i, matches[4].to_i, matches[5].to_i, matches[6].to_i, microsec | |
end | |
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
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "CentOS-6.5-x86_64-v20140311" | |
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.5-x86_64-v20140311.box" | |
config.vm.provision "puppet" do |puppet| | |
puppet.manifests_path = "manifests" | |
puppet.manifest_file = "site.pp" | |
end | |
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
perl -p -i -e 's/^ *:/ s./g;s/s\._id/s.id/g;s/ => / = /g;s/, *$//g;s/^ *} *$/end\n/g;s/^ *{ *$/ModelName.seed do |s|/g' seed_file.rb |
OlderNewer