The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.
Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.
| var net = require('net'); | |
| var serverConnections = 0; | |
| var clientConnections = 0; | |
| // Server: accept connections and set keep-alive | |
| net.createServer(function(socket) { | |
| socket.setKeepAlive(true, 0); // <----- | |
| serverConnections++; | |
| console.log(serverConnections); |
| #appengine python | |
| values = [1,2,3,4] | |
| values = array('f',values) | |
| response.out.write(values.tostring()) | |
| //JS loading | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', '/path/to/file', true); | |
| xhr.responseType = 'arraybuffer'; |
| -- | |
| -- PostgreSQL database dump | |
| -- | |
| SET statement_timeout = 0; | |
| SET client_encoding = 'UTF8'; | |
| SET standard_conforming_strings = on; | |
| SET check_function_bodies = false; | |
| SET client_min_messages = warning; |
The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.
Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| Here's some more perf analysis: what was the limiter for node.js in the original fs.readFile benchmark, | |
| causing large performance difference? | |
| Examining thread microstates using prstat (SmartOS): | |
| # prstat -mLcp 92432 1 | |
| Please wait... | |
| [...] | |
| PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID | |
| 92432 root 90 10 0.0 0.0 0.0 0.0 0.0 0.0 7 9 42K 0 node/1 |
| // Execute method for js:split process expects polygon and line geometries as input | |
| run: function(inputs) { | |
| var merger = new LineMerger(); | |
| merger.add(inputs.poly._geometry); | |
| merger.add(inputs.line._geometry); | |
| var collection = merger.getMergedLineStrings(); | |
| var union = new UnaryUnionOp(collection).union(); | |
| var polygonizer = new Polygonizer(); | |
| polygonizer.add(union); |
| var cluster = require('cluster') | |
| if (cluster.isMaster) { | |
| // spawn worker bees | |
| cluster.fork() | |
| cluster.fork() | |
| cluster.fork() | |
| cluster.fork() | |
| } else { | |
| // worker bees only need root to listen, and then downgrade |
| import numpy as np | |
| from scipy.spatial import KDTree | |
| from fiona import collection | |
| def nearest_features(datasource, x, y, n=1): | |
| """ | |
| datasource: The ogr datasource path | |
| x, y: coordinates to query for nearest | |
| n: number of features (default = 1 or the single nearest feature) |
| "use strict"; | |
| var fs = require("fs"), | |
| https = require("https"), | |
| url = require("url"), | |
| zlib = require("zlib"); | |
| /** | |
| * Process HTTP responses. Handle compressed streams and convert to objects as | |
| * appropriate. |