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 1A34 62C1 D773 504B 260A 436D F963 E58F 35FE 89A4
To claim this, I am signing this object:
export TERM=xterm-color | |
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' | |
export CLICOLOR=1 | |
alias ls='ls -G' # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups | |
alias ..='cd ..' | |
alias ...='cd .. ; cd ..' |
# 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 |
var Asspect = (function(){ | |
var add = function(object, functionName, opts){ | |
object = object || window; | |
var originalFunction = object[functionName]; | |
// check if function exists | |
object[functionName] = function(){ |
# 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) | |
# |
class UTF8Validator | |
class InvalidUTF8Character < Exception; end | |
VALIDATE_ENV_KEYS = [ | |
"QUERY_STRING", | |
"REQUEST_PATH", | |
"REQUEST_URI", | |
"rack.request.form_vars" # POST data | |
] |
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:
# brew install jq | |
cat elb-logs.log | elb_parser.rb | jq 'select(.elb_status_code != "200")' | |
cat elb-logs.log | elb_parser.rb | jq '.' |
# 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 |