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 ( | |
"encoding/json" | |
"fmt" | |
"strconv" | |
"time" | |
) | |
type CustomTime struct { |
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
//delete the key if valueOf type is empty | |
reader := strings.NewReader(string(message)) | |
// writer := os.Stdout | |
dec := json.NewDecoder(reader) | |
// enc := json.NewEncoder(writer) | |
for { | |
var m map[string]interface{} | |
if err := dec.Decode(&m); err == io.EOF { | |
break | |
} else if err != nil { |
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
echo alias purge_cache=\"curl -X POST "https://api.cloudflare.com/client/v4/zones/YOUR_ZONE/purge_cache" -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" --data "{"purge_everything":true}"\" >> ~/.zshrc && source | |
#then you can use purge_cache in your terminal to purge caches in cloudflare zone that you provided |
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
//you can go to Manage Jenkins > Script Console | |
import jenkins.model.Jenkins | |
import hudson.model.Job | |
MAX_BUILDS = 55 | |
Jenkins.instance.getAllItems(Job.class).each { job -> | |
println job.name | |
def recent = job.builds.limit(MAX_BUILDS) | |
for (build in job.builds) { |
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 * as dotenv from 'dotenv'; | |
import winston from 'winston' | |
const logger = winston.createLogger({ | |
level: 'info', | |
format: winston.format.json(), | |
defaultMeta: { service: 'user-service' }, | |
transports: [ | |
new winston.transports.File({ filename: process.env.ERROR_LOGS, level: 'error' }), | |
new winston.transports.File({ filename: process.env.WARNING_LOGS, level: 'warning' }), | |
new winston.transports.File({ filename: process.env.INFO_LOGS, level: 'info' }), |
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 golang:latest | |
COPY main.go main.go | |
COPY controllers.go controllers.go | |
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . | |
FROM scratch | |
MAINTAINER Uğur Kazdal girisiyorum@gmail.com | |
COPY --from=0 /go/main . |
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" | |
"net/http" | |
"sync" | |
"time" | |
) | |
func ping(w http.ResponseWriter, r *http.Request) { |
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:latest | |
RUN apk --update add ca-certificates | |
RUN apk add git | |
RUN apk add bash | |
ENTRYPOINT ["tail", "-f", "/dev/null"] | |
#You can now run it via docker run -d IMAGE_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
FROM golang:latest | |
COPY main.go main.go | |
RUN go get github.com/joho/godotenv | |
RUN go get github.com/lib/pq | |
RUN go get golang.org/x/oauth2/google | |
RUN go get google.golang.org/api/compute/v1 | |
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . |
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
find . -type f -not -path '*/\.*' -exec sed -i -e "s@<base href=\"\/\/www.mydomain.com.\"\/>@\/@" {} \; |