Passing and receiving array object between Node.js and C++ binding
$ g++ -dynamiclib -o mylib.dylib main.cpp
$ node index.js
[matrix size: 100x100; n_nonzero: 4; density: 0.04%]
(1, 1) 2.0000
| Serve robots.txt inline in Nginx | |
| 06/18/2015 nginx 3 Comments | |
| To quickly serve a robots.txt from Nginx without actually having access to the physical file you can define the content of the robots.txt file in the Nginx .conf file. | |
| Allow access to all User-agents: | |
| location /robots.txt {return 200 "User-agent: *\nDisallow:\n";} | |
| Disallow access to every User-agent: |
| # By path | |
| if [ -w "/path/to/dir" ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi | |
| # Current dir | |
| if [ -w `pwd` ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi |
| /*! gulpfile.js */ | |
| const gulp = require("gulp"); | |
| const gutil = require("gulp-util"); | |
| const browserify = require("browserify"); | |
| const buffer = require("vinyl-buffer"); | |
| const uglify = require("gulp-uglify"); | |
| const sourcemaps = require("gulp-sourcemaps"); | |
| const source = require("vinyl-source-stream"); | |
| const concat = require("gulp-concat") |
| <?php | |
| // Simply place the following two functions in _support/Helper/Acceptance.php | |
| // Then you can call $I->verifyRedirect(...) inside your tests | |
| namespace Helper; | |
| class Acceptance extends \Codeception\Module | |
| { | |
| /** | |
| * Ensure that a particular URL does NOT contain a 301/302 |
| # EditorConfig helps developers define and maintain consistent | |
| # coding styles between different editors and IDEs | |
| # editorconfig.org | |
| root = true | |
| [*] | |
| end_of_line = lf | |
| charset = utf-8 |
| /** | |
| * OpenCV video streaming over TCP/IP | |
| * Client: Receives video from server and display it | |
| * by Steve Tuenkam | |
| */ | |
| #include "opencv2/opencv.hpp" | |
| #include <sys/socket.h> | |
| #include <arpa/inet.h> | |
| #include <unistd.h> |
| var ref = require('ref'); | |
| module.exports = BufferType; | |
| /** | |
| * Fixed length "Buffer" type, for use in Struct type definitions. | |
| * | |
| * Optionally setting the `encoding` param will force to call | |
| * `toString(encoding)` on the buffer returning a String instead. | |
| */ |
| # Block Skype ads | |
| 127.0.0.1 *.msads.net | |
| 127.0.0.1 *.msecn.net | |
| 127.0.0.1 *.rad.msn.com | |
| 127.0.0.1 a.ads2.msads.net | |
| 127.0.0.1 ac3.msn.com | |
| 127.0.0.1 ad.doubleclick.net | |
| 127.0.0.1 adnexus.net | |
| 127.0.0.1 adnxs.com | |
| 127.0.0.1 ads1.msn.com |
When npm installs native node modules it uses node-gyp to compile code. This is the seam node uses for targeting different operating systems, e.g. OS X, linux, Windows etc.
By default node-gyp compiles using one core and if you have more than one you probably want to utilize that power to speed up compile time. The way node-gyp handles this is by using the JOBS environment variable, which sets the jobs variable here. This piece of code then checks the value of jobs to determine how many cores to use.
Note that if the value of JOBS is max then all cores will be used. So lets try this on leveldown. First lets check that JOBS isn't set yet:
lms@ux301|01:34|~/src/leveldb-repos/leveldown (master) $ echo $JOBS