Skip to content

Instantly share code, notes, and snippets.

View akshaybharambe14's full-sized avatar
🎯
Focusing

Akshay Bharambe akshaybharambe14

🎯
Focusing
View GitHub Profile
@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
}
@parmentf
parmentf / GitCommitEmoji.md
Last active May 4, 2024 16:59
Git Commit message Emoji
@alexchowle
alexchowle / pingpong.go
Created February 7, 2016 16:57
Simple golang pingpong
package main
import (
"fmt"
)
func main() {
pingChan := make(chan string)
pongChan := make(chan string)
@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active May 4, 2024 14:16
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@creack
creack / main.go
Created January 7, 2018 17:30 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@fracasula
fracasula / context_cancel.go
Last active May 19, 2022 20:49
GoLang exiting from multiple go routines with context and wait group
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"
package main
import (
"fmt"
"os"
"os/signal"
"sync"
"time"
)
@carlolars
carlolars / gitkraken-wsl-bash.bat
Last active February 10, 2023 21:08
Use bash from WSL as sh.exe for GitKraken (5.0.4) for Windows
@echo off
REM Make sure that the path to the script is correct!
@bash -l -c "~/bin/gitkraken-wsl-bash.sh %*"
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