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
#!/bin/bash | |
################################################################################ | |
### OpenCV2 Installation Script ### | |
################################################################################ | |
# Source code at https://github.com/arthurbeggs/scripts # | |
################################################################################ | |
# # | |
# Feel free to copy and modify this file. Giving me credit for it is your # | |
# choice, but please keep references to other people's work, which I don't # |
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
func retry(attempts int, sleep time.Duration, fn func() error) error { | |
if err := fn(); err != nil { | |
if s, ok := err.(stop); ok { | |
// Return the original error for later checking | |
return s.error | |
} | |
if attempts--; attempts > 0 { | |
time.Sleep(sleep) | |
return retry(attempts, 2*sleep, fn) |
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
package main | |
import ( | |
"encoding/gob" | |
"bytes" | |
) | |
func GetBytes(key interface{}) ([]byte, error) { | |
var buf bytes.Buffer | |
enc := gob.NewEncoder(&buf) |