Skip to content

Instantly share code, notes, and snippets.

View MilosSimic's full-sized avatar

Milos MilosSimic

View GitHub Profile
package main
import (
"context"
"fmt"
"log"
"net/http"
"strings"
"github.com/dgrijalva/jwt-go"
)
func middleware(next http.Handler) http.Handler {
@shoaibi
shoaibi / DynamoDb.md
Last active February 4, 2026 22:03
DynamoDb Notes

General

  • Data Pressure: Ability to process data within reasonable time and cost
  • Whenever one of the dimensions of Data Pressure is broken, we'd invent new technology.
  • RDBMs optimize for storage which makes sense as storage was expensive in 70s. But this happens at the cost of CPU, where CPU is going insane pulling data from all over the disk and stitch it together. Nowadays storage is cheap and CPU isn't. So why use a system that depends on an expensive resource.
  • RDBMs/SQL gives structure with power to create ad hoc queries while noSQL gives instantiated views for given queries. In this way noSQL forces more product driven development where one has to discover access patterns.
  • noSQL != non-relation. All data in universe is relational.
  • Do not compare RDBMS with noSQL and specially MySQL and DynamoDb.
    • No, Table is not the same, and no Document is not same as records
  • For writes, DynamoDb uses 3 replica and returns when 2 confirm the write
@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 March 17, 2025 21:35 — 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"