This file contains hidden or 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
/** | |
* Creates a new instance of the iot.device class that we can connect to and listen on | |
* @private | |
* @type {*} | |
* @memberof Device | |
*/ | |
private _device: any = iot.device({ | |
keyPath: __dirname + "device.private.key", | |
certPath: __dirname + "device.cert.pem", | |
caPath: __dirname + "root-CA.crt", // https://www.amazontrust.com/repository/AmazonRootCA1.pem |
This file contains hidden or 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 myMeterRead = new MeterRead({ | |
'reportDtTm' : null, | |
'pageCounts' : { | |
'equiv' : { | |
'total' : { | |
'displayName' : 'Total', | |
'value' : 6660 | |
}, | |
'totalBlack' : { | |
'displayName' : 'Total Black', |
This file contains hidden or 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
public async getModuleVersions(modulePrefix: string): Promise<any> { | |
try { | |
let fileExtension: string; | |
let moduleLocation: string; | |
switch (modulePrefix) { | |
case 'module1': | |
fileExtension = 'exe'; | |
moduleLocation = ''; | |
break; |
This file contains hidden or 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 util | |
// Accepts a slice of strings and returns a slice of slices of strings where each child slices's length | |
// is the length of the batchSize | |
func StringBatch(size int, s []string) [][]string { | |
var b [][]string | |
for size < len(s) { | |
s, b = s[size:], append(b, s[0:size:size]) | |
} | |
b = append(b, s) |
This file contains hidden or 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 aggregate | |
import "go.mongodb.org/mongo-driver/bson" | |
type Operation bson.M | |
// The Pipe functions similar to the RxJS pipe function | |
// (https://rxjs-dev.firebaseapp.com/api/index/function/pipe) in that | |
// it accepts a set of functions as parameters. Each function receives | |
// as its input, the output of the previous function. The allows you |
This file contains hidden or 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 startup | |
import ( | |
"fmt" | |
"log" | |
"sync" | |
) | |
const BufferedChan int = 1 | |
const FailedToInstallDependency = "failed to install dependency" |
This file contains hidden or 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 GetArch() (string, *errors.ErrorCode) { | |
cmd := exec.Command( | |
"wmic", | |
"os", | |
"get", | |
"osarchitecture", | |
) | |
output, err := cmd.CombinedOutput() | |
if err != nil { |
This file contains hidden or 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 GetArch() (string, *errors.ErrorCode) { | |
cmd := exec.Command( | |
"getconf", | |
"LONG_BIT", | |
) | |
output, err := cmd.CombinedOutput() | |
if err != nil { | |
log.Printf("error getting arch: %v", err) | |
return "", errors.New(errors.UnsupportedArchitecture) |
This file contains hidden or 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 ThrottleEngine struct { | |
// The key to this map represents a unique user being throttled, such as | |
// an api key, or some user identification obtained from a header | |
MostRecentRequest map[string]time.Time | |
MinInterval time.Duration | |
M *sync.Mutex | |
} | |
type HttpHandlerFunc func(http.ResponseWriter, *http.Request) |
This file contains hidden or 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 counter | |
import ( | |
"cloud.google.com/go/civil" | |
"context" | |
"fmt" | |
"gitlab.com/ptmesh/api/pkg/repositories" | |
"go.mongodb.org/mongo-driver/bson/primitive" | |
"net/http" | |
"sync" |
OlderNewer