Skip to content

Instantly share code, notes, and snippets.

@Cuneytt
Cuneytt / kubectl.md
Created October 30, 2017 17:54 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

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

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
before_script:
- export GOPATH=$(pwd)
stages:
- build
- test
- deploy
validate-schema:
image: truongsinh/pg-client:9.4
@Cuneytt
Cuneytt / multiline-values.yaml
Created September 13, 2017 17:30 — forked from rjattrill/multiline-values.yaml
Break YAML over multiple lines
# Join multiple lines without new line
value: >
part 1
part 2
# Join with newline
value2: |
line 1
line 2
@Cuneytt
Cuneytt / values_pointers.go
Created July 25, 2017 17:25 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@Cuneytt
Cuneytt / s3_down.sh
Created June 22, 2017 18:08 — forked from nfelger/s3_down.sh
Quick and dirty s3 speed tests with temporary STS credentials
#!/bin/bash
# Inspired by http://dl.getipaddr.net/ and http://curl.haxx.se/mail/archive-2014-10/0006.html
file=path/to/file
bucket=your-bucket
contentType="application/octet-stream"
dateValue=`date -R`
resource="/${bucket}/${file}"
s3Key=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-app-role | grep 'AccessKeyId' | sed 's/.* "\([^"]*\).*/\1/'`
s3Secret=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-app-role | grep 'SecretAccessKey' | sed 's/.* "\([^"]*\).*/\1/'`
token=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-app-role | grep 'Token' | sed 's/.* "\([^"]*\).*/\1/'`
@Cuneytt
Cuneytt / docker-cheat-sheat.md
Created June 20, 2017 20:36 — forked from dwilkie/docker-cheat-sheat.md
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@Cuneytt
Cuneytt / ImageMagick
Created June 23, 2013 04:41
ImageMagick
# For example here I create thumbnails of images in the current directory, inserting a "_tn" string into the input filename, to create the appropraite output image filename.
convert *.jpg -thumbnail 120x90 -set filename:fname '%t_tn'
+adjoin '%[filename:fname].gif'
Because of this the "-set" option can actually define ANY setting with ANY value.
convert rose: -set filename:my_area '%wx%h' 'rose-%[filename:my_area].png'
To get the exact original filename of the image use '%d/%f' or '%d/%t.%e'.