Skip to content

Instantly share code, notes, and snippets.

@wking
wking / PR-1065-2a1bf261f7.console
Created January 17, 2019 06:20
IPNet (de)serialization comparison
$ go run test.go
serialize JSON
their JSON: {"IP":"192.168.0.10","Mask":"////AA=="}
our JSON: "192.168.0.10/24"
serialize String
their String: 192.168.0.10/24
our String: 192.168.0.10/24
deserialize JSON
@wking
wking / notes.md
Created September 11, 2018 23:57
Binding a device into a container via a shared directory

That doesn't seem like a critical issue, just adjust the paths in my example to match whatever you need.

I think it is, unless /dev in the container is a bind-mount with shared propagation, how can I make /dev/nvidia appear inside the container without a subdirectory?

# mkdir /tmp/scratch
# podman run -it --rm --volume /tmp/scratch/:/tmp/scratch:shared docker.io/library/busybox
/ # ls -l /dev/
total 0
crw--w----    1 root     tty       136,   0 Sep 11 23:46 console
Values SHOULD conform to the following grammar (specified in [XML 1.0's EBNF][ebnf]):
```
ref ::= component ("/" component)*
component ::= alphanum (separator alphanum)*
alphanum ::= [a-zA-Z0-9]+
separator ::= [-._:@+] | "--"
```
[ebnf]: https://www.w3.org/TR/REC-xml/#sec-notation
Undefined
ref := component ["/" component]*
component := alphanum [separator alphanum]*
alphanum := /[A-Za-z0-9]+/
separator := /[-._:@+]/ | "--"
ABNF
ref = component *("/" component)
$ git clone git://github.com/ldthomas/apg-6.3.git
$ cd apg-6.3
$ ./configure
$ make
$ cat <<EOF >>ref.abnf
> ref = component *("/" component)
> component = alphanum *(separator alphanum)
> alphanum = 1*(ALPHA / DIGIT)
> separator = "--" / "-" / "." / "_" / ":" / "@" / "+"
> ALPHA = %x41-5A / %x61-7A
package main
import (
"fmt"
"regexp"
"strings"
)
var multiSlashRegexp = regexp.MustCompile("//*")
var multiBackslashRegexp = regexp.MustCompile("\\\\*")
@wking
wking / ChangeLog
Last active February 4, 2016 23:32
opencontainers/specs v0.3.0
Breaking changes:
* config: Single, unified config file, #284
* config: cwd is a required default and must be absolute, #286,
#307, #308, #312
* config: Qualify the name of the version field, #309
* config-linux: Convert classID from hex to uint32, #296
* config-linux: Separate mknod from cgroups, #298
Additions:
@wking
wking / runtime.md
Last active September 19, 2015 08:25 — forked from julz/runtime.md
Example Runtime Spec

Operations

A conformant runtime should provide an executable (called funC in the following examples). The template for supported commands is:

$ funC [global-options] <COMMAND> [command-specific-options] <command-specific-arguments>

Global options

@wking
wking / gist:00cbcde402a8f0fc1483
Last active August 29, 2015 14:15
Current azurestandard/website dependencies
@wking
wking / category-upload.py
Last active September 18, 2015 22:45
Upload product ↔ category associations
#!/usr/bin/env python3
#
# https://gist.github.com/wking/cf87063bd5f76be73db0
import csv
import json
import logging
import sys
import time
import urllib.request