Skip to content

Instantly share code, notes, and snippets.

View n1ywb's full-sized avatar

Jeff Laughlin n1ywb

View GitHub Profile
@n1ywb
n1ywb / link.py
Last active August 2, 2020 22:51
scrounge a dir tree for wanted files
@n1ywb
n1ywb / locking-store.js
Last active May 13, 2019 17:16
optimistically locking store wrapper for node cache manager
/**
* Experimental optimistically-locking cache-manager store wrapper
*
* Completely untested; caveat emptor
*/
const inspect = require('util').inspect
export const LOCK_TIMEOUT = 5000
export const LOCK_EXTEND_TIMEOUT = 2500
@n1ywb
n1ywb / vfs.js
Created May 13, 2019 17:15
start of a node based virtual file system monkey patch for fs module
/** Experimental virtual file system thing
* it doesn't really work with the sync FS api
* untested
*/
const MAX_FILE_SIZE = 1024 * 1024 * 10 // 10MB
class CachedFile {
constructor (cache, path, { maxFileSize = MAX_FILE_SIZE }) {
this.cache = cache
// TODO auto-allocate new buffer when it fills
@n1ywb
n1ywb / canvas-d3.markdown
Created September 22, 2018 04:56
canvas d3
jeff@ta00491-Jeff ~/esp/hello_world $ make monitor
fatal: Not a git repository: /home/ivan/esp-idf/.git/modules/components/aws_iot/aws-iot-device-sdk-embedded-C
MONITOR
--- idf_monitor on /dev/ttyUSB1 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
#!/usr/bin/env bash
wget http://mything.com/mything.tgz
tar xzf mything.tgz
cd mything
make all; make test; sudo make install
echo -e '#!/usr/bin/env bash\ninsmod mything.so' > /etc/rc.local
@n1ywb
n1ywb / sketch.ino
Last active January 1, 2018 16:00
feather m0 samd21 externally clocked counter
/*
WiFi Web Server
A simple web server that shows the value of the analog input pins.
using a WiFi shield.
This example is written for a network using WPA encryption. For
WEP or WPA, change the WiFi.begin() call accordingly.
Circuit:
TC5->COUNT16.CTRLA.reg &= ~TC_CTRLA_ENABLE;
while (TC5->COUNT16.STATUS.bit.SYNCBUSY);
TC5->COUNT16.CTRLA.reg = TC_CTRLA_SWRST;
while (TC5->COUNT16.STATUS.bit.SYNCBUSY);
from celery import Celery
app = Celery('tasks', broker='amqp://guest@localhost//')
@app.task
def add(x, y):
return x + y
@n1ywb
n1ywb / git-working-history
Last active August 29, 2015 14:25 — forked from gabro/git-working-history
Github-like working directory history
#!/bin/bash
FILES=`git ls-tree --name-only HEAD .`
MAXLEN=0
IFS=$(echo -en "\n\b")
for f in $FILES; do
if [ ${#f} -gt $MAXLEN ]; then
MAXLEN=${#f}
fi
done