Skip to content

Instantly share code, notes, and snippets.

View montanaflynn's full-sized avatar

Montana Flynn montanaflynn

View GitHub Profile
@montanaflynn
montanaflynn / ml.go
Created January 16, 2019 09:33
Simple neural net with one hidden layer consisting of one neuron
// Found at https://play.golang.org/p/sR0vNRAQD1
// Inspired by https://medium.com/technology-invention-and-more/how-to-build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1
package main
import (
"fmt"
"math/rand"
"math"
)
@montanaflynn
montanaflynn / GOMOD.md
Created December 11, 2018 06:11
JUST TELL ME HOW TO USE GO MODULES
go mod init <modulename>

go get -u ./...

go mod vendor

go get -u <repo url>

go mod vendor
@montanaflynn
montanaflynn / clean.go
Created September 17, 2018 15:13
ZB exchange pair cleaner
package main
import (
"bufio"
"encoding/json"
"fmt"
"log"
"os"
"strings"
)
@montanaflynn
montanaflynn / wildcat.go
Created August 12, 2018 07:26
Simple wildcard concatenation program
package main
import (
"bytes"
"io/ioutil"
"log"
"os"
"path/filepath"
)
include .env
PROJECTNAME=$(shell basename "$(PWD)")
# Go related variables.
GOBASE=$(shell pwd)
GOPATH=$(GOBASE)/vendor:$(GOBASE):/home/azer/code/golang # You can remove or change the path after last colon.
GOBIN=$(GOBASE)/bin
GOFILES=$(wildcard *.go)
@montanaflynn
montanaflynn / terminal.go
Last active March 19, 2019 16:26
Watch for signals in terminal
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"golang.org/x/crypto/ssh/terminal"
)
@montanaflynn
montanaflynn / context.go
Last active October 15, 2024 11:01
An example of using context to cancel goroutines between server handlers
package main
import (
"context"
"fmt"
"log"
"net/http"
"sync"
"time"
)
@montanaflynn
montanaflynn / SETUP.md
Last active July 30, 2018 07:53
Hackintosh GPU Setup

Hackintosh GPU Setup

Specifications (I am just listing critical components):

  OS: MacOS High Sierra 10.13.6
  Intel i7-8086k (or i7-8700k)
 64GB DDR4 3200 RAM - G.Skill Trident Z 
@montanaflynn
montanaflynn / combinations.go
Last active July 28, 2018 15:09
Maximum Combination Calculator
package main
import (
"fmt"
"math/big"
)
func factorial(n *big.Int) (result *big.Int) {
result = big.NewInt(1)
var one big.Int
@montanaflynn
montanaflynn / tienlen.go
Last active July 28, 2018 06:56
A simple program to deal Tien Len hands
package main
import (
"fmt"
"math/rand"
"sort"
"time"
"github.com/fatih/color"
)