Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
| { | |
| "AWSTemplateFormatVersion" : "2010-09-09", | |
| "Description" : "Alerts on ECS burst balance and terminates unhealthy hosts", | |
| "Parameters" : { | |
| "ClusterName": { | |
| "Type": "String", | |
| "Description": "ECS Cluster name" | |
| }, |
| // [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (: | |
| Array.prototype.flatMap = function(lambda) { | |
| return Array.prototype.concat.apply([], this.map(lambda)); | |
| }; |
| # coding: utf-8 | |
| require 'sequel' | |
| require 'logger' | |
| module NanoDW | |
| Sequel.datetime_class = DateTime | |
| DB = Sequel.connect(ENV['DATABASE_URL']) | |
| log = Logger.new(STDERR) | |
| log.progname = 'NanoDW::Models' |
| require 'resque_mailer' | |
| require 'devise/async' | |
| # pop and set locale from the args before running | |
| module PerformWithLocale | |
| def perform(*args) | |
| I18n.with_locale(args.pop) do | |
| super(*args) | |
| end | |
| end |
| class MyClass | |
| def value | |
| "VALUE!" | |
| end | |
| def do_something | |
| puts value # Outputs "VALUE!" | |
| if false | |
| value = nil # Should not execute | |
| end |
| #!/usr/bin/env ruby | |
| puts "Please Enter Your MAC Address: " | |
| mac = gets | |
| mac = mac.strip | |
| `sudo /bin/bash -lc "sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z && sudo ifconfig en0 ether #{mac}"` | |
| puts "Congratulations you now have #{mac} as your MAC address" |
An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
| #!/bin/bash | |
| set -o errexit | |
| # Author: David Underhill | |
| # Script to permanently delete files/folders from your git repository. To use | |
| # it, cd to your repository's root and then run the script with a list of paths | |
| # you want to delete, e.g., git-delete-history path1 path2 | |
| if [ $# -eq 0 ]; then | |
| exit 0 |
| #!/usr/bin/env ruby | |
| #/ Usage: <progname> [options]... | |
| #/ How does this script make my life easier? | |
| # ** Tip: use #/ lines to define the --help usage message. | |
| $stderr.sync = true | |
| require 'optparse' | |
| # default options | |
| flag = false | |
| option = "default value" |