Skip to content

Instantly share code, notes, and snippets.

View jasdel's full-sized avatar

Jason Del Ponte jasdel

  • Seattle, WA
View GitHub Profile
@jasdel
jasdel / eventstream.go2
Created June 22, 2020 15:50
AWS SDK Event stream using Go 2 generics.
package main
import (
"context"
"io"
"sync"
)
func main() {
b := NewBidirectionalStream(
func TestClient_EmptyInputAndEmptyOutput_awsRestjson1Deserialize(t *testing.T) {
cases := map[string]struct {
StatusCode int
Header http.Header
BodyMediaType string
Body []byte
ExpectResult *EmptyInputAndEmptyOutputOutput
}{
// Empty output serializes no payload
"RestJsonEmptyInputAndEmptyOutput": {
@jasdel
jasdel / subdivide.go
Last active May 30, 2018 16:24
subdivide range into parts returning a list of start/stop sublist index markers.
package main
import (
"fmt"
"math"
)
func main() {
ExampleSubDivide()
}
@jasdel
jasdel / pollyexp.go
Created October 2, 2017 15:34
AWS Polly Experiment
package main
import (
"bufio"
"context"
"flag"
"fmt"
"io"
"os"
"path/filepath"
@jasdel
jasdel / cloudwatchRequest.go
Last active October 17, 2017 16:43
Makes a series of cloudwatch requests while connection status logging.
package main
import (
"context"
"fmt"
"net"
"net/http"
"net/http/httptrace"
"time"
@jasdel
jasdel / mdrender.go
Created September 14, 2017 17:01
Markdown render to HTML
package main
import (
"io/ioutil"
"os"
"github.com/russross/blackfriday"
)
func main() {
@jasdel
jasdel / pendingQueue.go
Created November 16, 2016 18:30
Defines a pending queue of links with sync.Cond notification for available items.
package checklinks
import "sync"
type LinkType int
const (
LinkAnchor LinkType = iota
LinkFrame
LinkExtRes
@jasdel
jasdel / examples.go
Last active October 28, 2016 23:13
Example of AWS SDK for Go with setters for API calls
func Examples() {
// Simple list S3 buckets call
resp, err := svc.ListBuckets((&s3.ListBucketsInput{}).
SetPrefix("abc"),
)
// Same as above but with `new` instead of struct initialization
resp, err := svc.ListBuckets(new(s3.ListBucketsInput).
SetPrefix("abc"),
)
@jasdel
jasdel / durSort.go
Created July 8, 2016 23:17
Sorts time.Duration from stdin.
package main
import (
"bufio"
"fmt"
"os"
"sort"
"time"
)
package main
import (
"bufio"
"fmt"
"os"
"sort"
"time"
)