requires
jqCLI
oc get namespaces -o json | jq '[.items[] | select((.metadata.name | startswith("openshift") | not) and (.metadata.name | startswith("kube-") | not) and .metadata.name != "default" and (true)) | .metadata.name ]'
requires
jqCLI
oc get namespaces -o json | jq '[.items[] | select((.metadata.name | startswith("openshift") | not) and (.metadata.name | startswith("kube-") | not) and .metadata.name != "default" and (true)) | .metadata.name ]'
by Bjørn Friese
Beautiful is better than ugly. Explicit is better than implicit.
I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.
| // Composition Example | |
| // http://codepen.io/ericelliott/pen/XXzadQ?editors=001 | |
| // https://gist.github.com/ericelliott/fed0fd7a0d3388b06402 | |
| const distortion = { distortion: 1 }; | |
| const volume = { volume: 1 }; | |
| const cabinet = { cabinet: 'maple' }; | |
| const lowCut = { lowCut: 1 }; | |
| const inputLevel = { inputLevel: 1 }; |
| package org.keycloak.authentication.authenticators.browser; | |
| import org.keycloak.authentication.AuthenticationFlowContext; | |
| import org.keycloak.models.RoleModel; | |
| import org.keycloak.models.UserModel; | |
| import javax.ws.rs.core.MultivaluedMap; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.regex.Pattern; |
| brew install libvirt | |
| sudo ln -s /opt/vagrant/embedded/include/ruby-2.0.0/{universal-darwin12.6.0,x86_64-darwin12.6.0} | |
| ARCHFLAGS='-arch x86_64' \ | |
| CONFIGURE_ARGS="with-libvirt-include=/usr/local/include/libvirt:/opt/vagrant/embedded//include/ruby-2.0.0/universal-darwin12.6.0/ with-libvirt-lib=/usr/local/lib" \ | |
| vagrant plugin install vagrant-libvirt |
| #!/usr/bin/env bash | |
| # Remember to install jq (e.g. brew install jq; yum install jq; apt-get install jq) | |
| set -e | |
| RED='\033[0;31m' | |
| NORMAL='\033[0m' | |
| printf "${RED}Getting OAuth2 token from Keycloak (includes access_token, refresh_token, etc):${NORMAL}\n" | |
| KEYCLOAK_RESPONSE=`curl -s -X POST http://127.0.0.1:8080/auth/realms/stottie/protocol/openid-connect/token -H "Content-Type: application/x-www-form-urlencoded" -d 'username=rincewind' -d 'password=apiman' -d 'grant_type=password' -d 'client_id=apiman'` | |
| printf "$KEYCLOAK_RESPONSE \n\n" |