Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Akshay Bharambe akshaybharambe14

🎯
Focusing
View GitHub Profile
View count.go
func count(reader *bufio.Reader) (int, error) {
count := 0
for {
line, _, err := reader.ReadLine()
if err != nil {
switch err {
default:
return 0, errors.Wrapf(err, "unable to read")
case io.EOF:
return count, nil
@carlolars
carlolars / gitkraken-wsl-bash.bat
Last active Oct 21, 2020
Use bash from WSL as sh.exe for GitKraken (5.0.4) for Windows
View gitkraken-wsl-bash.bat
@echo off
REM Make sure that the path to the script is correct!
@bash -l -c "~/bin/gitkraken-wsl-bash.sh %*"
View synccondsimple.go
package main
import (
"fmt"
"os"
"os/signal"
"sync"
"time"
)
@fracasula
fracasula / context_cancel.go
Last active Oct 15, 2020
GoLang exiting from multiple go routines with context and wait group
View context_cancel.go
package main
// Here's a simple example to show how to properly terminate multiple go routines by using a context.
// Thanks to the WaitGroup we'll be able to end all go routines gracefully before the main function ends.
import (
"context"
"fmt"
"math/rand"
"os"
@creack
creack / main.go
Created Jan 7, 2018 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@enricofoltran
enricofoltran / main.go
Last active Oct 23, 2020
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@alexchowle
alexchowle / pingpong.go
Created Feb 7, 2016
Simple golang pingpong
View pingpong.go
package main
import (
"fmt"
)
func main() {
pingChan := make(chan string)
pongChan := make(chan string)
@parmentf
parmentf / GitCommitEmoji.md
Last active Oct 25, 2020
Git Commit message Emoji
View GitCommitEmoji.md
@azer
azer / Makefile
Last active Aug 5, 2020
Makefile for Go Projects
View Makefile
GOPATH=$(shell pwd)/vendor:$(shell pwd)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o bin/$(GONAME) $(GOFILES)
@moraes
moraes / gist:2141121
Last active Oct 15, 2020
LIFO Stack and FIFO Queue in golang
View gist:2141121
package main
import (
"fmt"
)
type Node struct {
Value int
}
You can’t perform that action at this time.