Skip to content

Instantly share code, notes, and snippets.

View MilosSimic's full-sized avatar

Milos MilosSimic

  • Faculty of technical sciences Novi Sad
  • Novi Sad
View GitHub Profile
package main
import (
"context"
"fmt"
"log"
"net/http"
"strings"
"github.com/dgrijalva/jwt-go"
)
func middleware(next http.Handler) http.Handler {
@dragonsinth
dragonsinth / errgroup_withcontext.go
Created February 5, 2020 03:53
Using errgroup.WithContext() in Golang server handlers
package main
import (
"context"
"encoding/json"
"fmt"
"io"
"log"
"sync/atomic"
"time"
@sthewissen
sthewissen / VerboseLog.txt
Created January 8, 2020 20:12
Enable verbose logging Firebase Analytics
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
@chiro-hiro
chiro-hiro / golang-uint64-uint32-to-bytes.md
Last active October 1, 2024 09:04
Golang uint64, uint32 to bytes array

Wrote for a joyful journey of Go.

package main

import (
	"fmt"
)

func i64tob(val uint64) []byte {
@f2face
f2face / my_list_layout.xml
Created December 4, 2019 05:36
Disable multi-touch in RecyclerView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
...>
<androidx.recyclerview.widget.RecyclerView
...
android:splitMotionEvents="false" />
</LinearLayout>
@miguelmota
miguelmota / go_decode.go
Created January 7, 2019 05:14
Golang gob encoding and decoding example
package main
import (
"bytes"
"encoding/gob"
"fmt"
"log"
)
func main() {
@miguelmota
miguelmota / snappy.go
Last active November 3, 2020 10:05
Golang snappy encode and decode example
package main
import (
"fmt"
"log"
"github.com/golang/snappy"
)
func main() {
@pcgeek86
pcgeek86 / install_go_pi.sh
Last active May 31, 2024 16:42 — forked from random-robbie/install_go_pi.sh
Install Go Lang on Raspberry Pi
cd $HOME
FileName='go1.13.4.linux-armv6l.tar.gz'
wget https://dl.google.com/go/$FileName
sudo tar -C /usr/local -xvf $FileName
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
@tembleking
tembleking / main.go
Created October 4, 2018 21:06
Prometheus Golang Example
package main
import (
"fmt"
"log"
"math/rand"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
package main
import (
"strings"
"path/filepath"
)
func fileNameWithoutExtension(fileName string) string {
return strings.TrimSuffix(fileName, filepath.Ext(fileName))
}