This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type service struct { | |
storage db.DB | |
logger log.Logger | |
db *sql.DB | |
cache *zizou.Cache | |
} | |
func (s *service) GetEcpm(data getEcpmRequest) (float64, error) { | |
key := NewKey(data.GetCountryId(), data.GetPartner(), data.GetGameId()) | |
icVal, found := s.cache.Get(key.Id()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type evictor interface { | |
Run(*shard) | |
Stop() | |
} | |
func newSweeper(interval time.Duration) evictor { | |
return &sweeper{ | |
interval: interval, | |
stopC: make(chan bool), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/arriqaaq/boomerang" | |
lucio "github.com/arriqaaq/server" | |
"github.com/prometheus/client_golang/prometheus/promhttp" | |
"log" | |
"net/http" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/arriqaaq/boomerang" | |
lucio "github.com/arriqaaq/server" | |
"github.com/prometheus/client_golang/prometheus/promhttp" | |
"log" | |
"net/http" | |
"os" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"github.com/go-redis/redis" | |
) | |
func main() { | |
client := redis.NewClient(&redis.Options{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Import the necessary methods from tweepy library | |
from tweepy.streaming import StreamListener | |
from tweepy import OAuthHandler | |
from tweepy import Stream | |
access_token="ENTER YOUR ACCESS TOKEN" | |
access_token_secret="ENTER YOUR ACCESS TOKEN SECRET" | |
consumer_key="ENTER YOUR API KEY" | |
consumer_secret="ENTER YOUR API SECRET" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Closer holds the two things we need to close a goroutine and wait for it to finish: a chan | |
// to tell the goroutine to shut down, and a WaitGroup with which to wait for it to finish shutting | |
// down. | |
type Closer struct { | |
closed chan struct{} | |
waiting sync.WaitGroup | |
} | |
// NewCloser constructs a new Closer, with an initial count on the WaitGroup. | |
func NewCloser(initial int) *Closer { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
type Receiver struct{ | |
doneCh chan bool | |
wg sync.WaitGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.7 | |
RUN apk update && \ | |
apk add --no-cache xorriso git xz curl tar iptables cpio bash && \ | |
rm -rf /var/cache/apk/* | |
RUN apk add -U --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing aufs-util | |
RUN addgroup -g 2999 docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mockingbird/base-image | |
ENV MYSQL_MAJOR 5.6 | |
ENV MYSQL_VERSION 5.6.44-1debian9 | |
RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list | |
# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) | |
# also, we set debconf keys to make APT a little quieter | |
RUN { \ |