Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Basic primitives for merging and combining multiphase solid objects. This is part of the rle narrowband level set library.
You can install it via rle-funcs:
npm install rle-funcs
Here is an example showing how to implement the update rule for a 3D version of the Game of Life using narrowband level sets:
//Bounds for birth
var SURVIVE_LO = 4;
var SURVIVE_HI = 5;
var BIRTH_LO = 5;
var BIRTH_HI = 5;
//Set up neighborhood stencil
var MOORE_1 = require("rle-stencil").moore(1);
var CENTER_INDEX = 13;
//Compute the next state of the cellular automaton
function nextState(state) {
return require("rle-funcs").apply(state, MOORE_1, function(phases, distances, retval) {
//Count neighbors
var neighbors = 0;
for(var i=0; i<27; ++i) {
if(i !== CENTER_INDEX && phases[i]) {
++neighbors;
}
}
//Compute next state
if(phases[CENTER_INDEX]) {
if(SURVIVE_LO <= neighbors && neighbors <= SURVIVE_HI) {
retval[0] = 1;
return;
}
} else if(BIRTH_LO <= neighbors && neighbors <= BIRTH_HI) {
retval[0] = 1;
return;
}
retval[0] = 0;
return;
});
}
//Initialize state and tick in your main loop
If you want to see it in action, here is a demo. Other examples of using rle-funcs can be found in rle-csg and rle-morphology which are built on top of this library:
merge(volumes, stencil, merge_func)
This merges a collection of volumes together. This acts like a generalized boolean operation amongst the volumes. It is a very flexible, and very general function
volumes
: An array of volumesstencil
: A stencilmerge_func(phases, distances, retval)
: A function that takes 3 arguments:
phases
: An array of length volumes.length * stencil.length
of material phases.distances
: An array of length volumes.length * stencil.length
of distances to the material boundaryretval
: A length two array for the return value of the function. The first item is the new phase and the second item is the distance to the phase boundary.Returns: A new volume which is the result of calling merge_func at every point in the volumes.
mergePoint(volumes, merge_func)
This is an optimized version of merge where the stencil is a single point.
apply(volume, stencil, merge_func)
This is an optimized version of merge
that takes only a single volume as input, instead of an array. Useful for implementing cellular automata and other local differential equations.
applyPoint(volume, merge_func)
Optimized version apply
that assumes stencil
is a single point.
(c) 2013 Mikola Lysenko
FAQs
Functional programming primitives for narrowband levelsets
The npm package rle-funcs receives a total of 1 weekly downloads. As such, rle-funcs popularity was classified as not popular.
We found that rle-funcs 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.