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 'system_timer' | |
| host = '1.2.3.4' | |
| SystemTimer.timeout(1) do | |
| begin | |
| result = `psql -h #{host} -c 'select 1'` | |
| puts "server is up" | |
| rescue Timeout::Error | |
| puts "server is down" |
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 'system_timer' | |
| require 'uri' | |
| bad_url = 'postgres://some:[email protected]/mydb' | |
| good_url = 'postgres://postgres@localhost/template1' | |
| uri = URI.parse(good_url) | |
| success = nil |
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
| localhost'; | |
| var PORT = 9999; | |
| var Buffer = require('buffer').Buffer, | |
| dgram = require("dgram"); | |
| var client = dgram.createSocket(); | |
| var buf = new Buffer(4); | |
| buf.write('PING'); |
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
| #!/usr/bin/env node | |
| var sys = require('sys') | |
| var net = require('net') | |
| var child_process = require('child_process') | |
| if (!process.env.PORT) { | |
| sys.puts('Must specify PORT') | |
| process.exit() | |
| } |
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
| module Heroku | |
| class StaticAssetsMiddleware | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| # call returns an array containing [response code, header, Rack::Response] | |
| reply = @app.call(env) |
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
| #!/usr/bin/env ruby | |
| usage = "pgurl <url> <command>" | |
| url = ARGV.shift or abort usage | |
| cmd = ARGV.shift or abort usage | |
| require 'uri' | |
| u = URI.parse(url) |
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
| #!/usr/bin/env ruby | |
| require 'aws/s3' | |
| class S3Cmd | |
| include AWS::S3 | |
| def initialize | |
| Base.establish_connection!( | |
| :access_key_id => ENV['AWS_ACCESS_KEY_ID'], |
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
| { | |
| "levels": [ | |
| { | |
| "level_num": 1, | |
| "plant_type": 0, | |
| "color_scheme": 0, | |
| "num_waves": 3, | |
| "waves": [ | |
| { | |
| "wave_num": 1, |
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
| #!/usr/bin/env ruby | |
| require 'aws/s3' | |
| class S3Cmd | |
| include AWS::S3 | |
| def initialize | |
| Base.establish_connection!( | |
| :access_key_id => ENV['AWS_ACCESS_KEY_ID'], |
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
| director routing_mesh round-robin { | |
| { | |
| .backend = { | |
| .host = "...some ip..."; | |
| .port = "...some port..."; | |
| .first_byte_timeout = 90s; | |
| .between_bytes_timeout = 90s; | |
| } | |
| # ...more backends... | |
| } |