Skip to content

Instantly share code, notes, and snippets.

@mkmik
mkmik / main.dart
Last active August 5, 2019 17:35
test
import 'dart:math';
var random = Random.secure();
Future<int> rand() {
return Future.delayed(new Duration(seconds: 1), () { return random.nextInt(200); });
}
Future<int> get() async {
print("beginning to save");
import 'dart:math';
var random = Random.secure();
Future<int> rand() {
return Future.delayed(new Duration(seconds: 1), () { return random.nextInt(200); });
}
Future<int> get() async {
print("beginning to save");
{
kube:: import 'https://github.com/bitnami-labs/kube-libsonnet/raw/52ba963ca44f7a4960aeae9ee0fbee44726e481f/kube.libsonnet',
local kube = self.kube,
foo: kube.Deployment('foo') {
spec+: {
template+: {
spec+: {
containers_+: {
controller: kube.Container('foo') {
// mapObjects applies func on every object in a tree.
local mapObjects(obj, func=function(n, o) {}) = {
[n]+: mapObjects(obj[n], func) + func(n, obj[n])
for n in std.objectFields(obj)
if std.isObject(obj[n])
};
// deepMerge applies a patch to every object matching a predicate.
local deepMerge(obj, patch, pred=std.isObject) = obj + mapObjects(obj, function(n, o) if pred(o) then patch else {});
@mkmik
mkmik / keybase.md
Created September 5, 2018 09:20
keybase.md

Keybase proof

I hereby claim:

  • I am mkmik on github.
  • I am mkm (https://keybase.io/mkm) on keybase.
  • I have a public key whose fingerprint is B44C 0CDF FCFB 99E0 AEC2 9E6A 7AFE C025 4068 B41B

To claim this, I am signing this object:

@mkmik
mkmik / gist:43937687201db3062bf469467cf54859
Last active August 7, 2018 23:33
Instructions for using ssh keypair from a smartcard (e.g. yubi nano) from inside docker (e.g. inside cloudready chromiumos)
Instructions for using ssh keypair from a smartcard (e.g. yubi nano) from inside docker (e.g. inside cloudready chromiumos)
run a privileged container
$ docker run -ti --name foo --privileged ubuntu bash
Do once
$ apt-get install pcscd scdaemon gnupg2 pcsc-tools ssh
$ cat >>~/.gnupg/gpg-agent.conf <<EOF
pinentry-program /usr/bin/pinentry-curses
enable-ssh-support
test
// extensible takes a jsonnet value and if it's an object it recursively
// computes a version of the object where each of its fields is converted
// to the "+:" form.
local extensible(o) = if std.isObject(o) then {
[n]+: extensible(o[n])
for n in std.objectFields(o)
} else o;
// merge takes two objects and merges them recursively.
local merge(a, b) = a + extensible(b);
@mkmik
mkmik / gist:6961187443dcbe1de72e1fe3b6ffbe81
Created April 13, 2018 02:45
plan9 plumbing rules for golang fully qualified packages (import paths)
home=/Users/mkm
type is text
data matches '[a-zA-Z0-9_\-./]+'
arg isdir $home/go/src/$0
data set $home/go/src/$0
plumb to edit
plumb client $editor
@mkmik
mkmik / README.md
Last active March 13, 2018 11:46
show graph of git history relevant to current local branches

I like to use git command line. I use a simple alias ll = log --pretty=oneline --abbrev-commit --decorate=short --branches --graph for ages and I was almost happy. I realized I often just don't care about the old history though, but I do want to see how the current (active) I have relate to master (and to each other)

$ git branches
  something
*  something else
  master
  world
$ git ll