Skip to content

Instantly share code, notes, and snippets.

apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: admin-user
package main
import (
"log"
"net/http"
"time"
"github.com/alexellis/faas/gateway/metrics"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus"
@farhany
farhany / multipart_upload.go
Created April 28, 2019 08:54 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@farhany
farhany / check.go
Created May 22, 2019 18:26 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@farhany
farhany / exec.go
Created May 30, 2019 04:31 — forked from danesparza/exec.go
Go exec.Command example
package main
import (
"bytes"
"fmt"
"os/exec"
"strings"
)
func main() {
@farhany
farhany / gist:2ede31c2dcdeede5744688a17e810008
Created June 11, 2019 06:53 — forked from schmichael/gist:7379338
Transparently compress and upload a file in golang
package main
import (
"bufio"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
@farhany
farhany / FIRE.PAS
Created June 20, 2019 03:40 — forked from specht/FIRE.PAS
program firetest;
{ Classic fire animation using VGA mode 13h and colors 0 to 63... wee !!! }
uses Crt, VGA;
var i, heat: Integer;
quit: Boolean;
c: Char;
package gziphandler
import (
"compress/gzip"
"log"
"net/http"
"strings"
"sync"
)
@farhany
farhany / tmux-cheatsheet.markdown
Created October 11, 2019 05:36 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
package main
import "net"
func echoServer(c net.Conn) {
for {
buf := make([]byte, 512)
nr, err := c.Read(buf)
if err != nil {
return