Skip to content

Instantly share code, notes, and snippets.

Carol (Nichols || Goulding) carols10cents

Block or report user

Report or block carols10cents

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dig
$ dig -t ns crates.io
; <<>> DiG 9.10.6 <<>> -t ns crates.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25517
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
@carols10cents
carols10cents / crate-publish.md
Last active Dec 2, 2019
Current and proposed crate publish procedure in diff format
View crate-publish.md

Proposed

Notes

  • We enforce a 50MB max in nginx
  • We should add a configuration entry for the global max size of the metadata (we currently use max tarball size several places)
  • A few guidelines I tried to follow:
    • Identify and reject invalid requests as quickly as possible.
    • Minimize the work done while holding a database connection, especially after entering the main transaction.
    • The final main transaction may need to repeat some queries to ensure it doesn't rely on data obtained outside of the transaction.
@carols10cents
carols10cents / playground.rs
Last active Oct 31, 2018 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
fn save_status(text: &str) -> Result<i64, &'static str> {
if text.len() > 200 {
return Err("status is too long, must be under 200 bytes");
}
let id = save_to_database(text)?;
// log id to server logs
View test.rs
fn main() {
let s = String::from("book");
// Add code here that calls the pluralize function
println!(
"I have one {}, you have two {}",
s,
you_add_something_here,
);
View gist:b29aef239f0264e96dd3939a5531cae3

I currently have this working diesel code:

    let recent_downloads = sql::<Nullable<BigInt>>("SUM(crate_downloads.downloads)");
    let most_recently_downloaded = crates
        .left_join(
            crate_downloads::table.on(id.eq(crate_downloads::crate_id)
                .and(crate_downloads::date.gt(date(now - 90.days())))),
        )
        .group_by(id)
@carols10cents
carols10cents / abstract.md
Created Dec 3, 2017
Morgantown codes abstract
View abstract.md

What is this Rust thing anyway?

Rust is a new systems programming language out of Mozilla research aiming to be a safer alternative to C and C++ without sacrificing performance. Come learn how Rust prevents buffer overflows, ensures memory safety, and prevents data races while also providing modern development workflows through Cargo and an ever-growing ecosystem of open source libraries on Crates.io. Hear about how companies like Mozilla, npm, Dropbox, and Chucklefish are using Rust to make better software. Discover how you can get involved with Rust's friendly community!

View gist:cc1009a3cc29a5a11790f68a12d88410
curl 'https://api.github.com/teams/866115/memberships/Manishearth' -H 'Accept: application/vnd.github.v3+json' -H 'User-Agent: hello!' -H 'Authorization: token INSERTTOKENHERE'
@carols10cents
carols10cents / output.json
Created Sep 26, 2017
Part of the output of `cargo build --message-format=json` for a project with `src/bin/server.rs`
View output.json
{
"features":[],
"filenames":["/Users/carolnichols/rust/crates.io/target/debug/server"],
"fresh":false,
"package_id":"cargo-registry 0.2.1 (path+file:///Users/carolnichols/rust/crates.io)",
"profile":{"debug_assertions":true,"debuginfo":2,"opt_level":"0","overflow_checks":true,"test":false},
"reason":"compiler-artifact",
"target":{
"crate_types":["bin"],
"kind":["bin"],
View gist:114003a9a80409dcc2dc0dce06108346
{:timeout,
{GenServer, :call,
[BorsNG.GitHub,
{:synthesize_commit, {{:installation, 42672}, 21365581},
{%{branch: "staging.tmp", commit_message: "[ci skip]",
parents: ["314f793078cf83b535700686fd12e47ceee4b0c3"],
tree: "c4b1dd792ff25424a26818434dcfa6df68c9070b"}}},
5000]}}
View gist:48e495198f329e52f74978c59b094581
select count(distinct crate_owners.owner_id)
from crates
join crate_owners
on crates.id = crate_owners.crate_id
where date(crates.created_at) >= '2016-05-15'
and crate_owners.owner_id NOT IN (
select distinct crate_owners.owner_id
from crates
join crate_owners
on crates.id = crate_owners.crate_id
You can’t perform that action at this time.