Skip to content

Instantly share code, notes, and snippets.

View arriqaaq's full-sized avatar
🎯
Focusing

Farhan arriqaaq

🎯
Focusing
View GitHub Profile
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())
type evictor interface {
Run(*shard)
Stop()
}
func newSweeper(interval time.Duration) evictor {
return &sweeper{
interval: interval,
stopC: make(chan bool),
}
package main
import (
"fmt"
"github.com/arriqaaq/boomerang"
lucio "github.com/arriqaaq/server"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
"os"
package main
import (
"github.com/arriqaaq/boomerang"
lucio "github.com/arriqaaq/server"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
"os"
"time"
package main
import (
"log"
"github.com/go-redis/redis"
)
func main() {
client := redis.NewClient(&redis.Options{
#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"
// 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 {
package main
import (
"fmt"
"sync"
)
type Receiver struct{
doneCh chan bool
wg sync.WaitGroup
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
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 { \