This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kivy | |
from kivy.app import App | |
from kivy.clock import Clock | |
from kivy.uix.button import Button | |
from kivy.uix.popup import Popup | |
from kivy.uix.progressbar import ProgressBar | |
from kivy.uix.widget import Widget | |
from kivy.properties import ObjectProperty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a code snippet related to Jacopo Salvestrini's medium.com article | |
// https://medium.com/@jacoposalvestrini/fluent-middleware-in-golang-7ee7f20427fd | |
// * * * | |
// A Fluent evolution (check-out the diffs between commits) | |
// of the adapter pattern from Mat Ryer's article | |
// https://medium.com/@matryer/writing-middleware-in-golang-and-how-go-makes-it-so-much-fun-4375c1246e81 | |
package main | |
import "net/http" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from (2020-01-14) https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader.DownloadWithIterator | |
svc := s3manager.NewDownloader(session) | |
fooFile, err := os.Open("/tmp/foo.file") | |
if err != nil { | |
return err | |
} | |
barFile, err := os.Open("/tmp/bar.file") | |
if err != nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type buffer struct { | |
Path string | |
buf *aws.WriteAtBuffer | |
} | |
func (b *buffer) WriteAt(p []byte, off int64) (n int, err error) { | |
if b.buf == nil { | |
b.buf = &aws.WriteAtBuffer{} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const localBase = "/tmp/" | |
func download(ctx context.Context, client *s3.S3, bucket string, paths []string) ([]string, error) { | |
downloadedFiles := []string{} | |
length := len(paths) | |
if length < 1 { | |
return downloadedFiles, fmt.Errorf("no files to download") | |
} |