Skip to content

Instantly share code, notes, and snippets.

package main
import (
"bufio"
"context"
"io"
"log"
"net/http"
"os"
"regexp"
@jingkaihe
jingkaihe / rpc
Last active October 15, 2017 22:11
Poor boy's terraform ⚠️ only works on SmartOS. ATM only supports native container (SmartOS & LX brand) provisioning & bootstrapping. You can provision KVM, however you can't run cmd against it
#!/usr/bin/env ruby
require "pty"
require 'optparse'
$stdout.sync = true
$stderr.sync = true
class Hypervisor
attr_accessor :admin, :addr
class Grid
def initialize(grid, dict)
@grid = grid
raise "size of #{grid} isn't 4x4" if @grid.size != 4 || @grid[0].size != 4
@dict = dict
@result = []
end
def dfs(i, j, cur)
# Create SmartOS build image
```json
{
"brand": "joyent",
"fs_allowed": "ufs,pcfs,tmpfs",
"image_uuid": "e69a0918-055d-11e5-8912-e3ceb6df4cf8",
"quota": 100,
"max_physical_memory": 24576,
"alias": "smartos-build",
Running illumos nightly(1).
This will take a while.

real    125m30.916s
user    151m24.401s
sys     82m22.116s

WARNING: illumos nightly build failed. Please look at the mail_msg and
nightly.log to determine the exact failure. For more information on how

Keybase proof

I hereby claim:

  • I am jaxi on github.
  • I am jingkaihe (https://keybase.io/jingkaihe) on keybase.
  • I have a public key whose fingerprint is 5E2A 7C81 38DA 1458 7DA3 65AC 670E 03EE 6C76 429A

To claim this, I am signing this object:

FROM ubuntu:14.04
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
python3-pip
RUN pip3 install flask
COPY ./menu.py /menu.py
package main
import (
"bufio"
"fmt"
"net"
)
type msgs chan string
whites := [][]string{
{" ♙ ", " ♖ ", " ♘ ", " ♗ ", " ♕ ", " ♔ "},
{" ♟ ", " ♜ ", " ♞ ", " ♝ ", " ♛ ", " ♚ "},
}
let lengths row =
List.map row ~f:String.length
let max_width l1 l2 =
List.map2_exn l1 l2 ~f:Int.max
;;
let widths header rows =
List.fold rows
~init:(lengths header)