Add Kubectl Context to Cmder Prompt
Add a .lua file under .\config\myconfig.lua_ function custom_prompt() -- Exectute kubectl command to get context (Note the output will contain a newline) local handle = io.popen("kubectl config current-context") local context = handle:read("*a") handle:close() cwd = clink.get_cwd() prompt = "\x1b[1;32;40m{cwd} {git}{hg} \x1b[0;35;40m{context}\x1b[1;30;40m{lamb} \x1b[0m" new_value = string.gsub(prompt, "{cwd}", cwd) add_context = string.gsub(new_value, "{context}", context) cl...
Read post
Write ConfigMap Value as File
To write a value from a ConfigMap to a file inside a container use a volume mount with a subPath ConfigMap.yaml kind: ConfigMap apiVersion: v1 metadata: name: my-config data: appsettings.json: |- { "ApplicationName": "My Application", "OtherSettings" : { ... } } Deployment.yaml apiVersion: apps/v1 kind: Deployment spec: template: spec: volumes: - name: config-volume configMap: name: my-config containers: -...
Read post
Using iframeResizer in a Vue.js Component
Using the iframeresizer library in a Vue.js component <template> <div> <iframe id="myiframe" :src="http://example.com/url/of/page"></iframe> </div> </template> <script lang="ts"> import { Component, Vue } from "vue-property-decorator"; import iframeResizer from "iframe-resizer"; @Component({}) export default class IframeComponent extends Vue { mounted() { this.resize(); } resize() { (iframeResizer as any).iframeResizer({ checkOrig...
Read post
Configure SPA Routing in .NET Core Application
When serving a Single Page Application (SPA) from a .NET Core service which also contains an API some configuration is required to return the SPA for relevant requests. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.Use(async (context, next) => { string path = context.Request.Path.Value; if (!path.StartsWith("/api") && !Path.HasExtension(path)) { ...
Read post
Global Error Handling in Vue.js
Handle errors from Vue components Vue.config.errorHandler = function(err: Error, vm: Vue, info: string) { // ... }; Handle javascript errors window.onerror = function(msg: any, url: any, line: any, col: any, error: any){ // ... }; Handle errors from rejected promises as these are not caught by window.onerror window.addEventListener("unhandledrejection", function(event: any){ event.preventDefault(); // ... }); ...
Read post
Kubectl Cheatsheet
GENERAL kubectl version kubectl cluster-info CONTEXT kubectl config current-context kubectl config use-context cp08 INFORMATION kubectl get services # List all services in the namespace kubectl get pods --all-namespaces # List all pods in all namespaces kubectl get pods -o wide # List all pods in the namespace, with more details kubectl get rc <rc-name> # List a particular replication controller kubectl ge...
Read post