Skip to content

Instantly share code, notes, and snippets.

View base-layer-dock
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
View chan-mania.go
package main
import (
"fmt"
"sync"
)
type Receiver struct{
doneCh chan bool
wg sync.WaitGroup
View close-chanel.go
// 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 {
View utd.py
#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"
View redis-conn.go
package main
import (
"log"
"github.com/go-redis/redis"
)
func main() {
client := redis.NewClient(&redis.Options{
View service-b.go
package main
import (
"github.com/arriqaaq/boomerang"
lucio "github.com/arriqaaq/server"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
"os"
"time"
View service-a.go
package main
import (
"fmt"
"github.com/arriqaaq/boomerang"
lucio "github.com/arriqaaq/server"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
"os"
View sweeper.go
type evictor interface {
Run(*shard)
Stop()
}
func newSweeper(interval time.Duration) evictor {
return &sweeper{
interval: interval,
stopC: make(chan bool),
}
View scrooge.go
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())
View scrooge.go
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())