Skip to content

Instantly share code, notes, and snippets.

View jayunit100's full-sized avatar
🎯
Focusing

jay vyas jayunit100

🎯
Focusing
View GitHub Profile
@jayunit100
jayunit100 / run_viper_test.go
Created September 3, 2016 14:11
Viper example
SetEnvPrefix
package main
// import "fmt"
import "testing"
import "os"
import "github.com/spf13/viper"
func AssertKV(t *testing.T, k string, v string){
t.Log("Viper: Asserting %v = %v ",k,v)
package main
// import "fmt"
import "testing"
import "os"
import "github.com/spf13/viper"
func AssertKV(t *testing.T, k string, v string){
t.Log("Viper: Asserting %v = %v ",k,v)
@jayunit100
jayunit100 / examples.go
Created September 16, 2016 13:44
jays snippets
package main
import (
"fmt"
"strings"
"strconv"
"os"
)
// How do you read a struct from a line of text?
type Example1 struct {
diff --git a/cmd/kube-controller-manager/app/BUILD b/cmd/kube-controller-manager/app/BUILD
index 95b19cb..3b74421 100644
--- a/cmd/kube-controller-manager/app/BUILD
+++ b/cmd/kube-controller-manager/app/BUILD
@@ -25,7 +25,6 @@ go_library(
"//pkg/apis/batch:go_default_library",
"//pkg/apis/componentconfig:go_default_library",
"//pkg/client/clientset_generated/internalclientset:go_default_library",
- "//pkg/client/clientset_generated/internalclientset/typed/core/internalversion:go_default_library",
"//pkg/client/leaderelection:go_default_library",
1s rate: 131 total: 131
I1115 07:05:55.705537 34432 trace.go:61] Trace "cacher *api.Pod: List" (started 2016-11-15 07:05:53.398304727 -0500 EST):
[2.203422771s] [2.203422771s] Ready
[2.203437983s] [15.212µs] watchCache locked acquired
[2.20343824s] [257ns] watchCache fresh enough
[2.204380526s] [942.286µs] Listed 24014 items from cache
[2.307147446s] [102.76692ms] Filtered 23883 items
[2.307171024s] [23.578µs] END
I1115 07:05:56.247742 34432 trace.go:61] Trace "List /api/v1/pods" (started 2016-11-15 07:05:53.39821633 -0500 EST):
[79.614µs] [79.614µs] About to List from storage
// output:
// 0
// 0
fmt.Println(len(e.Spec.SchedulingMismatchedPredicateResults))
fmt.Println(len(a.(*v1.Pod).Spec.SchedulingMismatchedPredicateResults))
// output:
// false
fmt.Println(reflect.DeepEqual(
e.Spec.SchedulingMismatchedPredicateResults,
// output:
// 0
// 0
fmt.Println(len(e.Spec.SchedulingMismatchedPredicateResults))
fmt.Println(len(a.(*v1.Pod).Spec.SchedulingMismatchedPredicateResults))
// output:
// false
fmt.Println(reflect.DeepEqual(
e.Spec.SchedulingMismatchedPredicateResults,
# for each file in this dir
# if its a go file
# parse the "Describe" and "It" strings
# extract things in [tags]
# add it to a map
# add all tags to the file map
# f -> t1, t2, t3
# print the tags per file with counts
// Ignore all calls to subresources or resources other than pods.
- if len(attributes.GetSubresource()) != 0 || attributes.GetResource().GroupResource() != api.Resource("pods") {
+ if len(attributes.GetSubresource()) != 0 || attributes.GetResource().GroupResource() != api.Resource("nodes") {
return nil
}
- pod, ok := attributes.GetObject().(*api.Pod)
+ pod, ok := attributes.GetObject().(*api.Node)