Skip to content

Instantly share code, notes, and snippets.

@albertoleal
albertoleal / strava.go
Last active November 14, 2017 06:06
Strava client mock
package strava_test
import (
"net"
"net/http"
"net/url"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@albertoleal
albertoleal / Dockerfile
Created September 30, 2016 11:20
Spike with btrfs 4.7.3
# RUN apt-get install -y uidmap btrfs-tools sudo
RUN apt-get update
RUN apt-get install -y uidmap wget sudo liblzo2-dev libblkid-dev e2fslibs-dev pkg-config libz-dev curl
RUN wget https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v4.7.3.tar.xz && \
tar xf btrfs-progs-v4.7.3.tar.xz && \
cd btrfs-progs-v4.7.3 && \
./configure --disable-documentation && \
make static && make install-static && \
files=$(ls *.static) && \
@albertoleal
albertoleal / gocached.go
Last active June 9, 2016 12:12
Gocached with channels
type Server interface {
Running() bool
Start() error
Stop() error
}
type cache struct {
MagicNumber byte
MessageType byte
package main
import (
"fmt"
"sync"
"github.com/cloudfoundry-incubator/garden"
"github.com/cloudfoundry-incubator/garden/client"
"github.com/cloudfoundry-incubator/garden/client/connection"
)
@albertoleal
albertoleal / tmux-cheatsheet.markdown
Created March 23, 2016 19:12 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@albertoleal
albertoleal / goserver.go
Created May 7, 2015 13:51
Playing with go
package main
import (
"bytes"
"io"
"io/ioutil"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
func (a *Auth) Login(email, password string) string {
url, err := GetURL("/api/login")
if err != nil {
return err.Error()
}
b := bytes.NewBufferString(`{"email":"` + email + `", "password":"` + password + `"}`)
req, err := http.NewRequest("POST", url, b)
if err != nil {
return err.Error()
}
@albertoleal
albertoleal / negroni_issue.go
Last active August 29, 2015 14:10
negroni_issue.go
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/gorilla/context"
"github.com/codegangsta/negroni"
### Keybase proof
I hereby claim:
* I am albertoleal on github.
* I am albertoleal (https://keybase.io/albertoleal) on keybase.
* I have a public key whose fingerprint is 8546 4568 C761 48C5 4826 1137 1B4C 8442 E30B 7488
To claim this, I am signing this object: