Module | Stella::Utils |
In: |
lib/stella/utils.rb
|
A motley collection of methods that Stella loves to call!
ADDR_LOCAL | = | IPAddr.new("127.0.0.0/8") | ||
ADDR_CLASSA | = | IPAddr.new("10.0.0.0/8") | ||
ADDR_CLASSB | = | IPAddr.new("172.16.0.0/16") | ||
ADDR_CLASSC | = | IPAddr.new("192.168.0.0/24") | ||
ADDR_EC2_US_EAST | = | %w{ 216.182.224.0/20 72.44.32.0/19 67.202.0.0/18 75.101.128.0/17 174.129.0.0/16 204.236.192.0/18 184.73.0.0/16 184.72.128.0/17 184.72.64.0/18 50.16.0.0/15 }.collect { |ipr| IPAddr.new(ipr.strip) } | See: forums.aws.amazon.com/ann.jspa?annID=877 | |
ADDR_EC2_US_WEST | = | %w{ 204.236.128.0/18 184.72.0.0/18 50.18.0.0/18 }.collect { |ipr| IPAddr.new(ipr.strip) } | ||
ADDR_EC2_EU_WEST | = | %w{ 79.125.0.0/17 46.51.128.0/18 46.51.192.0/20 46.137.0.0/17 }.collect { |ipr| IPAddr.new(ipr.strip) } | ||
ADDR_EC2_AP_EAST | = | %w{ 175.41.128.0/18 122.248.192.0/18 }.collect { |ipr| IPAddr.new(ipr.strip) } |
Checks if the file has more than 30% non-ASCII characters. NOTE: how to determine the difference between non-latin and binary?
Return the local IP address which receives external traffic from: coderrr.wordpress.com/2008/05/28/get-your-local-ip-address/ NOTE: This does not open a connection to the IP address.
Returns str with the leading indentation removed. Stolen from github.com/mynyml/unindent/ because it was better.
require a glob of files.
and then to Dir.glob. The list of files found are sent to require. Nothing is returned but LoadError exceptions are caught. The message is printed to STDERR and the program exits with 7.
require a library from the vendor directory. The vendor directory should be organized such that name and version can be used to create the path to the library.
e.g.
vendor/httpclient-2.1.5.2/httpclient
Checks whether something is listening to a socket.
Returns true if host allows a socket connection on port. Returns false if one of the following exceptions is raised: Errno::EAFNOSUPPORT, Errno::ECONNREFUSED, SocketError, Timeout::Error