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 positions = { | |
Aman: { | |
latitude: 0, | |
longitude: 0, | |
}, | |
R1: { | |
latitude: 0, | |
longitude: 0, | |
}, | |
R2: { |
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
function idBestUsers(...months) { | |
// Get user Ids present in all months | |
const firstMonth = months[0]; | |
const filteredUsers = firstMonth.filter(userId => { | |
return months.every(month => month.includes(userId)); | |
}); | |
const userCount = {}; // Stores userId instance counts as key value pair | |
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
// A library | |
const getImage = (url, callback) => {}; | |
const imageUrls = []; | |
// Callback | |
/** | |
* This callback style code is least readable. | |
* It has trust issue as we depend upon getImage library to execute our callback. | |
* There may be a bug in the library and it may never run the callback |
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 usb = require('usb'); | |
const device = usb.findByIds(0x1d6b, 0x0104); | |
device.open(); | |
for (let i = 0; i < 7; i++) { | |
let devInt = device.interface(i); | |
if (devInt.isKernelDriverActive()) devInt.detachKernelDriver(); | |
devInt.claim(); | |
} | |
device.interfaces.forEach((interfac) => { | |
console.log(interfac); |
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
'use strict' | |
const EventEmitter = require('events') | |
const BeagleBoot = require('beagle-boot') | |
class BeagleBootAdapter extends EventEmitter { | |
/** | |
* @summary USBBootAdapter constructor | |
* @class | |
* @example |
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
var fs = require('fs') | |
var http = require('http') | |
var file = fs.createWriteStream("file.html"); | |
var request = http.get("http://beagleboard.org/latest-images", function(response) { | |
response.pipe(file); | |
}); |
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
ravi@ravi-Lenovo-G50-45:~/beagle-js$ node serializer-test.js | |
undefined:3 | |
var ref1=json;var ref2=ref1['a'];var ref3=ref2[0];var ref4=ref2[1];var ref5=ref2[10];var ref6=ref2[2];var ref7=ref2[3];var ref8=re | |
f2[4];var ref9=ref2[5];var ref10=ref2[6];var ref11=ref2[7];var ref12=ref2[8];var byteC=0;byteC+=1;byteC+=1;byteC+=bag.dynamicByteC | |
ounts['string'](ref5['pad']);byteC+=1;byteC+=1;byteC+=1;byteC+=1;byteC+=1;byteC+=1;byteC+=1;byteC+=bag.getVarUIntByteLength(ref2.l | |
ength);for (var j2=10;j2<ref2.length;j2++) { var ref13xn=ref2[j2];byteC+=1;}var wBuffer=bag.allocUnsafe(byteC);bag.byteOffset=0;if | |
(typeof(ref3['a']) !== 'number'||ref3['a']<0||ref3['a']>255){bag.throwTypeError(ref3['a'],'number',0,255,'uint8');}bag.byteOffset | |
= wBuffer.writeUInt8(ref3['a'], bag.byteOffset, true);if (typeof(ref4['b']) !== 'number'||ref4['b']<0||ref4['b']>255){bag.throwTy | |
peError(ref4['b'],'number',0,255,'uint8');}bag.byteOffset = wBuffer.writeUInt8(ref4['b'], bag.byteOffset, true);if (typeof(ref5['p | |
ad']) !== 'string'){bag.throwTypeE |
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
ravi@ravi-Lenovo-G50-45:~/beagle-js$ node serializer | |
<Buffer 06 ff ff ff ff ff ff 08 00 06 a0 f6 fd 8a e9 1a> | |
{ h_dest: [ 6, 255, 255, 255, 255, 255 ], | |
h_source: [ 255, 8, 0, 6, 160, 246 ], | |
h_proto: -630 } |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <libusb.h> | |
#include <linux/ip.h> | |
#include <unistd.h> | |
#include <sys/stat.h> | |
#include "rndis.h" | |
#include "ether2.h" |
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
var usb = require('usb'); | |
var Parser = require('binary-parser').Parser; | |
// Connect to BeagleBone | |
var device = usb.findByIds(0x0451, 0x6141); | |
//console.log(device); | |
device.open(); | |
var interface = device.interface(1); |
NewerOlder