Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Barcli is a simple tool for displaying real time bar graphs in the console.
Screenshot of Leap Motion Controller exampleI needed a way to visualize Johnny-Five sensor data quickly and easily. console.log is hard to read, especially if you have more than one datapoint to track.
Multiple instances of barcli can be stacked to show multiple axes, sensors or other data sources in an easy to read horizontal bar graph.
npm install barcli
This example uses all of barcli's default values.
var Barcli = require("barcli");
var graph = new Barcli();
graph.update(0.25); // Sets bar to 25%
graph.update(1.0); // Sets bar to 100%
graph.update("The state of something"); // Replaces bar with the string
Optionally, you can pass configuration parameters in an object.
var Barcli = require("barcli");
var graph = new Barcli({
label: "My Graph",
range: [0, 100],
});
graph.update(25); // Sets bar to 25%
graph.update(100); // Sets bar to 100%
graph.update("The state of something"); // Replaces bar with the string
label (String) - Label for the bar graph. Any length is fine, but make sure it will fit in your terminal window along with the bar graph (Default: "Input n")
range (Array) - The upper and lower limits for input values. This will be mapped to your bar length. One or both values can be set to null and the range will be found automatically (Default: [null, null])
autoRange (Boolean) - Grow the range to include the minimum and maximum values passed in calls to update() (Default: false. If no range is passed or null is passed then this defaults to true)
precision (Integer) - The number of digits after the decimal point to display (Default: 0)
constrain (Boolean) - Constrains displayed input value to given inputRange (Default: false)
percent (Boolean) - Displays the input value as a percentage of the inputRange (Default: false)
width (Integer) - The length of the bar in terminal characters (Default: 80)
color (String) - Colors will be assigned automatically, but you can override with your preference. Valid values are "red", "green", "yellow", "blue", "magenta", "cyan" or "white".
var five = require("johnny-five");
var Barcli = require("barcli");
var board = new five.Board().on("ready", function() {
var sensor = new five.Sensor({
pin: "A0",
freq: 250
});
var graph = new Barcli({
label: "Sensor",
range: [0, 100]
});
sensor.scale([0, 100]);
sensor.on("data", function() {
graph.update(this.value);
});
});
var Leap = require("leapjs");
var Barcli = require("barcli");
var palmX = new Barcli({label: "Palm X", range: [-500, 500]});
var palmY = new Barcli({label: "Palm Y", range: [50, 400]});
var palmZ = new Barcli({label: "Palm Z", range: [-500, 500]});
Leap.loop({enableGestures: true}, function(frame) {
if (frame.hands.length === 1) {
palmX.update(frame.hands[0].palmPosition[0]);
palmY.update(frame.hands[0].palmPosition[1]);
palmZ.update(frame.hands[0].palmPosition[2]);
}
});
var Barcli = require("barcli");
var hours = new Barcli({ label: "Hour", range: [0, 23]});
var minutes = new Barcli({ label: "Minute", range: [0, 59]});
var seconds = new Barcli({ label: "Second", range: [0, 59]});
var milliseconds = new Barcli({ label: "Millisecond", range: [0, 999]});
var state = new Barcli({label: "Clock State", type: "string"});
var intervalID = GLOBAL.setInterval(function() {
var now = new Date();
hours.update(now.getHours());
minutes.update(now.getMinutes());
seconds.update(now.getSeconds());
milliseconds.update(now.getMilliseconds());
state.update(now.getSeconds() % 2 ? "Tick" : "Tock");
}, 12);
FAQs
A simple tool for displaying real time bar graphs in the console
The npm package barcli receives a total of 8 weekly downloads. As such, barcli popularity was classified as not popular.
We found that barcli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.