Skip to content

Instantly share code, notes, and snippets.

View xd009642's full-sized avatar
🦀
Crab People! Crab People! Crab People!

xd009642

🦀
Crab People! Crab People! Crab People!
View GitHub Profile
### Keybase proof
I hereby claim:
* I am xd009642 on github.
* I am xd009642 (https://keybase.io/xd009642) on keybase.
* I have a public key whose fingerprint is E41E B6C4 DF00 0782 0DE0 A150 560F 1F28 BCFC DD24
To claim this, I am signing this object:
#
# Downloads a random RFC and saves to text file.
#
import random
import urllib.request
MAX_RFC = 8449
while True:
choice = random.randint(1, MAX_RFC)

Rust 2019

This is a bit of a brain dump of my thoughts about Rust 2019. Mainly I work on my own code coverage tool tarpaulin, embedded rust and random little tools. So my perspective will be coloured by this.

Stabilising proc-macro

So this year tarpaulin found itself needing to be compiled on nightly. This was because syntex-syntax is no longer maintained, and as a result, new syntax was

<!-- Portions (C) International Organization for Standardization 1986:
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!ELEMENT coverage (sources?,packages)>
<!ATTLIST coverage line-rate CDATA #REQUIRED>
<!ATTLIST coverage branch-rate CDATA #REQUIRED>
<!ATTLIST coverage lines-covered CDATA #REQUIRED>
module cordic
(
input clk,
input ce,
input rst,
input signed [18-1:0] x_in,
input signed [18-1:0] y_in,
input [18-1:0] phase_in,
module cordic
(
input clk,
input ce,
input rst,
input signed [18-1:0] x_in,
input signed [18-1:0] y_in,
input [18-1:0] phase_in,
pub struct HoughParameters<T, D, F>
where
D: Dimension,
F: Sized + (Fn(f64) -> Array1<T>),
{
/// Represents the dimensionality of the hough space
pub dim: PhantomData<D>,
/// Parameter bounds
pub bounds: Array2<T>,
/// Search resolution for each parameter. Should be the same size as bounds.
function read_file(path)
local file, errorMessage = io.open(path, "r")
if not file then
error("Could not read the file:" .. errorMessage .. "\n")
end
local content = file:read "*all"
file:close()
return content
end
local FileBody = read_file("audio.wav")
use bytes::{Buf, Bytes, BytesMut};
use opentelemetry::sdk;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::sdk::trace::{Builder, Sampler};
use opentelemetry::trace::TracerProvider;
use opentelemetry::{global::set_text_map_propagator, KeyValue};
use std::convert::TryFrom;
use std::env::var;
use std::net::SocketAddr;
use std::process::Stdio;
#[derive(Debug, Clone)]
pub struct Biquad{
/* https://ccrma.stanford.edu/~jos/fp/Direct_Form_II.html */
b0: f64,
b1: f64,
b2: f64,
a1: f64,
a2: f64,
}