Skip to content

Instantly share code, notes, and snippets.

@stonehippo
stonehippo / reduce_is_powerful.js
Last active October 16, 2015 01:56
Reduce: the power of a higher-order function
/*
A quick demo of the power of the `reduce()` higher-order function.
In this demo, `reduce()` has been used to replicate several of its
higher-order cousins: `map()`, `filter()`, and `find()`. The point is
to show that `reduce()` is a functional multi-tool. If you have
`reduce()``, you're on your way to some functional bliss.
For each example, the native version of the higher-order function is
shown before the reduce version. The native versions are much more
@stonehippo
stonehippo / javascript_functional_and_reactive.md
Last active April 12, 2020 03:40
A collection of resources for functional and reactive Javascript (with some other stuff you should know, too)

Javascript: functional and reactive (and other stuff you should know)

Libraries

Note: I've split these libraries along functional/reactive lines, but that's merely for convenience. The FRP libraries are more or less functional by definition.

Functional Programming

@stonehippo
stonehippo / docker_x11_gui_osx.md
Last active March 18, 2025 02:28
Getting X11 GUI applications to work on OS X with Docker

Getting X11 GUI applications to work on OS X with Docker

$ brew install socat
$ brew cask install xquartz <--- assuming you don't already have XQuartz installed some other way
$ open -a XQuartz <--- start an XQuartz session

$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
@stonehippo
stonehippo / docker_usb_guest_osx.md
Last active June 12, 2024 10:36
Getting a USB device to show up in a Docker container on OS X

Getting a USB device to show up in a Docker container on OS X

Some background

I was trying to get the Arduino IDE to work inside a Docker container on OS X. I was able to get the IDE working (see Getting X11 GUI applications to work on OS X with Docker), but I could not figure out how to make the USB port for the Arduino visible.

The solution

I first tried to directly map hardware serial port into the Docker container, doing something like this:

@stonehippo
stonehippo / Containers_clusters_swarms.md
Last active May 1, 2019 20:14
Containers, clusters and swarms
@stonehippo
stonehippo / Robotics-with-high-level-languages.md
Last active September 2, 2024 17:05
Programming robots with JavaScript, Ruby or Go

Robotics Programming With High Level Languages

  • Johnny 5 — JavaScript robotics, for both host-based and on-device programming

Artoo, Cylon & Gobot

These three projects are related, offering similar APIs and platform support across multiple languages. The Go version is getting active updates. The JavaScript and Ruby versions havent seen updates in quite a while.

@stonehippo
stonehippo / hacking_bergcloud_bridge.md
Last active January 28, 2017 15:16
Hacking the BERGCloud Bridge

Hacking the BERGCloud Bridge

Bridge Serial Interface

The bridge has a UART serial port interface that can be used to access the console. This serial port is the key to accessing the bridge and making our own changes.

The serial interface is a simple, three-pin port on the bridge. To access it, you have to remove the bridge's case. Looking at the top surface of the bridge circuit board (the side with all of the chips on it), you'll see the word Serial and a box stenciled around three holes to the right and above the Ethernet port.

The pinout for the serial port is, from left to right: RX, TX, Ground.

@stonehippo
stonehippo / useful_commands.md
Last active July 5, 2017 22:38
Useful commands

nestat -lntu

list open TCP & UDP ports

cat /dev/null > ~/.bash_history && history -cw && exit

completely erase command history and exit current shell (logout)

who && ps -dN | grep pts/ and kill -9 [pid]