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
@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 / tmux.md
Created December 18, 2017 05:49 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@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

Keybase proof

I hereby claim:

  • I am ahmetb on github.
  • I am alp (https://keybase.io/alp) on keybase.
  • I have a public key ASB3Us2SJzEmVMqSFuc4nHcOh1xbv3QZfwp0Izayulo8vgo

To claim this, I am signing this object:

@ahmetb
ahmetb / keybase.md
Last active September 14, 2016 17:40

Keybase proof

I hereby claim:

  • I am ahmetalpbalkan on github.
  • I am alp (https://keybase.io/alp) on keybase.
  • I have a public key whose fingerprint is BF91 C773 DD1E 2E87 AFE9 616F F84A 66B2 CBC2 9F60

To claim this, I am signing this object:

@ahmetb
ahmetb / -
Created December 12, 2015 00:07
#cloud-config
disable_root: false
manage_etc_hosts: true
# The modules that run in the 'init' stage
cloud_init_modules:
- migrator
- ubuntu-init-switch
- seed_random
- bootcmd
gkahuna@lmp-swarm-i-master:~$ cat docker-extension.log
[DockerExtension] 2015/07/09 15:02:14 ----------------------------------------
[DockerExtension] 2015/07/09 15:02:14 Extension handler launch args: "./bin/docker-extension install"
[DockerExtension] 2015/07/09 15:02:14 Status 'transitioning' not reported for operation 'Install Docker' (by design)
[DockerExtension] 2015/07/09 15:02:14 distro info: Ubuntu 14.04
[DockerExtension] 2015/07/09 15:02:14 using distro driver: driver.UbuntuUpstartDriver
[DockerExtension] 2015/07/09 15:02:14 user: root uid:0 gid:0
[DockerExtension] 2015/07/09 15:02:14 env['PATH'] = /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
[DockerExtension] 2015/07/09 15:02:14 + starting: 'install'
[DockerExtension] 2015/07/09 15:02:14 ++ install docker
#!/bin/bash
set -e
image='tianon/speedtest'
layer='b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f'
# docker inspect b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f | grep '"Size"'
# "Size": 580580561,
# ("Content-Length: 228991341" though...)
token="$(curl -sSL -o /dev/null -D- -H 'X-Docker-Token: true' "https://index.docker.io/v1/repositories/$image/images" | awk -F ':[[:space:]]*|\r' '$1 == "X-Docker-Token" { print $2 }')"
#!/bin/bash
set -e
image='tianon/speedtest'
layer='b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f'
# docker inspect b31651d7665036bcf58a0b6b0d7aca173daff87b003ec50621cb0fde8d68864f | grep '"Size"'
# "Size": 580580561,
# ("Content-Length: 228991341" though...)
token="$(curl -sSL -o /dev/null -D- -H 'X-Docker-Token: true' "https://index.docker.io/v1/repositories/$image/images" | awk -F ':[[:space:]]*|\r' '$1 == "X-Docker-Token" { print $2 }')"