Is there a better Windows Console Window? [closed]

Sorry for the self-promotion, I’m the author of another Console Emulator, not mentioned here. ConEmu is opensource console emulator with tabs, which represents multiple consoles and simple GUI applications as one customizable GUI window. Initially, the program was designed to work with Far Manager (my favorite shell replacement – file and archive management, command history … Read more

Remove first N lines of a file in place in unix command line

There’s no simple way to do inplace editing using UNIX utilities, but here’s one inplace file modification solution that you might be able to modify to work for you (courtesy of Robert Bonomi at https://groups.google.com/forum/#!topic/comp.unix.shell/5PRRZIP0v64): bytes=$(head -37 “$file” |wc -c) dd if=”$file” bs=”$bytes” skip=1 conv=notrunc of=”$file” The final file should be $bytes bytes smaller than … Read more

Execute and get the output of a shell command in node.js

This is the method I’m using in a project I am currently working on. var exec = require(‘child_process’).exec; function execute(command, callback){ exec(command, function(error, stdout, stderr){ callback(stdout); }); }; Example of retrieving a git user: module.exports.getGitUser = function(callback){ execute(“git config –global user.name”, function(name){ execute(“git config –global user.email”, function(email){ callback({ name: name.replace(“\n”, “”), email: email.replace(“\n”, “”) }); … Read more

What is the canonical way to determine commandline vs. http execution of a PHP script?

Use the php_sapi_name() function. if (php_sapi_name() == “cli”) { // In cli-mode } else { // Not in cli-mode } Here are some relevant notes from the docs: php_sapi_name — Returns the type of interface between web server and PHP Although not exhaustive, the possible return values include aolserver, apache, apache2filter, apache2handler, caudium, cgi (until … Read more