How can I beautify JavaScript code using Command Line?

First, pick your favorite Javascript based Pretty Print/Beautifier. I prefer the one at http://jsbeautifier.org/, because it’s what I found first. Downloads its file https://github.com/beautify-web/js-beautify/blob/master/js/lib/beautify.js Second, download and install The Mozilla group’s Java based Javascript engine, Rhino. “Install” is a little bit misleading; Download the zip file, extract everything, place js.jar in your Java classpath (or … Read more

Programmatically find the number of cores on a machine

C++11 #include <thread> //may return 0 when not able to detect const auto processor_count = std::thread::hardware_concurrency(); Reference: std::thread::hardware_concurrency In C++ prior to C++11, there’s no portable way. Instead, you’ll need to use one or more of the following methods (guarded by appropriate #ifdef lines): Win32 SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); int numCPU = sysinfo.dwNumberOfProcessors; Linux, Solaris, AIX … Read more