Skip to content

Instantly share code, notes, and snippets.

View laduke's full-sized avatar

Travis LaDuke laduke

  • zerotier
  • California
View GitHub Profile
// maybeToFuture :: a -> Maybe b -> Future a b
const maybeToFuture = S.curry2((x, maybe) =>
S.maybe(Future.reject(x), Future.of, maybe)
);
//also
/*
Aldwin Vlasblom @Avaq Aug 14 05:12
I generally have two strategies for dealing with a Future(Just(x)):
Using maybeToFuture. @davidchambers just posted an implementation. I use this when Nothing represents an actual error in the code (one that can only be recovered from by my generic error recovery procedure, which usually reports the error and crashes the process).
@laduke
laduke / zerotier - client isolation.md
Last active December 17, 2020 17:39
ZeroTier Rules Engine - Hub and Spoke - Client Isolation

Common ZeroTier Rules Engine question

  • Non-servers can talk to servers, but not each other
  • Kind of like Client Isolation on some WiFi controllers

Rules

# Allow only IPv4, IPv4 ARP, and IPv6 Ethernet frames. Typical default
drop
not ethertype ipv4
and not ethertype arp
@laduke
laduke / yo.el
Created December 20, 2017 17:42
Get web-mode inside of yo-yo/bel html template strings
(defun aj-javascript/post-init-mmm-mode ()
(with-eval-after-load 'rjsx-mode
(mmm-add-classes '((yo
:submode web-mode
:front "html`"
:back "`"
:face mmm-declaration-submode-face)))
(mmm-add-mode-ext-class 'rjsx-mode nil 'yo)
(setq mmm-parse-when-idle 't)
))
var daggy = require('daggy')
const Machine = daggy.taggedSum('Timer', {
Yellow: [],
Green: [],
Red: []
})
Machine.prototype.timer =
function () {
@laduke
laduke / zerotier-rpi-bridge.md
Last active January 26, 2024 13:01
Various Network Configuration Output

Motivation

Use a Raspberry Pi as a bridge into my home LAN. The pi is plugged into a switch, which is plugged into an airport express, which is plugged into a cable modem; Nothing fancy.

This isn't a tutorial. Just some example output from a working setup.

steps

off the top of my head, here's the order I would do it in:

  • make sure plain old device to device zerotier is working with my LAN/Router/Firewall/ISP
@laduke
laduke / rules.md
Last active December 17, 2020 17:39
zerotier rules engine - examples

Whitelist by port

drop
  not ethertype ipv4
  and not ethertype arp
  and not ethertype ipv6
;

accept
 dport 6445
@laduke
laduke / html-index.js
Created July 10, 2018 17:45
simple html index
var http = require('http')
var { html, title, head, body, div } = require('hyperaxe')
var page = html(
head(title('hi')),
body(
div({ id: 'app' })
)
).outerHTML

Find your auth token

the authtoken.secret file

  • On Mac this is in "/Library/Application Support/ZeroTier/One". also, the installer copies it to ~/Library/Application
    Support/ZeroTier/One
  • Windows this is usually in "\ProgramData\ZeroTier\One". also, the installer copies it somewhere local to the installing user... I
@laduke
laduke / ztv6.md
Last active September 23, 2023 15:53
ZeroTier 6PLANE and RFC4193 address calculation

ZeroTier IPv6 Auto-Assign Addresses

https://www.zerotier.com/manual.shtml#2_2_3

  • A network ID is 16 hex digits (9bee8941b5de0691)
  • A node ID is 10 hex digits (1234512345)

ZeroTier RFC4193 (/128 for each device)

  • fd9b:ee89:41b5:de06:9199:9312:3451:2345

ZeroTier 6PLANE (/80 routable for each device)

@laduke
laduke / controller.org
Created February 25, 2019 18:41
controller.org

Set up a controller with curl

1 Find your auth token

the authtoken.secret file

  • On Mac this is in “/Library/Application Support/ZeroTier/One”. also, the installer copies it to ~/Library/Application\ Support/ZeroTier/One
  • Windows this is usually in “\ProgramData\ZeroTier\One”. also, the installer copies it somewhere local to the installing user… I forget
  • On Linux this is usually in “/var/lib/zerotier-one”.