Skip to content

Instantly share code, notes, and snippets.

View developer-guy's full-sized avatar
🐾
Every artifact can be verifiably traced to Source Code and Hardware

Batuhan Apaydın developer-guy

🐾
Every artifact can be verifiably traced to Source Code and Hardware
View GitHub Profile
@developer-guy
developer-guy / go-github-workflow.go
Created November 24, 2020 08:38
Workflow Job's list
package main
import (
"context"
"fmt"
"github.com/google/go-github/v32/github"
)
func main() {
client := github.NewClient(nil)
@developer-guy
developer-guy / go-oauth2.go
Created November 24, 2020 08:34
Go oauth2 sample for Github
package main
import (
"context"
"fmt"
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
"log"
"net"
"net/http"
@developer-guy
developer-guy / cross-build-dockerfile-with-args
Created November 23, 2020 08:07
cross-build-dockerfile-with-args
$ cat <<EOF >> Dockerfile
FROM alpine
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG BUILDPLATFORM
ARG BUILDOS
ARG BUILDARCH
@developer-guy
developer-guy / cross-build
Created November 23, 2020 07:29
cross-build
$ cat Makefile
cross-build:
@docker buildx create --name mybuilder --use
@docker buildx build --platform ${BUILDX_PLATFORMS} -t ${PROD_IMAGE} --push ./app
$ BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64"
$ curl --output docker-buildx \
--silent --show-error --location --fail --retry 3 \
"$BUILDX_BINARY_URL"
$ mkdir -p ~/.docker/cli-plugins
@developer-guy
developer-guy / docker_attach
Created November 19, 2020 07:30 — forked from miki725/docker_attach
Attach to docker container via nsenter
#!/bin/bash
USAGE="Attach to Docker Container
--------------------------
Attach to Docker Container even if the container does not run
ssh daemon. This is accomplished by using linux containers
directly via 'nsenter' (see http://bit.ly/docker_nsenter).
To install 'nsenter', just execute:
$ docker run -v /usr/local/bin:/target jpetazzo/nsenter
+----------------------------------+---------+------------------------+----------------+
| Col1 | Col2 | Col3 | Numeric Column |
+----------------------------------+---------+------------------------+----------------+
| Value 1 | Value 2 | 123 | 10.0 |
| Separate | cols | with a tab or 4 spaces | -2,027.1 |
| This is a row with only one cell | | | |
+----------------------------------+---------+------------------------+----------------+
@developer-guy
developer-guy / Dockerfile
Created November 10, 2020 10:33 — forked from avishayp/Dockerfile
Add non-root user for alpine linux
# non root user example for alpine
#
# usage:
# $ docker build --build-arg "USER=someuser" --tag test .
# $ docker run --rm test
FROM alpine
ARG USER=default
ENV HOME /home/$USER
@developer-guy
developer-guy / kubectl.md
Created November 8, 2020 21:12 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@developer-guy
developer-guy / one_liner.sh
Created November 8, 2020 15:18 — forked from zparnold/one_liner.sh
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@developer-guy
developer-guy / serve.go
Created November 6, 2020 18:53 — forked from paulmach/serve.go
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main