Skip to content

Instantly share code, notes, and snippets.

View brydavis's full-sized avatar

Bryan Davis brydavis

View GitHub Profile
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
http.HandleFunc("/radio", func(w http.ResponseWriter, r *http.Request) {
<audio id="player" src=""></audio>
<button id="play">play</button>
<button id="reset">reset</button>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://www.example.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
package main
import (
"bytes"
"encoding/binary"
"fmt"
"net/http"
"os"
"os/signal"
@brydavis
brydavis / ongoing_loop_over_slice.go
Created May 6, 2019 21:14
Looping over a slice of strings continuously
package main
import (
"fmt"
"time"
)
func main() {
list := []string{"abc", "def", "ghi", "jkl", "mno", "p"}
i := 0
@brydavis
brydavis / fib_nonrecursive.go
Last active April 17, 2019 18:59
Fibonacci Examples
package main
import (
"fmt"
)
func main() {
fmt.Println(fib(9))
}
@brydavis
brydavis / public_bucket_policy.json
Created April 13, 2019 07:52
AWS Public Bucket Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
@brydavis
brydavis / search_keywords.js
Created April 12, 2019 19:00
Simple keyword search
var keywords = [
'music',
// 'news',
// 'weather',
// 'cooking',
// 'pasta',
'tech',
]
var source = [
--***********************************************************************************
-- Title: SuperMarket_Sales
-- Author: Lee McCraw-Leavitt + Bryan Davis
-- Description: create database and tables for sales support
-- Date created: July 3, 2017
-- Date modified: April 8, 2019
-- Change Log: Added more data and other analysis
--***********************************************************************************
CREATE DATABASE SuperMarket_Sales;