Skip to content

Instantly share code, notes, and snippets.

View cezarsa's full-sized avatar

Cezar Sá Espinola cezarsa

  • Brasília - DF / Brazil
  • 07:21 (UTC -03:00)
View GitHub Profile
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
@cezarsa
cezarsa / mgo.go
Last active August 11, 2016 18:19
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}})
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
@cezarsa
cezarsa / Bubble color picker.markdown
Last active May 28, 2016 03:56
Bubble color picker
@cezarsa
cezarsa / basic.go
Created August 13, 2015 22:35
basic
package main
import (
"fmt"
"net/http"
"os"
)
func rootHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello world"))

Estará disponível para uso pelos participantes do Hack in PoA um ambiente do tsuru.

O tsuru é uma plataforma open source que tem como objetivo diminuir o tempo que um projeto entra em produção, similar a outras plataformas como o Heroku.

As instruções de uso do ambiente do tsuru do Hack in PoA estão disponíveis em http://hackinpoa.globo.com/projetos/tsuru

Counting objects: 15, done.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (15/15), 1007.67 KiB | 0 bytes/s, done.
Total 15 (delta 0), reused 0 (delta 0)
remote: Cloning into '/home/application/current'...
remote: /
remote: Building...
remote: /var/lib/activator:
remote: activator activator-launch-1.3.2.jar activator.bat
remote: Getting com.typesafe.activator activator-launcher 1.3.2 ...
@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}$@
#!/bin/bash
id=$(docker run -d ubuntu:14.04 bash -c "mkdir -p /x && touch /x/a")
docker wait $id
sleep 1
docker commit $id myimg
docker run myimg ls -l /x --time-style=full-iso
id=$(docker run -d myimg bash -c "rm -rf /x && mkdir /x && touch /x/a")
docker wait $id
sleep 1