Skip to content

Instantly share code, notes, and snippets.

View huonw's full-sized avatar

Huon Wilson huonw

View GitHub Profile
@huonw
huonw / flaky tests.ipynb
Created June 14, 2020 23:51
Find flaky tests in a Buildkite pipeline
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@huonw
huonw / bash-tutorial.sh
Last active September 28, 2020 01:57
Bash Tutorial
#!/bin/bash
# (The directive above is called a "shebang": https://en.wikipedia.org/wiki/Shebang_(Unix) )
# Helper function that prints each of the arguments (functions can be
# declared with `function <name> { ... }` or `<name>() { ... })
printArguments() {
# arguments come in as the variables $1, $2, $3, ...
count=1
# (( ... )) does numeric tasks
while (( $# )); do

The comments on this gist were created by selecting lines 96-98 in https://buildkite.com/bazel/android-studio-plugin/builds/1216#ed6edb2d-83c6-47b0-ba42-76aa09234910, copying, and pasting. The empty lines, whitespace, |s and --s on some lines were the result of the paste. The same behaviour was observed copying from Chrome or Safari, and pasting into either Chrome, Safari or Firefox (e.g. including Chrome -> Safari, and Safari -> Chrome); copying from Firefox had even less useful behaviour.

This only seems to occur in Github's issue/PR descriptions and comments. Pasting into other places, such as a text editor, or this Gist edit box works as expected (no empty lines, whitespace or |):

python3.6 bazelci.py project_pipeline --file_config=.bazelci/android-studio.yml | buildkite-agent pipeline upload'
2019-03-26 21:39:15 INFO   Reading pipeline config from STDIN
bazelci.py:585: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://m

Keybase proof

I hereby claim:

  • I am huonw on github.
  • I am huon (https://keybase.io/huon) on keybase.
  • I have a public key ASDY5j40gPNqAE7q8VTyb0c4AzsB1IDyygpi36x0_eMFmgo

To claim this, I am signing this object:

Announcement:

With Rust's first birthday upon us on May 15th, 2016, we should take this opportunity to reflect on where we've been, and where we're going. As part of the celebrations, we are pleased to announce the official 2016 State of the Rust Language Survey! Whether or not you use Rust today, we want to to know your opinions. Your responses will help the project understand its strengths and weaknesses, and to establish development priorities for the future.

The 2016 State of Rust Survey

Completing this survey should take about 5 to 10 minutes, and is anonymous unless you give us your contact information. We will be accepting submissions until June 8th, 2016.

Please help us spread the word by sharing the above link on your social network feeds, at meetups, and around your office and other communities.

@huonw
huonw / playground.rs
Created November 25, 2015 10:29 — forked from anonymous/playground.rs
Shared via Rust Playground
#![crate_type = "lib"]
pub fn soa(xs: &mut [f64], ys: &mut [f64]) {
for (x, y) in xs.iter_mut().zip(ys.iter_mut()) {
*x += 1.0;
*y *= 3.5;
}
}
pub fn aos(points: &mut [(f64, f64)]) {
for point in points.iter_mut() {
point.0 += 1.0;
@huonw
huonw / main.rs
Created October 13, 2015 06:25 — forked from RustyRails/main.rs
Challenge #236 [Easy] Random Bag System
extern crate rand;
use rand::Rng;
struct Bag {
contents: Vec<char>,
rng: rand::ThreadRng,
}
impl Bag {
@huonw
huonw / dsp.rs
Last active August 29, 2015 14:21 — forked from anonymous/Cargo.toml
use std::cmp::max;
use std::cmp::min;
use std::i16;
const FILTER_SIZE : usize = 16;
pub struct FilterState {
// Must use doubles for these arrays, otherwise can be noisy.
input: [f64; FILTER_SIZE],
output: [f64; FILTER_SIZE],

Conversation about lifetimes on #rust, on mozilla's irc network, prompted by hamnox and lahwran attempting to understand lifetimes.

Timestamps are in Mountain time.

1-30 07:09.06pm so we're reading this http://doc.rust-lang.org/book/ownership.html 1-30 07:09.28pm it mentions lifetimes a lot, and gives examples of where to use lifetimes, and the effects of lifetimes, but it has yet to actually, you know, describe what a lifetime is 1-30 07:09.48pm lahwran, I actually treat lifetimes as dependency markers 1-30 07:10.05pm we (my partner and I) have made several guesses as we read as to what lifetimes are, based on inference, but then we got to the point where a function used a lifetime both for an input and an output 1-30 07:10.06pm They're descriptions to how long a value lives.

* The `Copy` trait is no longer implemented automatically. Unsafe pointers no longer implement `Sync`
and `Send` so types containing them don't automatically either. `Sync` and `Send` are now 'unsafe
traits' so one can "forcibly" implement them via `unsafe impl` if a type confirms to the requirements for them even though the internals do not (e.g. structs containing unsafe pointers like `Arc`). These changes are intended to prevent some footguns
and are collectively known as [opt-in built-in traits][oibit]
(though `Sync` and `Share` will soon become pure library types
unknown to the compiler).