Skip to content

Instantly share code, notes, and snippets.

View carols10cents's full-sized avatar

Carol (Nichols || Goulding) carols10cents

View GitHub Profile
@carols10cents
carols10cents / c#-to-rust.md
Last active April 18, 2024 22:55
C# to Rust Cheat Sheet

Thanks to @seejee for making this for me!!!

C# to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in C# and Rust so that programmers most comfortable with C# can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

curl -vL https://crates.io/api/v1/crates/carol-is-not-a-crate/0.1.0/download
* Trying [2600:9000:2508:3800:c:7ed3:240:93a1]:443...
* Connected to crates.io (2600:9000:2508:3800:c:7ed3:240:93a1) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
@carols10cents
carols10cents / javascript-to-rust-cheat-sheet.md
Last active October 28, 2023 07:57
JavaScript to Rust Cheat Sheet

JavaScript to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in JavaScript and Rust so that programmers most comfortable with JavaScript can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

JavaScript:

$ docker run -it --rm -p 6831:6831/udp -p 16686:16686 jaegertracing/all-in-one --log-level=debug
2022/10/20 19:35:47 maxprocs: Leaving GOMAXPROCS=5: CPU quota undefined
{"level":"info","ts":1666294547.076985,"caller":"flags/service.go:119","msg":"Mounting metrics handler on admin server","route":"/metrics"}
{"level":"info","ts":1666294547.0770223,"caller":"flags/service.go:125","msg":"Mounting expvar handler on admin server","route":"/debug/vars"}
{"level":"info","ts":1666294547.0771093,"caller":"flags/admin.go:129","msg":"Mounting health check on admin server","route":"/"}
{"level":"info","ts":1666294547.0771375,"caller":"flags/admin.go:143","msg":"Starting admin HTTP server","http-addr":":14269"}
{"level":"info","ts":1666294547.0771465,"caller":"flags/admin.go:121","msg":"Admin server started","http.host-port":"[::]:14269","health-status":"unavailable"}
{"level":"info","ts":1666294547.0780103,"caller":"memory/factory.go:66","msg":"Memory storage initialized","configuration":{"MaxTraces":0}}
{"level":"info",
Uploading carol-test v2.2.2 (/private/tmp/poop/carol-test)
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * Trying 108.138.64.83:443...
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * Connected to crates.io (108.138.64.83) port 443 (#0)
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * ALPN, offering h2
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * ALPN, offering http/1.1
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * successfully set certificate verify locations:
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * CAfile: /etc/ssl/cert.pem
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * CApath: none
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * (304) (OUT), TLS handshake, Client hello (1):
[2022-10-14T20:46:52Z DEBUG cargo::ops::registry] http-debug: * (304) (IN), TLS handshake, Server hello (2):
SELECT crates.name, created_date, num_versions
FROM (
SELECT crate_id, date_trunc('day', versions.created_at) AS created_date, count(1) as num_versions
FROM versions
GROUP BY crate_id, created_date
HAVING count(1) > 10
) AS foo
INNER JOIN crates ON foo.crate_id = crates.id
ORDER BY num_versions DESC
;
@carols10cents
carols10cents / crates-many-versions.txt
Created October 8, 2022 02:37
Crates that have ever had a day publishing more than 10 versions
a11ywatch_cli
actix-web-utils
advent-of-code
advent_of_code_rs
afk
air-interpreter-wasm
air-interpreter-wasm_security_tetraplets_reborn
apca
armory_lib
arrows
@carols10cents
carols10cents / gist:58a4fcf4ab4e1483ad5b4e4f5c01b0f8
Created December 17, 2021 15:37
rustc debugging logs of evaluate_obligation
┐rustc_trait_selection::traits::query::evaluate_obligation::evaluate_obligation obligation=Obligation(predicate=Binder(TraitPredicate(<std::future::from_generator::GenFuture<[static gener
ator@src/main.rs:586:28: 589:2]> as std::marker::Send>, polarity:Positive), []), depth=9)
├─0ms DEBUG rustc_query_system::query::plumbing ty::query::get_query<evaluate_obligation>(key=Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVar
Info { kind: Region(U0) }], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(OutlivesPredicate(ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrAnon(0) }), ReL
ateBound(DebruijnIndex(1), BoundRegion { var: 1, kind: BrAnon(1) })), []), Binder(OutlivesPredicate(S14, ReLateBound(DebruijnIndex(1), BoundRegion { var: 1, kind: BrAnon(1) })), [])], rev
eal: UserFacing, constness: NotConst }, value: Binder(TraitPredicate(<std::future::from_generator::GenFuture<[static generator@src/main.rs:586:28: 589:2]> as std::marker::Send>, pola
@carols10cents
carols10cents / gist:89900a262c57ce812ee7fd00030aee0f
Created November 18, 2021 20:22
Building 2 crates that depend on the same features of tokio; tokio gets recompiled. All log lines that contain "tokio"
❯ CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo test -v -p client_util
[2021-11-18T19:39:02Z DEBUG cargo::core::compiler::fingerprint] old local fingerprints deps "/Users/carolnichols/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.14.0" precalculated="1.14.0"
[2021-11-18T19:39:02Z DEBUG cargo::core::compiler::fingerprint] failed to get mtime of "/Users/carolnichols/rust/influxdb_iox/target/debug/build/tokio-5758515f8236298f/build_script_build-5758515f8236298f": failed to stat `/Users/carolnichols/rust/influxdb_iox/target/debug/build/tokio-5758515f8236298f/build_script_build-5758515f8236298f`
[2021-11-18T19:39:02Z DEBUG cargo::core::compiler::fingerprint] failed to get mtime of "/Users/carolnichols/rust/influxdb_iox/target/debug/build/tokio-b5b44448e013bb01/output": failed to stat `/Users/carolnichols/rust/influxdb_iox/target/debug/build/tokio-b5b44448e013bb01/output`
[2021-11-18T19:39:02Z DEBUG cargo::core::compiler::fingerprint] max output mtime for "/Users/carolnichols/.cargo/registry/s
@carols10cents
carols10cents / ruby-to-rust-cheat-sheet.md
Last active November 24, 2020 23:12
Ruby to Rust Cheat Sheet

Ruby to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in Ruby and Rust so that programmers most comfortable with Ruby can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

Ruby: