This file contains hidden or 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
| : {org:?"need to set an org name"} | |
| : {max_pages:?"need to set maximum number of pages"} | |
| for PAGE in $( seq $max_pages ); do | |
| gh api ‘orgs/$org/repos?per_page=100&page=‘“$PAGE” | jq -r ‘map(.name) | .[]' | while read NAME; do | |
| git clone “git@github.com:$org/$NAME” | |
| done |
This file contains hidden or 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(Debug)] | |
| struct Resource(i32); | |
| impl Drop for Resource { | |
| fn drop(&mut self) { | |
| println!("goodbye from {}", self.0); | |
| } | |
| } | |
| enum Error { |
This file contains hidden or 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
| use libc; | |
| #[derive(Debug)] | |
| #[repr(C)] | |
| struct Resource(i32); | |
| impl Drop for Resource { | |
| fn drop(&mut self) { | |
| println!("goodbye from {}", self.0); | |
| } |
This file contains hidden or 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
| for f in $(git diff --name-only topic/foo) ; do git --no-pager log -z --pretty=format:"$f was last touched by %cn %cr%n" $f | head -1; done |
This file contains hidden or 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
| suffix="js" | |
| for f in $(rg -lt $suffix . src | xargs basename | sed -e "s/\.$suffix//"); do | |
| count=$(rg $f -l | wc -l | xargs ); | |
| if [ $(( $count )) -eq 1 ] || [ $(( $count )) -eq 0 ]; then | |
| echo "count: $count file: $f"; | |
| fi; | |
| done |
This file contains hidden or 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
| #![feature(step_trait)] | |
| #![feature(step_trait_ext)] | |
| // This is unsightly. | |
| use std::iter::Step; | |
| #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Clone)] | |
| enum Thing { | |
| One, |
This file contains hidden or 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
| // NB. this must be placed at the top of the module. | |
| #![feature(test)] | |
| #[cfg(test)] | |
| mod tests { | |
| extern crate test; | |
| use super::*; | |
| use test::{black_box, Bencher}; |
This file contains hidden or 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
| use tokio::net::{TcpListener, TcpStream}; | |
| struct Server { | |
| listener: TcpListener, | |
| } | |
| #[derive(Debug)] | |
| enum Error { | |
| IoError(std::io::Error), | |
| } |
This file contains hidden or 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
| trait Fruit { | |
| fn accept<A: FruitVisitor>(self, visitor: &mut A); | |
| } | |
| #[derive(Debug)] | |
| struct Orange; | |
| #[derive(Debug)] | |
| struct Apple; | |
| #[derive(Debug)] | |
| struct Banana; |
This file contains hidden or 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
| # Description: Static linking of rustc on debian buster with glibc. | |
| # Notes: | |
| # * Obligatory rustc docs: https://doc.rust-lang.org/reference/linkage.html | |
| # * proc-macro does not seem to work with static linking, regardless of libc flavor. | |
| # cf. https://github.com/rust-lang/cargo/issues/7563#issuecomment-553526254 | |
| # * traditionally, to perform static linking static libraries are needed, hence the libgcc-8-dev install below. | |
| # * static linking is the default with musl and rustc afaict, hence builds on, say, alpine | |
| # should automatically be static, whereas for glibc we need to pass `-C target-feature=+crt-static` | |
| # to `RUSTFLAGS`. You can alternatively place this in your `Cargo.toml` under the `rustflags` key, e.g. | |
| # ``` |