Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
root@c1.vultr.zuberglobal.com:26257/zuber> show create table marketplaces;
+--------------+--------------------------------------------------------------------------+
| Table | CreateTable |
+--------------+--------------------------------------------------------------------------+
| marketplaces | CREATE TABLE marketplaces ( |
| | |
| | id INTEGER NOT NULL, |
| | |
| | marketplace STRING NOT NULL, |
| | |
CREATE TABLE a (
id UUID NOT NULL DEFAULT gen_random_uuid(),
PRIMARY KEY (id)
);
CREATE TABLE aa (
a UUID NOT NULL,
at TIMESTAMPTZ NOT NULL DEFAULT statement_timestamp(),
PRIMARY KEY (a, at),
CONSTRAINT fk_a FOREIGN KEY (a) REFERENCES a (id)
@erichocean
erichocean / C# test via PInvoke
Created June 2, 2016 07:11 — forked from buybackoff/C# test via PInvoke
LE query micro benchmark
[Test]
public void CursorShouldGetLessOrEqual() {
_db = _txn.OpenDatabase(flags: DbFlags.None);
var db2 = _txn.OpenDatabase("test_le",
DbFlags.Create | DbFlags.IntegerKey);
using (var cur = _txn.CreateCursor(db2)) {
int[] keys = new int[10000000];
<html>
<head>
<title></title>
<style>
p {
font-family: "Verdana", Serif;
}
</style>
</head>
<body>
http.createServer(function (req, res) {
req.setEncoding('binary'); // THE FIX IS TO COMMENT OUT THIS LINE. Then you'll get buffers.
req.content = Buffer.concat([]);
console.log(req); // I verified Content-Type is "application/octet-stream", see below for full console output.
req.addListener("data", function(chunk) {
console.log(typeof chunk); // Get "string", want "object".
console.log(chunk); // Want <Buffer: 0x...>, get a string instead.
console.log(req.content); // Prints <Buffer > as expected.
req.content = Buffer.concat([req.content, chunk]); // Fails in buffer.js:499 -- buf.copy(buffer, pos);
@erichocean
erichocean / example.js
Last active December 20, 2015 19:28
How to connect with a Racer client running on Node to a Racer server also running on Node. You also need to comment out everything in node_modules/racer/lib/Model/connection.server.js.
var racer = require('racer');
var BCSocket = require('browserchannel').BCSocket;
racer.Model.prototype._createSocket = function(bundle) {
var options = bundle.racerBrowserChannel;
var base = options.base || '/channel';
if (bundle.mount) base = bundle.mount + base;
base = 'http://localhost:3000' + base; /////////<====== Change this to the address and
///////// port of your Racer server.
return new BCSocket(base, options);
@erichocean
erichocean / gist:6182747
Last active December 20, 2015 19:19
JSON for require('racer').init() call
{
"queries": [],
"contexts": {
"root": {
"fetchedDocs": {},
"subscribedDocs": {},
"fetchedQueries": {},
"subscribedQueries": {}
}
},
@erichocean
erichocean / gist:6172471
Created August 7, 2013 09:09
If I call server.listen() with 'localhost' as the address, things work fine. If instead I call server.listen() with '192.168.0.100' (my IP address), I get the crash below. In both cases, server.listen() is being called in a worker. Any ideas?
net.js:1072
if (port && handle.getsockname && port != handle.getsockname().port) {
^
TypeError: Cannot read property 'getsockname' of undefined
at net.js:1072:23
at Object.1:1 (cluster.js:587:5)
at handleResponse (cluster.js:171:41)
at respond (cluster.js:192:5)
at handleMessage (cluster.js:202:5)
at process.EventEmitter.emit (events.js:117:20)
Here's the error I was getting:
mila:node-sqlite3 onitunes$ ./configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.9.1
gyp info using node@0.8.17 | darwin | x64
gyp ERR! configure error
gyp ERR! stack Error: Command failed: execvp(): No such file or directory
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:540:15)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title></title>
<script>
Object.defineProperty(Float32Array.prototype, 'width', {
get: function() {
return this[0];
},
set: function(val) {