Skip to content

Instantly share code, notes, and snippets.

@scottcagno
scottcagno / hashmap.go
Created May 2, 2017 23:46
golang hashmap implementation
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package runtime
// This file contains the implementation of Go's map type.
//
// A map is just a hash table. The data is arranged
// into an array of buckets. Each bucket contains up to
@scottcagno
scottcagno / RESTful.md
Created October 2, 2022 21:50
RESTful API Guidelines

RESTful APIs

The term REST was suggested by Roy Fielding in his Ph.D. dissertation in the year 2000.
It stands for Representational State Transfer and is described as:

"REST emphasizes scalability of component interactions, generality of interfaces,
independent deployment of components, and intermediary components to reduce interaction
latency, enforce security and encapsulate legacy systems."

@scottcagno
scottcagno / tracer.go
Created September 26, 2022 19:30
Stack tracer
package tracer
import (
"fmt"
"log"
"runtime"
"strings"
)
// DefaultTracer is the default tracer and has a call
@scottcagno
scottcagno / refactored_page.go
Last active September 8, 2022 23:37
Refactoring page scratch. Works really well so far.
package engine
import (
"bytes"
"encoding/binary"
"encoding/json"
"errors"
"fmt"
"reflect"
"sort"
@scottcagno
scottcagno / EXAMPLE.md
Created August 19, 2022 21:30
Sample markdown File
@scottcagno
scottcagno / bitstuff.go
Created August 18, 2022 20:28
bitwise operations
package main
import (
"fmt"
"strconv"
)
func main() {
fmt.Println()
@scottcagno
scottcagno / logger.go
Last active August 9, 2022 18:53
Basic Leveled Logger
package logging
import (
"fmt"
"io"
"log"
"os"
"path/filepath"
"runtime"
)
@scottcagno
scottcagno / simple_sample_multiplexer.go
Created August 8, 2022 19:17
This is just a simple sample scratch multiplexer. It's fully working but has NO bells or anything.
package main
import (
"fmt"
"net/http"
)
func homeHandler() http.Handler {
fn := func(w http.ResponseWriter, r *http.Request) {
// implement handler logic here...
// You can edit this code!
// Click here and start typing.
package main
import (
"errors"
"fmt"
"log"
"os"
"strings"
@scottcagno
scottcagno / picam-capture.sh
Created August 1, 2022 20:40
streaming the raspberry pi cam using netcat
#!/usr/bin/env bash
#
# picam-capture.sh
# to enable this at startup, add the line below to your rc.local file:
# sudo vim /etc/rc.local
# bash /full/path/to/this/file.sh # add this line
# configurable options
timestamp = "-a 12" # overlay a 12hr date/timestamp