This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package concurrency | |
type SingleStructChan chan struct{} | |
type SingleAckerChan chan *stopAcker | |
type DoubleStructChan chan chan struct{} | |
type StopInformer interface { | |
// Stop blocks until the stop informer has received confirmation that the resource has stopped | |
Stop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package concurrency | |
import ( | |
"sync" | |
) | |
// StopInformerMap provides an easy interface for interacting with named stop informers | |
type StopInformerMap interface { | |
// Starts a new named stop informer | |
Start(name string, informer StopInformer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: resilio | |
--- | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: resilio-pv-volume | |
namespace: resilio |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package threadsafe | |
import ( | |
"sync" | |
"time" | |
) | |
// Handy for comparisons | |
var ZeroTime = time.Time{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package threadsafe | |
import ( | |
"sync" | |
"time" | |
) | |
// Based on https://gist.github.com/clarkmcc/2c40db4bb7b3aea412d78c8a490f030e | |
// ExpiringErrorCounter maintains a registry of counter errors that expires | |
// after a specified amount of time. For example if the expiration were set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package reflector | |
import ( | |
"sync" | |
) | |
// Batcher knows how to batch a slice of objects, calling do for each batch | |
// until Next returns false. | |
// | |
// batcher.Next(func(objs []interface{}) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getAllFilenames(fs *embed.FS, path string) (out []string, err error) { | |
if len(path) == 0 { | |
path = "." | |
} | |
entries, err := fs.ReadDir(path) | |
if err != nil { | |
return nil, err | |
} | |
for _, entry := range entries { | |
fp := filepath.Join(path, entry.Name()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for namespace in $(kubectl get ns | awk '{print $1}' | grep -v NAME); do | |
for pod in $(kubectl get pod -n $namespace --field-selector=status.phase!=Running | grep Shutdown | awk '{print $1}' | grep -v NAME); do | |
kubectl delete pod -n "$namespace" "$pod" | |
done | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
# Build the container image | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$PROJECT_NAME:$SHORT_SHA', '--cache-from', 'gcr.io/$PROJECT_ID/$PROJECT_NAME', '.'] | |
# Push the container image to Container Registry | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ['push', 'gcr.io/$PROJECT_ID/$PROJECT_NAME:$SHORT_SHA'] | |
# Deploy to Google Cloud Run | |
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' | |
entrypoint: gcloud |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Diffie-Hellman asymetric key exchange allows two | |
// parties to cooperatively create a shared secret | |
// key without ever exchanging the shared secret. | |
// This means that it will be nearly impossible for | |
// a malicious party observing the creation of the | |
// shared secret to determine the secret key. | |
// Randomly create a generator number and a number p | |
// These two numbers are shared between both parties | |
// in the public space which means they're potentially |