Skip to content

Instantly share code, notes, and snippets.

View josephspurrier's full-sized avatar

Joseph Spurrier josephspurrier

View GitHub Profile
@josephspurrier
josephspurrier / main.go
Last active March 8, 2023 08:52
OpenAI/ChatGPT Terminal in Go
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
)
@josephspurrier
josephspurrier / main.go
Last active May 29, 2022 14:32
Font Tester
// Package main can be used to see how a font looks in your IDE.
// Preference: https://github.com/gaplo917/Ligatured-Hack
// VSCode Settings: https://gist.github.com/josephspurrier/15a74871d65926c7415b55fe4b8d2946#file-settings-json
package main
import (
"fmt"
"net/http"
)
@josephspurrier
josephspurrier / .air.toml
Created October 20, 2021 21:53
Air for Live Reloading of Go - https://github.com/cosmtrek/air
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format
# Working directory
# . or absolute path, please note that the directories following must be under root.
root = "."
tmp_dir = "tmp"
[build]
# Just plain old shell command. You could use `make` as well.
cmd = "go build -o ./tmp/main main.go"
@josephspurrier
josephspurrier / Dockerfile
Created December 3, 2020 02:14
AWS Lambda Container in Go
FROM public.ecr.aws/lambda/go:1
# Copy function code
COPY hello ${LAMBDA_TASK_ROOT}
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "hello" ]
@josephspurrier
josephspurrier / controls.stories.ts
Last active August 20, 2020 02:52
Using Controls in Storybook with Mithril (TypeScript)
import m from "mithril";
export default {
title: "Example/Controls",
};
interface Args {
list: number[];
toggle: boolean;
numberBox: number;
@josephspurrier
josephspurrier / .env
Last active March 8, 2020 20:32
Sample Makefile and docker-compose file for Go, Docker, and Vue. Source: https://github.com/josephspurrier/govueapp
APP_VERSION=1.0
MYSQL_CONTAINER=mysql:5.6
MYSQL_ROOT_PASSWORD=password
MYSQL_HOST=db
@josephspurrier
josephspurrier / gitlab_private_api.go
Created July 30, 2019 22:36
GitLab Private API for Reading Issue Order in a List
// Package main is an example of how to use the GitLab private API.
// Related: https://gitlab.com/gitlab-org/gitlab-ce/issues/43674
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
@josephspurrier
josephspurrier / main.go
Created May 19, 2019 14:24
Method Overriding in Go
package main
import "fmt"
type foo struct{}
func (f foo) Start() {
fmt.Println("Foo Started")
}
@josephspurrier
josephspurrier / healthcheck.go
Created May 13, 2019 14:57
Go AWS ELB Idle Timeout Test
package main
import (
"fmt"
"net/http"
"time"
)
func main() {
mux := http.NewServeMux()
@josephspurrier
josephspurrier / hotreload.go
Last active October 13, 2023 16:19
Golang HTTP Redirect using JavaScript and Long Polling
package main
import (
"bytes"
"errors"
"fmt"
"io"
"log"
"os"
"os/exec"