Instantly share code, notes, and snippets.


Rust 2018: Rust should be an excellent open source citizen

Here's my late [#rust2018][rust2018] post. I contribute to a lot of projects in a lot of different languages. I think it's really important not to think about Rust in isolation, but in the context of the greater open source world. Here area few specific ways I think about this:

  • ease of contributing to projects in rust
  • interoperability with other languages (both directions)
  • ripgrep should be in debian
  • don't fracture the ecosystem

The rest of this post is going through these in turn.

View dump-debuginfo
set -eou pipefail
me="$(basename $BASH_SOURCE)"
if [ $# -ne 1 ]; then
echo >&2 usage: "$me" /path/to/binary/to/dump
exit 1
View ifconfig-annotated-strace
######## start up crap ########
execve("/sbin/ifconfig", ["ifconfig"], [/* 16 vars */]) = 0
brk(0) = 0xda6000
access("/etc/", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f87bbd5d000
access("/etc/", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=106334, ...}) = 0
mmap(NULL, 106334, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f87bbd43000
View rest-client.hs
{-# LANGUAGE OverloadedStrings #-}
-- The Haskell String type is a linked list of characters, and according to the
-- Haskell Report, literal strings have this type. There are better
-- representations like Data.Text and ByteString, which use packed arrays of
-- characters. OverloadedStrings is a language extension that lets you use
-- sting literals in places where these other representations are expected,
-- without needing conversion functions. In this file, that's happening in the
-- object property getters in parseJson -- (.:) takes a Data.Text, and you want
-- to call it more conveniently with a string literal.
View Vagrantfile
Vagrant.configure("2") do |config| = "precise32"
config.vm.box_url = ""
View lazy-bytestring-cycle.hs
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Encoding as E
import qualified Data.ByteString.Lazy as L
mtl = "montréal\n" :: T.Text
long = L.cycle $ E.encodeUtf8 mtl
main = L.putStr long
View watch.rb
require 'formula'
class Watch < Formula
homepage ''
url ''
sha1 '8b18d176ce639cd89e969cd815c61a4e5bdf9e82'
def install
system "make", "watch", "PKG_LDFLAGS=-Wl"
bin.install "watch"