Skip to content

Instantly share code, notes, and snippets.

Cezar Sá Espinola cezarsa

Block or report user

Report or block cezarsa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View terraform output
$ 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"
View working_too_much.py
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')
View gist:1a0a3aefe602bd072974926a0073312e
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"
View gist:a919ddc198d509ea612518c2e05c984f
#!/bin/bash
trap 'echo "Done user data script."' EXIT
echo "Running user data script..."
sleep 30
View a.diff
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)
View test.go
func (s *S) TestRoundTripSNI(c *check.C) {
var receivedReq *http.Request
ts := httptest.NewTLSServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
receivedReq = req
rw.Header().Set("X-Some-Rsp-Header", "rspvalue")
rw.WriteHeader(200)
rw.Write([]byte("my result"))
}))
defer ts.Close()
router := &recoderRouter{dst: ts.URL}
View nodecontainer.diff
diff --git a/provision/swarm/docker.go b/provision/swarm/docker.go
index 8d7b4eb..64b4bcf 100644
--- a/provision/swarm/docker.go
+++ b/provision/swarm/docker.go
@@ -601,7 +601,7 @@ func serviceSpecForNodeContainer(name, pool string) (*swarm.ServiceSpec, error)
return service, nil
}
-func upsertService(spec *swarm.ServiceSpec, client *docker.Client) (error, bool) {
+func upsertService(spec *swarm.ServiceSpec, client *docker.Client, placementOnly bool) (error, bool) {
View gist:d1ed0a2ae5d96b55094a21f2f302382b
https://github.com/go-errors/errors
https://github.com/palantir/stacktrace
https://github.com/ansel1/merry
https://github.com/go-errgo/errgo
https://github.com/amattn/deeperror
https://github.com/pkg/errors
https://github.com/hashicorp/errwrap
View mgo.go
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
func withUpsert(c *mgo.Collection) {
_, err := c.Upsert(bson.M{"_id": 1, "x": 2}, bson.M{"$set": bson.M{"x": 3}})
View gist:47b96c951eb41c2688efdbfb12c18d7f
runtime: writebarrierptr *0xc820419698 = 0x20
fatal error: bad pointer in write barrier
runtime stack:
runtime.throw(0xd5c300, 0x1c)
/home/vagrant/.gimme/versions/go1.6.2.linux.amd64/src/runtime/panic.go:547 +0x90
runtime.writebarrierptr.func1()
/home/vagrant/.gimme/versions/go1.6.2.linux.amd64/src/runtime/mbarrier.go:140 +0xb3
runtime.systemstack(0xc820024000)
/home/vagrant/.gimme/versions/go1.6.2.linux.amd64/src/runtime/asm_amd64.s:291 +0x79
You can’t perform that action at this time.