Skip to content

Instantly share code, notes, and snippets.

View jcdyer's full-sized avatar

Cliff Dyer jcdyer

View GitHub Profile
@jcdyer
jcdyer / Cliff's Christmas List 2023
Last active December 22, 2023 22:54
Cliff's Christmas List 2023
Climbing gear:
Quickdraws -- 6 @ 11cm, 4 @ 18cm https://hownot2.store/products/orbit-mixed-express-ks
Alpine draws -- 2 @ 60cm https://hownot2.store/products/miniwire-alpine-draw
Dyneema sling -- 2 @ 120cm https://hownot2.store/products/dyneema-sling-8mm?variant=46378769252667
Dorothy Dunnett, The ringed castle (book 5) https://www.regulatorbookshop.com/book/9780525565284
Dorothy Dunnett, Checkmate (book 6) https://www.regulatorbookshop.com/book/9780525565291
2 tickets to one of:
@jcdyer
jcdyer / pkg.py
Created March 17, 2022 15:41
Test gist loading
def add_and_double(x, y):
return 2 * (x + y)
@jcdyer
jcdyer / ownedgtins.rs
Created February 14, 2020 15:04
Type-enforced permission system
use gs1::Gtin;
pub mod owned {
use gs1::Gtin;
// This is constructed as a newtype wrapper around Gtin that only exists
// to prove that the GTIN belongs to the currently logged-in user.
#[derive(Debug, Clone)]
pub struct OwnedGtin(Gtin);
@jcdyer
jcdyer / rawbson.rs
Last active October 24, 2019 20:55
rawbson prototype
use std::borrow::Cow;
use std::convert::TryInto;
enum BsonType {
String,
Document,
Array,
}
impl BsonType {
@jcdyer
jcdyer / README.md
Last active August 14, 2019 18:59
Rust exercise 1: Extension trait

Here's a fun smallish, intermediate level rust exercise: Implement an extension trait that allows you to call .skipping(n) on an iterator, and only yield every nth item, starting with the first one. (An extension trait is one that adds functionality to anything that already implements a existing trait, usually one in std).

It should pass the test below.

Here are some hints if you need help:

  1. For examples of how to implement Iterator combinators, see the documentation (especially the src link) for the std::iter::Take struct, and the Iterator::take() method (or any of the other iterator combinator methods.
  2. For examples of how to implement an extension trait, see the excellent byteorder crate (by Andrew Gallant, a.k.a. BurntSushi), and its ReadBytesExt and WriteBytesExt traits, which let you read and write integers of different sizes
[package]
name = "hops"
version = "0.1.0"
authors = ["J. Cliff Dyer <jcd@sdf.org>"]
[dependencies]
bytes = "*"
clap = "*"
futures = "*"
rand = "*"
@jcdyer
jcdyer / Cargo.toml
Last active August 19, 2021 00:36
Updated for v 0.12.0
[package]
name = "edge"
version = "0.1.0"
authors = ["J. Cliff Dyer <jcd@sdf.org>"]
[dependencies]
indradb = "0.12.0"
indradb-lib = "0.12.0"
serde_json = "*"
uuid = "*"
@jcdyer
jcdyer / keybase.md
Created February 23, 2018 16:58
keybase.md

Keybase proof

I hereby claim:

  • I am jcdyer on github.
  • I am jcdyer (https://keybase.io/jcdyer) on keybase.
  • I have a public key ASAPhLGO0eSvrDxJPWV_c0wAXZhdWtRTaD7P42OyX2LftQo

To claim this, I am signing this object:

@jcdyer
jcdyer / Cargo.toml
Created June 29, 2017 23:46
Hello command line
[package]
name = "hello"
version = "0.1.0"
authors = ["J. Cliff Dyer <jcd@sdf.org>"]
[dependencies]
clap = "~2"
@jcdyer
jcdyer / settings.py
Last active July 7, 2016 21:09
CodeJail django configurataion
import codejail.languages
CODE_JAIL = {
'jails': [
{
'command': 'python',
'bin_path': '/edx/app/edxapp/venvs/edxapp-sandbox/bin/python',
'user': 'sandbox',
'lang': codejail.languages.python2,
},