Skip to content

Instantly share code, notes, and snippets.

@zombiezen
zombiezen / 01current.go
Last active August 29, 2015 14:26
go-capnproto call ordering
// RPC implementation of calling a local vat method.
// This is a simplified version of the code in server.go:45.
// go-capnproto doesn't reflect it now, but I was going to make callOnClient serialized.
func (s *server) callOnClient(call *Call) Answer {
// Find the function for the call's method
fn := s.methods.find(call.Method)
// Build a new answer/future.
ans := newServerAnswer()
// Run the implementation in a separate goroutine.
@zombiezen
zombiezen / keybase.md
Created August 19, 2015 23:31
Keybase Proof

Keybase proof

I hereby claim:

  • I am zombiezen on github.
  • I am zombiezen (https://keybase.io/zombiezen) on keybase.
  • I have a public key whose fingerprint is 14DA 18A1 FF5F 0200 1311 8EFF A5FE 67D1 3018 2499

To claim this, I am signing this object:

@zombiezen
zombiezen / testparams.bash
Created December 24, 2016 06:33
Weird bash parameter expansion test behavior
#!/bin/bash
bash --version
# My repro is on GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
echo
echo "unset"
test 'foo123' -eq 0 && echo "test: true" || echo "test: false"
[ 'foo123' -eq 0 ] && echo "[: true" || echo "[: false"
[[ 'foo123' -eq 0 ]] && echo "[[: true" || echo "[[: false"
@zombiezen
zombiezen / github-issue-csv.go
Last active February 2, 2017 23:36
GitHub Issue CSV Exporter
// Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@zombiezen
zombiezen / google-fluentd.conf
Created April 7, 2017 22:30
journald to Stackdriver fluentd config
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@zombiezen
zombiezen / Dockerfile
Created June 5, 2017 15:39
dep Container Builder image recipe
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@zombiezen
zombiezen / .profile
Last active November 15, 2023 07:34
zsh on Google Cloud Shell
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@zombiezen
zombiezen / unconvert-std.txt
Created July 15, 2017 20:52
unconvert results on stdlib
/Users/light/go/src/archive/tar/format.go:131:26: unnecessary conversion
/Users/light/go/src/archive/tar/strconv.go:198:34: unnecessary conversion
/Users/light/go/src/archive/tar/strconv.go:200:30: unnecessary conversion
/Users/light/go/src/archive/zip/reader.go:303:18: unnecessary conversion
/Users/light/go/src/debug/dwarf/entry.go:419:15: unnecessary conversion
/Users/light/go/src/math/big/prime.go:253:14: unnecessary conversion
/Users/light/go/src/net/http/fs.go:292:17: unnecessary conversion
/Users/light/go/src/net/http/h2_bundle.go:6966:37: unnecessary conversion
/Users/light/go/src/net/writev_unix.go:81:23: unnecessary conversion
/Users/light/go/src/os/stat_darwin.go:45:24: unnecessary conversion
@zombiezen
zombiezen / simplerpc.go
Last active January 2, 2018 18:32
Simple RPC skeleton for experience report
type Conn struct {
wc io.WriteCloser
// ... other internal state ...
}
func NewConn(rwc io.ReadWriteCloser) *Conn {
c := &Conn{wc: rwc}
go c.receive(rwc)
return c
}
@zombiezen
zombiezen / justclose.go
Created December 31, 2017 18:34
Closing simple RPC connection in Experience Report
type Conn struct {
wc io.WriteCloser
tasks sync.WaitGroup
// ... other internal state ...
}
func NewConn(rwc io.ReadWriteCloser) *Conn {
c := &Conn{wc: rwc}
c.tasks.Add(1)
go func() {