Skip to content

Instantly share code, notes, and snippets.

View alemures's full-sized avatar

Alejandro Santiago alemures

View GitHub Profile

Publish npm package

  1. Build a tar package with npm pack and ensure the content looks ok.
  2. Run npm link in the package, npm link <package-name> in a different npm package and test the imports.
  3. Run npm version <version> to update the package version and create a git tag.
  4. Run npm publish to publish the package in https://npmjs.com.
@alemures
alemures / wireless-n-2230-debian-setup.md
Last active December 23, 2023 09:47
Intel Wireless-N 2230 debian setup

Check wireless hardware: sudo lspci -kv

For hardware Intel Corporation Centrino Wireless-N 2230, a non-free package is needed so, add to /etc/apt/sources.list deb http://httpredir.debian.org/debian/ stretch main contrib non-free

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install firmware-iwlwifi
@alemures
alemures / communicate-debian-vm.md
Last active January 27, 2020 12:45
Communicate a debian virtual machine with host

Add a host-only network interface to the VM and configure it in "/etc/network/interfaces"

auto enp0s8
iface enp0s8 inet static
address 192.168.56.101
netmask 255.255.255.0
#network 192.168.56.0
#broadcast 192.168.56.255
#gateway 192.168.56.1
@alemures
alemures / debian-setup.md
Last active September 3, 2024 15:30
Debian installation and configuration for development

debian installation and configuration

Guide to install and configure a lightweight debian for development.

Create a bootable USB stick UEFI (from linux)

  • Download the most recent debian netinstall iso from debian.org
  • Identify your USB stick with lsblk, run sudo parted /dev/USB_DEVICE and type the following commands:
    • print free (to make sure it is your USB stick)
  • mktable gpt (recommended for UEFI)
@alemures
alemures / uuid.js
Created March 24, 2017 16:02
Fast UUID v4 Generator in Javascript
/**
* Fast UUID generator, RFC4122 version 4 compliant.
* @author Jeff Ward (jcward.com).
* @license MIT license
* @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
**/
var UUID = (function() {
var self = {};
var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); }
self.generate = function() {
@alemures
alemures / ArrayDeque.js
Last active June 22, 2017 18:37
High performance double-ended queue in Javascript
'use strict';
var INITIAL_CAPACITY = 16;
/**
* @param {Array|Number} arg Content or initial capacity.
*/
function ArrayDeque(arg) {
this._elements = new Array(typeof arg === 'number' ?
this._nextHighestPowerOfTwo(arg) : Array.isArray(arg) ?
@alemures
alemures / makefile
Last active January 25, 2017 18:04
Support multiple build types with GNU make
#
# Compiler flags
#
CC = gcc
CFLAGS = -Wall -Werror -Wextra
#
# Project files
#
SOURCES = file1.c file2.c file3.c file4.c
@alemures
alemures / elasticsearch-response-string.js
Created November 30, 2016 17:13
Elasticsearch response as string with Node.js client library
// Working with elasticsearch client 12.1.0
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: '127.0.0.1:9200',
log: 'warning'
});
// Override per default deserialize method without JSON.parse()
client.transport.serializer.deserialize = function (str) {
@alemures
alemures / data-serialization-formats.md
Last active November 29, 2016 11:35
High performance data serialization formats
  • FlatBuffers (Binary)
  • Protocol Buffers (Binary)
  • MessagePack (Binary)
  • Thrift (Binary)
  • Avro (Binary)
  • JSON (human-readable)
@alemures
alemures / doubleToRawLongBits.c
Last active September 15, 2016 10:58
Convert a double to long in ANSI C (Java's doubleToRawLongBits)
// Make sure that unsigned long is 8 bytes of length
unsigned long utilDoubleToLong(double value) {
unsigned long longValue;
memcpy(&longValue, &value, sizeof(unsigned long));
return longValue;
}
double utilLongToDouble(unsigned long value) {
double doubleValue;