Skip to content

Instantly share code, notes, and snippets.

View laduke's full-sized avatar

Travis LaDuke laduke

  • zerotier
  • California
View GitHub Profile
function h(tag, as, xs) {
var attrs = Object.entries(as).map(([k, v]) => ` ${k}="${v}"`);
return `<${tag}${attrs}>${xs.join("")}</${tag}>`;
}
console.log(
h("div", { id: "foo" }, [
h("p", { class: "big" }, ["hi", h("p", {}, ["3"])]),
h("p", {}, ["bye"])
@laduke
laduke / zerotier-troubleshoot.md
Last active December 17, 2020 17:39
zerotier-troubleshoot.sh

Collect information helpful for troubleshooting zerotier-one

Run this on Mac or Linux

It will create a text file in the current directory. It won't modify anything.

Make sure you are root

   (set -x; \
 zerotier-cli info -j; \
@laduke
laduke / machine.js
Last active September 19, 2019 23:15
Generated by XState Viz: https://xstate.js.org/viz
const myMachine = Machine({
type: 'parallel',
context: {},
states: {
hi: {
initial: 'no',
states: {
yes: {},
no: { on: { CLICK_ME: 'yes' } }
@laduke
laduke / zerotier-cli-completion.bash
Created July 7, 2020 20:56
bash completion for zerotier-cli
#compdef zerotier-cli
#autoload
_get_network_ids ()
{
if [[ "$OSTYPE" == "darwin"* ]]; then
COMPREPLY=($(compgen -W "$(ls -1 /Library/Application\ Support/ZeroTier/One/networks.d | cut -c 1-16)" -- ${cur}))
else
COMPREPLY=($(compgen -W "$(ls -1 /var/lib/zerotier-one/networks.d | cut -c 1-16)" -- ${cur}))
@laduke
laduke / network-via-fs.md
Last active December 17, 2020 17:39
zerotier network join via fs

Typically, you use zerotier-cli to join and leave networks, but you can also write files to the filesystem to do this.

The networks.d subdirectory of the ZeroTier working directory keeps track of which networks are joined and their settings.

The ZeroTier working directory can be found...

  • On Windows: \ProgramData\ZeroTier\One
  • On Mac: /Library/Application Support/ZeroTier/One
  • On Linux: /var/lib/zerotier-one
@laduke
laduke / members-list-csv.sh
Last active July 6, 2023 18:26
zerotier central members list as csv
curl --silent --header "authorization: bearer ${TOKEN}" "https://my.zerotier.com/api/network/${NWID}/member" | jq ".[] | [ .nodeId, .name, .config.ipAssignments[0] ]" | jq -rs ".[] | @csv"