-
Add Rustdoc root to the crate root
#![doc(html_root_url = "https://docs.rs/<crate>/<version>")]
(where
<crate>
is the crate name and<version>
is the version name)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct V([u64; 3]); | |
impl std::ops::Deref for V { | |
type Target = [u64; 3]; | |
fn deref(&self) -> &Self::Target { | |
&self.0 | |
} | |
} | |
impl<'a> IntoIterator for &'a V { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Mark all notifications as read, including "ghost" notifications. | |
# Works on Linux, requires a "classic" auth token be present in `~/.github-oauthtoken` | |
# and also that `gh` is installed. You could presumably use `gh auth login` instead | |
# if you want to authenticate that way. | |
# | |
# Works for me, use at your own risk. | |
# | |
# https://github.com/orgs/community/discussions/6874 | |
# https://docs.github.com/en/rest/activity/notifications?apiVersion=2022-11-28#mark-notifications-as-read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math, sys | |
# Number of blocks to manipulate | |
nblocks = int(sys.argv[1]) | |
# Number of ways to order a stack of nstack blocks. | |
def orderings(nstack): | |
return math.factorial(nstack) | |
# Generate all partitions of nblocks. A partition of nblocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.signal as ss | |
tau = 2 * np.pi | |
# Filter coefficients from | |
# | |
# cs = ss.iirfilter(1, (990, 1010), btype='bandpass', output='sos', fs=48000) | |
# | |
# Filter coefficient order is b0, b1, b2, a0, a1, a0. Filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// egui hello world example, modified per | |
// https://www.reddit.com/r/learnrust/comments/v64f0q/egui_label_not_appearing/ | |
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | |
use csv::{self}; | |
use eframe::egui; | |
struct MyApp { | |
filename: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Local "Rust Playground" | |
# Bart Massey 2021 | |
# Requires `cargo-add` and this additional shell function: | |
# function rpl { | |
# DIR="`$HOME/bin/mi/rpl \"$@\"`" && | |
# echo "dir '$DIR'" >&2 && | |
# pushd $DIR && | |
# if [ -f src/main.rs ] | |
# then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Transform text to one-sentence-per-line format. | |
# Bart Massey 2021-01-20 | |
import re, sys | |
blank = re.compile("^[ \t]*$") | |
dot = re.compile("[.] ") | |
text = open(sys.argv[1], "r").read().splitlines() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/library/std/src/sys/unix/stack_overflow.rs b/library/std/src/sys/unix/stack_overflow.rs | |
index 1e8d1137ac8..eade97af5c6 100644 | |
--- a/library/std/src/sys/unix/stack_overflow.rs | |
+++ b/library/std/src/sys/unix/stack_overflow.rs | |
@@ -1,28 +1,26 @@ | |
#![cfg_attr(test, allow(dead_code))] | |
-use self::imp::{drop_handler, make_handler}; | |
+use crate::io; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Eq, PartialEq, Debug, Copy, Clone)] | |
pub struct U256([u8; 32]); | |
impl Into<u8> for U256 { | |
fn into(self) -> u8 { | |
for b in &self.0[0..31] { | |
assert_eq!(*b, 0); | |
} | |
self.0[31] | |
} |
NewerOlder