Skip to content

Instantly share code, notes, and snippets.

==6865== Memcheck, a memory error detector [115528/1005960]
==6865== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6865== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==6865== Command: ./pdtest_rtaudio
==6865==
==6865== Conditional jump or move depends on uninitialised value(s)
==6865== at 0x40DE29: RtApiAlsa::getDeviceInfo(unsigned int) (in /home/ben/work/games/src/libpd/samples/cpp/pdtest_rtaudio/pdtest_rtaudio)
==6865== by 0x40FC57: RtApiAlsa::saveDeviceInfo() (in /home/ben/work/games/src/libpd/samples/cpp/pdtest_rtaudio/pdtest_rtaudio)
==6865== by 0x41227F: RtApiAlsa::probeDeviceOpen(unsigned int, RtApi::StreamMode, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int*, RtAudio::StreamOptions*) (in /home/ben/work/games/src/libpd/samples/cp
p/pdtest_rtaudio/pdtest_rtaudio)
==38784== Memcheck, a memory error detector
==38784== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==38784== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==38784== Command: ./pdtest_rtaudio
==38784==
--38784-- WARNING: Serious error when reading debug info
--38784-- When reading debug info from /Users/ben/work/games/src/libpd/samples/cpp/pdtest_rtaudio/libs/libpdcpp.dylib:
--38784-- Last block truncated in .debug_info; ignoring
==38784== Conditional jump or move depends on uninitialised value(s)
==38784== at 0x7FFF5FC24C07: bcmp (in /usr/lib/dyld)
valgrind ./pdtest_rtaudio
==38211== Memcheck, a memory error detector
==38211== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==38211== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==38211== Command: ./pdtest_rtaudio
==38211==
--38211-- run: /usr/bin/dsymutil "./pdtest_rtaudio"
--38211-- run: /usr/bin/dsymutil "/Users/ben/work/games/src/libpd/samples/cpp/pdtest_rtaudio/libs/libpdcpp.dylib"
--38211-- WARNING: Serious error when reading debug info
--38211-- When reading debug info from /Users/ben/work/games/src/libpd/samples/cpp/pdtest_rtaudio/libs/libpdcpp.dylib:
extern crate git2;
extern crate rustc_serialize;
use std::collections::HashMap;
use std::io;
use std::io::prelude::*;
use std::thread;
use git2::{Repository, Oid};
use rustc_serialize::json::{self, ToJson, Json};
running: cargo build
Compiling git-tags-rs v0.1.0 (file:///Users/ben/work/git-tags-rs)
src/tag/release.rs:101:29: 101:39 error: unable to infer enough type information about `_`; type annotations or generic parameter binding required [E0282]
src/tag/release.rs:101 Err(err) => Result::Ok(()),
^~~~~~~~~~
note: in expansion of for loop expansion
src/tag/release.rs:98:9: 103:10 note: expansion site
src/tag/release.rs:101:29: 101:39 help: run `rustc --explain E0282` to see a detailed explanation
error: aborting due to previous error
Could not compile `git-tags-rs`.
select(0x1, 0x7FFF5E733240, 0x0, 0x7FFF5E7331C0, 0x0) = 1 0
read(0x0, "\0", 0x1000) = -1 Err#5
ioctl(0x0, 0x4004667A, 0x7FFF5E73325C) = 0 0
read(0x0, "\0", 0x1000) = -1 Err#5
ioctl(0x0, 0x4004667A, 0x7FFF5E73325C) = 0 0
<snip>
read(0x0, "\0", 0x1000) = -1 Err#5
ioctl(0x0, 0x4004667A, 0x7FFF5E73325C) = 0 0
read(0x0, "\0", 0x1000) = -1 Err#5
ioctl(0x0, 0x4004667A, 0x7FFF5E73325C) = 0 0

I found understanding Rust types really confusing, so I wrote up a small tutorial for myself in an attempt to understand some of them. This is by no means exhaustive. There is a types section in the manual, but it has nowhere near enough examples.

I'm not talking about managed pointers (@) at all. A lot of the difficulty with Rust types is that the language is constantly changing, so this will likely be out of date soon.

First, a few preliminaries: it's easier to play with types if you have a REPL and can interactively check the types of objects. This isn't really possible in Rust, but there are workarounds.

To start out: some help

How to get a Rust REPL

pyenv virtualenv 2.7.8 pelicanfly-issues-11
pyenv activate pelicanfly-issues-11
pip install pelican markdown
mkdir site && cd site
pelican-quickstart
# ....
curl https://gist.githubusercontent.com/deepzeafish/0b35baa9989aed7b5295/raw/gistfile1.txt > pelicanconf.py
pip install pelicanfly pelican-gist
mkdir content
vim content/keyboard-review.md
git log --format=%H > git-log
shuf git-log > git-log-shuf
git rev-list --no-walk $(< git-log-shuf) > git-rev-list
diff git-log git-rev-list
import collections
import itertools
import hashlib
import json
import requests
import mixpanel # https://pypi.python.org/pypi/mixpanel-py/4.0.2
def get_mixpanel_datapoints():
url = 'https://data.mixpanel.com/api/2.0/export/'
params = {