Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleNOIA(kaizenConfig) {
try {
var checkResult = packageChecker(kaizenConfig);
if (checkResult.isValid === false) {
console.error('[ERROR]: please use kaizen new to create new project first');
return;
}
console.log('kaizen: installing noia sdk...'); // clone noia sdk repo and copy out packages
cmd.get('git clone https://github.com/noia-network/sdk.git temp-noia-sdk', function (error) {
if (error) {
handleError(error);
return;
}
ncp('./temp-noia-sdk/packages', './', function (error) {
if (error) {
handleError(error);
return;
}
cmd.run('rm -rf ./temp-noia-sdk');
updateConfig(kaizenConfig, 'NOIA');
});
});
} catch (error) {
function doPushOperation()
{
if (commitMessage === '')
commitMessage = 'Commit via crypt-git';
var msg = 'git add -A && git commit -m "'+commitMessage+'" && git push -u origin master';
//var msg = 'git add -A && git commit -m \''+commitMessage+'\' && git push -u origin master';
if (theReqCmd !== '')// just a normal check if user wants to push or not
{
// an async operation because it is required.
cmd.get(
msg,
function(err, data, stderr) {
if (err)
{
// if the push fails then I need to restore the previous iv otherwise it will give error in decrypting and decompressing
console.log(err);
}
else
console.log(data);
}
);
}
}
console.log(faces, _faces, tryOver)
}
if (faces !== _faces) {
// something new happened
if (tryOver.length === faces) {
// this is not first time
tryOver.times++
if (tryOver.times > 2) {
// set trusted total faces
_faces = faces
console.log(Date(), `${faces} Face(s) Detected!`)
if (outputdir.trim() !== 'null') {
im.save(path.join(absoluteOutputDir, `${Date.now()}-${faces}.jpg`))
}
if (faces > availablePersons) {
runningCmd = cmd.get(command)
} else if (runningCmd) {
cmd.get(`kill ${runningCmd.pid + 1}`)
}
}
} else {
// reset try times
tryOver.length = faces
tryOver.times = 0
}
}
})
}
startGeth: function(chain, purpose) {
const oThis = this
;
// start geth
logger.info("* Starting " + chain + " chain");
const cmd = oThis._startGethCommand(chain, purpose);
logger.info(cmd);
shellAsyncCmd.run(cmd);
},
return new Promise((resolve, reject) => {
cmd.get(
cmd_string,
(data, err, stderr) => {
if ( err ) {
console.log(err)
}
if ( stderr ) {
console.log(stderr)
}
resolve(data)
}
)
})
}
setTimeout(function () {
CMD.get(
'sudo spoof randomize ' + DRIVER_INTERFACE,
function (data) {
macaddress.one(DRIVER_INTERFACE, function (err, mac) {
console.log("Generated temporary Mac address for " + DRIVER_INTERFACE + ": %s", mac);
var macAdr = mac;
callback(null, macAdr);
});
}
);
}, 15000);
}
setSpeed: function(value) {
console.log("Setting fan rSpeed to %s", value);
CEILING_FAN.rSpeed = value;
if (value > 0 && value < 33) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan1.py');
} else if (value == 0) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan0.py');
} else if (value > 34 && value < 66) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan2.py');
} else if (value > 67 && value < 101) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan3.py');
}
},
identify: function() {
setSpeed: function(value) {
console.log("Setting fan rSpeed to %s", value);
CEILING_FAN.rSpeed = value;
if (value > 0 && value < 33) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan1.py');
} else if (value == 0) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan0.py');
} else if (value > 34 && value < 66) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan2.py');
} else if (value > 67 && value < 101) {
cmd.run('sudo python /home/pi/HAP-NodeJS/python/fan3.py');
}
},
identify: function() {
open: function() {
console.log("Opening the Garage!");
cmd.run('sudo python /home/pi/HAP-NodeJS/python/garage2.py');
},
close: function() {