Skip to content

Instantly share code, notes, and snippets.

View cmelbye's full-sized avatar

Charlie Melbye cmelbye

  • Snap, Inc.
  • Santa Monica
View GitHub Profile

Keybase proof

I hereby claim:

  • I am cmelbye on github.
  • I am melbyec (https://keybase.io/melbyec) on keybase.
  • I have a public key ASAibO1Oo1d77CNrdMaXZlEPDwm0N3Ao3Pu3K8_OhF9bOgo

To claim this, I am signing this object:

Raven.capture_message("Failed to send push notification (#{reason})", {
:logger => "urbanairship",
:extra => {
'Notification' => notification,
'Response' => reason,
'Response code' => response.code,
},
:user => {
'id' => recipient.id,
'email' => recipient.email,
package main
type Request struct {
}
type Pool chan Request
func main() {
}
@cmelbye
cmelbye / json.go
Last active September 29, 2015 20:38
package main
import (
"encoding/json"
"errors"
"log"
"net/http"
)
/*
// Copyright 2014 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package internal
// This file implements a network dialer that limits the number of concurrent connections.
// It is only used for API calls.
import (
var limitSem = make(chan int, 100) // TODO(dsymonds): Use environment variable.
func limitRelease() {
// non-blocking
select {
case <-limitSem:
default:
// This should not normally happen.
log.Print("appengine: unbalanced limitSem release!")
}
type limitConn struct {
mu sync.Mutex // only for closing the net.Conn
net.Conn
}
func (lc *limitConn) Read(b []byte) (int, error) {
lc.mu.Lock()
defer lc.mu.Unlock()
if lc.Conn == nil {
goroutine 74122 [semacquire]:
sync.(*Mutex).Lock(0xc214391ea0)
/usr/local/go/src/sync/mutex.go:66 +0xd3
google.golang.org/appengine/internal.(*limitConn).Close(0xc214391ea0, 0x0, 0x0)
google.golang.org/appengine/internal/net.go:61 +0x45
net/http.(*persistConn).closeLocked(0xc209ea6e70)
/usr/local/go/src/net/http/transport.go:1147 +0x55
net/http.(*persistConn).close(0xc209ea6e70)
/usr/local/go/src/net/http/transport.go:1141 +0x73
net/http.(*Transport).putIdleConn(0xc208052120, 0xc209ea6e70, 0xc20b534fc0)
➜ ~ docker run -t -i google/appengine-go /bin/bash
exec: "/app/_ah/exe": stat /app/_ah/exe: no such file or directoryFATA[0000] Error response from daemon: Cannot start container 7a9d6a201617c95fdd0d96f96e07b0f6b39e95c7cbf2f1f7ad4bf25581fdfc40: exec: "/app/_ah/exe": stat /app/_ah/exe: no such file or directory
# Dockerfile extending the generic Go image with application files for a
# single application.
FROM google/appengine-go
RUN apt-get update && apt-get install nasm
RUN curl -L https://github.com/mozilla/mozjpeg/releases/download/v3.0/mozjpeg-3.0-release-source.tar.gz | tar xvz
RUN cd mozjpeg && ./configure && make install
ENV GOMAXPROCS 4