Skip to content

Instantly share code, notes, and snippets.

View cezarsa's full-sized avatar

Cezar Sá Espinola cezarsa

  • Brasília - DF / Brazil
  • 00:03 (UTC -03:00)
View GitHub Profile
@cezarsa
cezarsa / robot.js
Created November 28, 2012 16:03
Simple Wall Robot
var Robot = function(robot){
robot.turnLeft(robot.angle % 90);
robot.turnGunRight(90);
robot.clone();
this.direction = 1;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(1);
if (robot.parentId) {
ticker := time.NewTicker(time.Minute)
defer ticker.Stop()
for {
select {
case <-ticker.C:
// poll the image build status
case evt := <-webhookRequest:
ticker.Reset(time.Minute)
// update the image build status with evt
case <-time.After(30*time.Minute):
#!/bin/bash
set -eo pipefail
TSURU_TARGET=${TSURU_TARGET:-https://tsuru.globoi.com}
TSURU_TOKEN=${TSURU_TOKEN:-$(cat ~/.tsuru/token)}
target=$(sed "s|/$||g" <<<$TSURU_TARGET)
clusters="$(curl -fsS -H"Authorization: bearer ${TSURU_TOKEN}" ${target}/provisioner/clusters)"
func BenchmarkClusterIP(b *testing.B) {
nSvcs := 1000
endpointsPerSvc := 2
var allSvcs []*v1.Service
var allEndpoints []*v1.Endpoints
for i := 0; i < nSvcs; i++ {
allSvcs = append(allSvcs, makeTestService("ns1", fmt.Sprintf("svc-%d", i), func(svc *v1.Service) {
ip := net.ParseIP("10.0.0.0").To4()
ip[2] = byte(uint32(i+1) >> 8 & 0xff)
ip[3] = byte(uint32(i+1) & 0xff)
$ TF_LOG=trace terraform plan
2019/08/19 18:46:11 [INFO] Terraform version: 0.12.6
2019/08/19 18:46:11 [INFO] Go runtime version: go1.12.7
2019/08/19 18:46:11 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}
2019/08/19 18:46:11 [DEBUG] Attempting to open CLI config file: /Users/cezarsa/.terraformrc
2019/08/19 18:46:11 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/08/19 18:46:11 [INFO] CLI command args: []string{"plan"}
2019/08/19 18:46:11 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/08/19 18:46:11 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/08/19 18:46:11 [DEBUG] New state was assigned lineage "f206e877-0e66-9514-49b4-031d2e56c320"
import os
from datetime import datetime, timedelta
import slack
import holidays
SLACK_TOKEN = os.environ.get('SLACK_TOKEN')
SLACK_USER = os.environ.get('SLACK_USER')
from_date = datetime.strptime('2019-01-01', '%Y-%m-%d')
to_date = datetime.strptime('2019-06-18', '%Y-%m-%d')
@cezarsa
cezarsa / curl
Last active June 14, 2019 20:52
tsuru curl plugin
#!/bin/bash
TARGET=$(echo ${TSURU_TARGET} | sed "s|/$||g")
curl -sS -H"Authorization: bearer ${TSURU_TOKEN}" ${TARGET}$@
package main
import (
"context"
"fmt"
"github.com/tsuru/rpaas-operator/pkg/apis"
"github.com/tsuru/rpaas-operator/pkg/apis/extensions/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
#!/bin/bash
trap 'echo "Done user data script."' EXIT
echo "Running user data script..."
sleep 30
diff --git a/provision/kubernetes/deploy.go b/provision/kubernetes/deploy.go
index 587eac2e0..f729c2682 100644
--- a/provision/kubernetes/deploy.go
+++ b/provision/kubernetes/deploy.go
@@ -455,8 +455,12 @@ func monitorDeployment(client *clusterClient, dep *v1beta1.Deployment, a provisi
fmt.Fprintf(w, " ---> %d of %d new units created\n", dep.Status.UpdatedReplicas, specReplicas)
}
if healthcheckTimeout == nil && dep.Status.UpdatedReplicas == specReplicas {
- healthcheckTimeout = time.After(maxWaitTimeDuration)
- fmt.Fprintf(w, " ---> waiting healthcheck on %d created units\n", specReplicas)