Skip to content

Instantly share code, notes, and snippets.

View ehernandez-xk's full-sized avatar
Verified

Eddy ehernandez-xk

Verified
  • Guatemala
View GitHub Profile
# This tells kubecfg to read its config from the local directory
export KUBECONFIG=./kubeconfig
# Looking at the cluster
kubectl get nodes
kubectl get pods --namespace=kube-system
# Running a single pod
kubectl run --generator=run-pod/v1 --image=gcr.io/kuar-demo/kuard-amd64:1 kuard
kubectl get pods
@nguyendangminh
nguyendangminh / favicon.ico.go
Last active November 9, 2024 08:01
Serve favicon.ico in Golang
...
func faviconHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "relative/path/to/favicon.ico")
}
...
func main() {
http.HandleFunc("/favicon.ico", faviconHandler)
}
@jmoiron
jmoiron / 01-curl.go
Last active October 19, 2024 11:28
io.Reader & io.Writer fun
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func init() {
@shockalotti
shockalotti / Go Golang - recursion function, calculate factorial
Created May 28, 2014 01:33
Go Golang - recursion function, calculate factorial
package main
import "fmt"
func factorial(x uint) uint {
if x == 0 {
return 1
}
return x * factorial(x-1)
@jd-boyd
jd-boyd / jsonpp.go
Last active November 28, 2021 06:30
A Json pretty printer written in golang.
//Build with: go build ./jsonpp.go
package main
import "encoding/json"
import "fmt"
import "io/ioutil"
import "os"
@geedew
geedew / vagrant-scp
Last active July 22, 2017 15:16
Copying files to a Vagrant VM from host
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
SERVER=localhost
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} $FILE vagrant@$SERVER:$PATH
@mchirico
mchirico / bashFor.go
Last active October 29, 2023 04:14
Go (golang) program to execute a bash for loop.
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
"strings"
)
@moraes
moraes / gist:2141121
Last active May 1, 2023 19:02
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}