I hereby claim:
- I am sparrovv on github.
- I am sparrovv (https://keybase.io/sparrovv) on keybase.
- I have a public key whose fingerprint is 0FCB D37F 74E3 464B CBC4 E842 2675 4E59 47A0 C4BD
To claim this, I am signing this object:
| #!/usr/bin/env ruby | |
| require 'json' | |
| def uuid_to_hex(uuid) | |
| hex = uuid.gsub(/[{}-]/, "") | |
| msb = hex[0,16] | |
| lsb = hex[16,16] | |
| msb = msb[14, 2] + msb[12, 2] + msb[10, 2] + msb[8, 2] + msb[6, 2] + msb[4, 2] + msb[2, 2] + msb[0, 2] | |
| lsb = lsb[14, 2] + lsb[12, 2] + lsb[10, 2] + lsb[8, 2] + lsb[6, 2] + lsb[4, 2] + lsb[2, 2] + lsb[0, 2] |
| # http://waitbutwhy.com/2016/03/the-jellybean-problem.html | |
| Bean = Struct.new(:state) | |
| state_of_the_one_i_picked_at_the_beginning = [] | |
| state_of_the_last_one_on_the_stump = [] | |
| 1000.times do | |
| # create beans | |
| bean1 = Bean.new :dead |
| # brew install jq | |
| cat elb-logs.log | elb_parser.rb | jq 'select(.elb_status_code != "200")' | |
| cat elb-logs.log | elb_parser.rb | jq '.' |
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env ruby | |
| # gem install net-ping | |
| # Usage | |
| # sudo ./wifimonitor.rb | |
| require 'net/ping' | |
| require 'logger' |
I hereby claim:
To claim this, I am signing this object:
| class UTF8Validator | |
| class InvalidUTF8Character < Exception; end | |
| VALIDATE_ENV_KEYS = [ | |
| "QUERY_STRING", | |
| "REQUEST_PATH", | |
| "REQUEST_URI", | |
| "rack.request.form_vars" # POST data | |
| ] |
| # I don't remember where I found it but it's useful in case of errors like: Net::HTTP::Persistent::Error: too many connection resets... | |
| module Kernel | |
| # Options | |
| # ======= | |
| # * :tries Number of retries to perform. Defaults to 1. | |
| # Note this means it actually tries 2 times! | |
| # * :on - The Exception on which a retry will be performed. Defaults to | |
| # Exception, which retries on any Exception. | |
| # * :delay - Delay in seconds before the next try (optional) | |
| # |
| var Asspect = (function(){ | |
| var add = function(object, functionName, opts){ | |
| object = object || window; | |
| var originalFunction = object[functionName]; | |
| // check if function exists | |
| object[functionName] = function(){ |
| # Example of simple webservlet, that can run on your computer and be triggered by http | |
| require 'webrick' | |
| class Simple < WEBrick::HTTPServlet::AbstractServlet | |
| def do_GET(request, response) | |
| status, content_type, body = do_some_stuff(request) | |
| #system('touch ~/yeah.file') | |
| response.status = status | |
| response['Content-Type'] = content_type |