Skip to content

Instantly share code, notes, and snippets.

@sathiyaseelan
sathiyaseelan / golang_setup.md
Last active April 1, 2024 18:51
Basics to setup a golang project repo in your local

Simple Guide to setup Golang in your Mac and clone a repo.

Setup Go and workspace

Type go in terminal, to verify the installation.

  • Create a Go workspace and set GO PATH

This gist contains a test program and sample output that shows a case where a Node Socket can emit an "end" event after an "error" event.

Expected behavior: socket does not emit 'end' event after 'error' event.

Unexpected behavior: socket emits 'end' event after 'error' event.

Works as expected (v0.10):

  • illumos: v0.10.43 (both 32-bit and 64-bit): expected behavior
@davepacheco
davepacheco / 0-test-stream.js
Last active February 20, 2018 23:54
This gist contains a test program and sample output that shows a case where a Node stream can see an "error" event after an "end" event. The results are the same across both illumos and Mac OS X, and for Node versions v0.10, v0.12, v4.4, and v5.9.
/*
* test-stream.js: demonstrates a case where a Node stream can see an 'error'
* event after an 'end' event. This example creates a server socket and then
* establishes a connection to it. If the client destroys the socket and the
* server keeps writing to it, it's possible for the server to see both an 'end'
* event and an 'error' event.
*/
var mod_net = require('net');
var mod_os = require('os');
@davepacheco
davepacheco / demo.js
Last active February 19, 2016 17:56
JavaScript constructors (even when invoked with "new") can return values of unrelated classes.
/*
* Demo: a JavaScript constructor function, even when invoked with "new", can
* return a completely different object, even one from a completely different
* class.
*/
var counter = 0;
var lastMyClass;
function MyClass()

Manatee Brain Transplant

The goal of this process is to upgrade a manatee of any vintage to Manatee v2. It relies on ZFS send/recv to replicate the data, but is limited to a migration between nodes in ONWM.

step 1. upgrade moray

Upgrading moray to a forward/backward compatible version is a prerequisite of the upgrade. The usual process is to disable one moray node, double-check the stack reconnects correctly, reprovision that node, and then repeat for other moray nodes.

If there is only one moray node deployed, deploying a second using the new image allows you to upgrade the original node as above.

64 bits

Issues

::jsstack -v not able to retrieve source code

Saw a couple of messages of the form could not determine startline/endline below:

> ::jsstack -v 

Tests results

64 bits - master

node-debug-school

Works fine!

test-postmortem-findjsobjects.js
@davepacheco
davepacheco / testspawn.js
Last active December 6, 2019 19:56
Surprising Node.js/bash interaction
/*
* testspawn.js: exercises surprising interaction between Node.js "spawn" and
* bash. To use this:
*
* (1) Create a file in the same directory called "foo.rc", with just one line:
*
* echo "loaded foo.rc"
*
* (2) Run this program as:
*
@TooTallNate
TooTallNate / README.md
Created November 16, 2011 00:57
A C header file to make your node bindings backwards and forwards compatible that use eio_custom()

node_async_shim.h

Use this header file to conditionally invoke eio_custom() or uv_queue_work(), depending on the node version that the module is being compiled for.

See the usage.cc file for a partial example.

Comments, forks, and improvements are welcome!

@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code