A Pen by Andrew A Smith on CodePen.
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
| # Typical use-case is decoding an AWS STS message. The DecodedMessage key contains escaped JSON. | |
| jq '.DecodedMessage | fromjson | .' message.json |
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
| aws ec2 describe-instances --instance-ids <id> --output text --query 'Reservations[*].Instances[*].PrivateIpAddress' |
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
| # print timings after each call. Use curl -q to suppress this file. | |
| write-out = "%{http_code} ns:%{time_namelookup} conn:%{time_connect} appconn:%{time_appconnect} prexfr:%{time_pretransfer} rdr:%{time_redirect} ttfb:%{time_starttransfer} TOTAL:%{time_total}\n" |
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
| # Adapted from http://stackoverflow.com/questions/7986150/http-streaming-in-rails-not-working-when-using-rackdeflater | |
| # | |
| # * Place this file in config/initializers/streaming.rb. | |
| # * Place 'config.middleware.use Rack::Deflater' in application.rb. | |
| # * Ensure you have a controller action that uses 'render stream: true' | |
| # * This should work in rails 3.1+, 4.x, and 5.x. See the original class: | |
| # https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/streaming.rb | |
| module GzipStreaming | |
| def _process_options(options) |
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
| BIOS Setup | |
| ---------- | |
| 1) Boot into the BIOS setup utility (press F2 or DEL) and open Advanced > Serial Port Console Redirection. | |
| 2) Disable COM1 and EMS console redirection and enable SOL redirection. | |
| 3) Set the SOL console redirection settings as follows: | |
| Aptio Setup Utility - Copyright (C) 2012 American Megatrends, Inc. | |
| Advanced | |
| /----------------------------------------------------+-------------------------\ |
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 "vmstat" # gem install vmstat | |
| CPU_DETAIL = false # set to true if you want to see details for each cpu. | |
| CPU_USAGE = "CPU %s: %5.1f%% sys %5.1f%% user %5.1f%% idle" | |
| def delta prev, curr | |
| all = prev.cpus.zip(curr.cpus).map do |prev_cpu, curr_cpu| |
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
| loop { d = `date`.chomp; print d; sleep 0.05; print "\b"*d.size } |
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
| irb(main):002:0> Dir.glob("../x/*").shuffle.each { |x| `mv #{x} .`; puts "Added #{x}"; `time foo`; } | |
| Added ../x/sexp_processor-4.4.1.gemspec | |
| 0.10 real 0.08 user 0.01 sys | |
| Added ../x/diff-lcs-1.2.4.gemspec | |
| 0.10 real 0.08 user 0.01 sys | |
| Added ../x/wirble-0.1.3.gemspec | |
| 0.10 real 0.08 user 0.01 sys | |
| Added ../x/byebug-2.7.0.gemspec | |
| 0.10 real 0.08 user 0.01 sys | |
| Added ../x/ruby-progressbar-1.2.0.gemspec |
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
| irb(main):002:0> Dir.glob("../x/*") { |x| `mv #{x} .`; puts "Added #{x}"; `time derp`; } | |
| Added ../x/actionpack-3.2.20.gemspec | |
| 0.07 real 0.05 user 0.01 sys | |
| Added ../x/activemodel-3.2.20.gemspec | |
| 0.06 real 0.05 user 0.01 sys | |
| Added ../x/activerecord-3.2.20.gemspec | |
| 0.06 real 0.05 user 0.01 sys | |
| Added ../x/activeresource-3.2.20.gemspec | |
| 0.07 real 0.05 user 0.01 sys | |
| Added ../x/activesupport-3.2.20.gemspec |