Skip to content

Instantly share code, notes, and snippets.

View uurtech's full-sized avatar
✈️
Works

Ugur KAZDAL uurtech

✈️
Works
View GitHub Profile
@uurtech
uurtech / purge_cache.sh
Created February 11, 2020 10:34
Bash command to purge cloudflare cache
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
@uurtech
uurtech / script.groovy
Created February 28, 2020 16:41
Delete Old Builds Jenkins Script
//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) {
@uurtech
uurtech / logger.ts
Created March 12, 2020 16:05
Typescript Nodejs Logger script
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' }),
@uurtech
uurtech / controller.go
Created March 22, 2020 14:31
Return Http Response and then Perform other tasks
package main
import (
"fmt"
"net/http"
"sync"
"time"
)
func ping(w http.ResponseWriter, r *http.Request) {
@uurtech
uurtech / Dockerfile
Created April 28, 2020 16:37
Keep Git Container Running
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
@uurtech
uurtech / Dockerfile
Created May 13, 2020 21:15
Kubernetes app that can access to gcloud vms
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 .
@uurtech
uurtech / that.sh
Created May 16, 2020 07:37
Replace html tag recursively on linux
find . -type f -not -path '*/\.*' -exec sed -i -e "s@<base href=\"\/\/www.mydomain.com.\"\/>@\/@" {} \;
@uurtech
uurtech / run.sh
Created May 17, 2020 11:47
Bash + Curl download files for number of range
set -B # enable brace expansion
for i in {1..38}; do
curl "https://www.dr.com.tr/sitemaps/product/product_${i}.xml" -o "product_${i}.xml"
done
@uurtech
uurtech / main.go
Created May 28, 2020 14:49
Golang Json Parse Empty Interface
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@uurtech
uurtech / job.yaml
Created June 5, 2020 09:31
Kubernetes cronjob
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: xml-checker
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
spec: