Skip to content

Instantly share code, notes, and snippets.

@shawwwn
shawwwn / uping.py
Last active April 29, 2024 17:45
µPing: Ping library for MicroPython
# µPing (MicroPing) for MicroPython
# copyright (c) 2018 Shawwwn <shawwwn1@gmail.com>
# License: MIT
# Internet Checksum Algorithm
# Author: Olav Morken
# https://github.com/olavmrk/python-ping/blob/master/ping.py
# @data: bytes
def checksum(data):
if len(data) & 0x1: # Odd number of bytes
@mscdex
mscdex / _instructions.md
Last active July 2, 2022 20:10
ssh shell session from the browser

Instructions:

  1. npm install express faye-websocket ssh2 term.js
  2. Create a public subdirectory
  3. Place client.htm in public
  4. Edit the ssh connection details in server.js. See the documentation for the connect() method in the ssh2 readme for more information.
  5. Start the server with node server.js
  6. Visit http://localhost:8000/client.htm in a WebSocket-capable browser
@victorsollozzo
victorsollozzo / gist:4134793
Created November 23, 2012 09:44
recursively find all files in a directory with given extension in node.js
var path = require('path')
var fs = require('fs')
function recFindByExt(base,ext,files,result)
{
files = files || fs.readdirSync(base)
result = result || []
files.forEach(
function (file) {