Skip to content

Instantly share code, notes, and snippets.

View ahmetb's full-sized avatar
🛑
Slow to respond

Ahmet Alp Balkan ahmetb

🛑
Slow to respond
View GitHub Profile
package ctrlutil
import (
"context"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"
)
@ahmetb
ahmetb / gcpauth.go
Created May 22, 2018 17:21
Authenticating to GKE cluster with client-go, IAM service account and a Google auth plugin written from scratch
package main
import (
"context"
"fmt"
"log"
"net/http"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
@ahmetb
ahmetb / gcrgc.sh
Last active February 26, 2024 09:14
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"log"
"sync"
@ahmetb
ahmetb / domains
Created August 26, 2012 15:48
List of gov.tr domain names I discovered (bulabildigim kadariyla bir gov.tr alan adlari listesi)
3158 GOV.TR domain names
http://ahmetalpbalkan.com/blog/gov-tr-alan-adlari-listesi/
==================================
100yilyy.gov.tr
19mayis.gov.tr
28kontrollab.gov.tr
360sakarya.gov.tr
80yilrehabilitasyon.gov.tr
9fi.gov.tr
@ahmetb
ahmetb / a.go
Created September 30, 2021 19:04
package main
import "fmt"
// [[1, 2, 7], [3, 6, 7]]
// given a src and dest stop, what is the minimum number of hops?
// src: 2 dst:3
// r0 8->3
// r1 7->8
// r2 1->2->7
@ahmetb
ahmetb / main.go
Last active August 21, 2020 05:06
Use Knative API with Cloud Run client library (KUBECONFIG authentication)
package main
import (
"context"
"fmt"
"net/http"
"google.golang.org/api/option"
"google.golang.org/api/run/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth"
@ahmetb
ahmetb / main.go
Created August 21, 2020 04:34
Authenticate Knative on GKE using Cloud Run API client library
package main
import (
"context"
"crypto/x509"
"encoding/base64"
"fmt"
"net/http"
"golang.org/x/oauth2"
@ahmetb
ahmetb / main.go
Last active August 19, 2020 18:38
using Knative API with Cloud Run client library
package main
import (
"context"
"log"
"net/http"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/option"
@ahmetb
ahmetb / probe.go
Created August 28, 2019 17:05
api/probe.go
// Package handler (directory named 'api/') is recognized
// by ZEIT Now v2 Lambda platform.
package handler
import (
"net/http"
)
func init() { log.SetFlags(log.Lmicroseconds) }