Skip to content

Instantly share code, notes, and snippets.

@mattlevan
mattlevan / install-apt-packages.sh
Created October 31, 2020 01:17
Install apt packages on multiple computers simultaneously
#!/bin/bash
# Dependencies:
# - Each machine must have openssh-server installed
# - Each machine must have key-based SSH authentication configured
# - Each machine must have
declare -a MACHINES=(
"localhost"
"nonexistent"
@mattlevan
mattlevan / spiral_order.py
Created April 20, 2020 18:52
Leetcode 54: Spiral Matrix
"""
Problem: Given a 2D array of integers, create a spiral_copy function
that copies the input matrix's values into a 1D array in spiral order,
clockwise. The function should return only that array and analyze the
time/space complexities after you have a solution.
Solution: Return a 1D spiral copy of the input matrix.
Approach:
1. Extract the width and height of the input matrix into separate variables
Monday 02 March 2020 18:23:32 +0000 (0:00:00.775) 0:24:24.538 **********
FAILED - RETRYING: Create kubeadm token for joining nodes with 24h expiration (default) (5 retries left).
FAILED - RETRYING: Create kubeadm token for joining nodes with 24h expiration (default) (4 retries left).
FAILED - RETRYING: Create kubeadm token for joining nodes with 24h expiration (default) (3 retries left).
FAILED - RETRYING: Create kubeadm token for joining nodes with 24h expiration (default) (2 retries left).
FAILED - RETRYING: Create kubeadm token for joining nodes with 24h expiration (default) (1 retries left).
TASK [kubernetes/master : Create kubeadm token for joining nodes with 24h expiration (default)] ************************************fatal: [node1 -> 10.195.92.108]: FAILED! => {"attempts": 5, "changed": true, "cmd": ["/usr/local/bin/kubeadm", "--kubeconfig", "/etc/kubernetes/admin.conf", "token", "create"], "delta": "0:01:15.060518", "end": "2020-03-02 18:31:30.943124", "msg": "non-zero return code", "rc": 1,
all:
hosts:
node1:
ansible_host: 10.195.92.108
ip: 10.195.92.108
access_ip: 10.195.92.108
node2:
ansible_host: 10.195.92.114
ip: 10.195.92.114
access_ip: 10.195.92.114
@mattlevan
mattlevan / hoon-snip.md
Last active November 14, 2017 05:05
Hoon Snippet Interpretation

Flow

First send text from snippet editor to ride below, using the span of whichever subject I've explicitly defined. How do I go about defining the subject which snippets are run against? Call ride, with span as *, which will produce Nock. Then take the Nock and run it with .*.

 ++  ride                                                ::  end-to-end compiler
   |=  {typ/span txt/@}
   ^-  (pair span nock)
 (~(mint ut typ) %noun (ream txt))
@mattlevan
mattlevan / notes.md
Created November 14, 2017 02:23
Notes

Notes Specification

Summary

Web application for writing notes with Urbit. Accepts Udon from web text editor, sends to app/notes.hoon and the app writes to Clay and notifies subscribers. Subscribers may read a list of notes, view their rendered form, and edit them.

Architecture

Application (app/notes.hoon)

Structures (sur/)

Marks (mar/)

@mattlevan
mattlevan / hall.md
Created November 11, 2017 06:31
Notes on Hall

Hall Notes

The main significant cost of software development is the cost of untangling what the computer is doing, and or is supposed to be doing, over and over again in your head. Any way of lowering this untangling cost is extremely welcome.

-- ~sorreg-namtyv

Standard subscription management logic (ssml, pronounced smell)

@mattlevan
mattlevan / note.hoon
Created November 10, 2017 19:13
/mar/notes/note.hoon
:::: /===/mar/notes/note/hoon
::
/- notes-note
!:
|_ note=notes-note
++ grab
|%
+= noun notes-note
++ json
|= jon=^json
@mattlevan
mattlevan / .vimrc
Created November 9, 2017 02:18
.vimrc
set nocompatible " be iMproved, required
filetype off " required
set number
set shiftwidth=2
set softtabstop=2
set expandtab
set virtualedit=all
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
@mattlevan
mattlevan / config.fish
Created November 8, 2017 19:01
fish config for Urbit development
alias ranger='ranger --choosedir=$HOME/.rangerdir; set LASTDIR (cat $HOME/.rangerdir); cd $LASTDIR'
### mirror a into b on change
#TODO figure out a way to kill this more simply.
function mirror
fswatch $argv[1] -e '\.git' | \
while read file;
echo (date "+%Y-%m-%d %H:%M:%S") "$file"
cp -r $argv[1] $argv[2]
end