Skip to content

Instantly share code, notes, and snippets.

@amitv87
amitv87 / hexdump.js
Last active October 11, 2022 10:20 — forked from taniarascia/hexdump.js
Hex dump in JavaScript (Node.js)
function hexdump(buffer) {
let lines = []
for (let i = 0; i < buffer.length; i += 16) {
let address = i.toString(16).padStart(8, '0') // address
let block = buffer.slice(i, i + 16) // cut buffer into blocks of 16
let hexArray = []
let asciiArray = []
let padding = ''
@amitv87
amitv87 / endian.h
Created July 23, 2022 16:11 — forked from yinyin/endian.h
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__
@amitv87
amitv87 / StandardFirmataForATH0.ino
Created April 8, 2016 08:56 — forked from edgarsilva/StandardFirmataForATH0.ino
Modified firmata protocol that works on the arduino YUN linux side communicating to the arduino side using the ttyATH0 serialport interface.
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please clink on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/