Skip to content

Instantly share code, notes, and snippets.

View divyenpatel's full-sized avatar
🎯
Focusing

Divyen Patel divyenpatel

🎯
Focusing
View GitHub Profile
@shalini-b
shalini-b / output.md
Last active February 2, 2022 00:51
CreateVolume REQ/REP with topology and WFFC

Environment details:

DC -> region-1
Host1 (10.186.10.56) -> zone-a. VMs: k8s-node-018, k8s-node-0888
Host2 (10.186.7.239) -> zone-b
Host3 (10.186.9.77) -> zone-c. VMs: k8s-master-964, k8s-node-0316

Datastore info:

@bburky
bburky / delete-all-cns-volumes.go
Created July 7, 2020 21:50
Delete all vSphere CNS volumes
// Based on https://github.com/vmware/govmomi/blob/a411671fde1b6ac482ef96e0ae4f22d415cbf256/cns/client_test.go
// Delete all CNS volumes:
// go get -u github.com/vmware/govmomi
// go run delete-all-cns-volumes.go
package main
import (
"context"
"log"
@lamw
lamw / gist:f25820bccdd858033fa1f3bf0fcc5981
Created November 25, 2016 17:03
Installing OVFTool 4.2 within a Photon Docker Container
FROM photon
RUN tdnf -y install tar gzip sed gawk ncurses-compat
ADD VMware-ovftool-4.2.0-4586971-lin.x86_64.bundle /tmp/
RUN chmod +x /tmp/VMware-ovftool-4.2.0-4586971-lin.x86_64.bundle
RUN echo -e "/w00t\n" >> /tmp/answer
RUN /tmp/VMware-ovftool-4.2.0-4586971-lin.x86_64.bundle --eulas-agreed --required --console < /tmp/answer

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) }
@enile8
enile8 / gist:2424514
Created April 19, 2012 21:59
A small example program using SQLite with C++
// A small example program using SQLite with C++
#include <iostream>
#include <sqlite3.h>
using namespace std;
static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
int i;
for(i=0; i<argc; i++)
{