Skip to content

Instantly share code, notes, and snippets.

View file_type_enum.jsonl
"name" : "FT ICR-MS analysis results",
"description" : "FT ICR-MS-based metabolite assignment results table",
"filter" : "{\"url\": {\"$regex\": \"nom\\\\/results\"}, \"description\": {\"$regex\": \"FT ICR-MS\"}}",
"id" : "nmdc:sys045mx19"
"name" : "GC-MS Metabolomics Results",
"description" : "GC-MS-based metabolite assignment results table",
"filter" : "{\"url\": {\"$regex\": \"metabolomics\\\\/results\"}}",
dwinston /
Created Jun 23, 2021
dagster resource in a sensor via preset definition run config
from dagster import (
ModeDefinition, PresetDefinition, resource, StringSource,
build_init_resource_context, RunRequest, sensor,
class ApiClient:
def __init__(self, base_url: str, site_id: str, client_id: str, client_secret: str):
self.base_url = base_url
self.site_id = site_id
self.client_id = client_id
dwinston /
Last active Feb 26, 2021
get all Zulip messages sent by non-bot users to public streams
A script developed to get all Zulip messages sent by non-bot users to public streams.
Need to pip install pymongo tqdm zulip, and run a local MongoDB server.
But you can also adapt the script to append to an in-memory Python list, and not need MongoDB or pymongo.
I found that the total volume of data in my case (see in-script comments) was 700MB uncompressed.
Developed at the Recurse Center ( in order to apply PageRank to Zulip entities.
Licensed as <>(year=2021, copyright_holder="Donny Winston").
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
dwinston /
Created Jul 8, 2019
Code that takes some Lisp code and returns an abstract syntax tree (AST). The AST represents the structure of the code and the meaning of each token.
Code that takes some Lisp code and returns an abstract syntax tree (AST).
My lisp knows about the following types of tokens:
- the expression delimiters `(` and `)`
- strings (delimited by quote characters)
- numbers
- boolean values `true` (corresponding to Python's `True`) and `false` (corresponding to Python's `False`)
- the null value `null` (corresponding to Python's `None`)
dwinston /
Last active Jul 16, 2020
bulk query of Materials Project data via pymatgen MPRester, and saving to local MongoDB
from pymatgen import MPRester
from pydash import chunk as get_chunks
except ImportError:
from math import ceil
def get_chunks(array, size=1):
chunks = int(ceil(len(array) / float(size)))
return [array[i * size:(i + 1) * size]
for i in range(chunks)]
dwinston /
Created Jan 19, 2018
Convert a CSV file of people to vCard files for updating iOS contacts
Convert a CSV file of the form
name, email, cell
First Last,, 800-555-1234
to vCard (vcf) files suitable for creating/updating iOS contacts.
Based on
dwinston /
Created Jan 11, 2018
Use dnspython library to validate an email domain via DNS MX, AAAA, and A records. A sanity check that avoids abusing the email server.
import re
import dns.resolver
def dns_check_email_domain(domain):
Query DNS records to verify that email server is possible on domain.
If no DNS records are found, user should confirm email address.
response = {}

Keybase proof

I hereby claim:

  • I am dwinston on github.
  • I am dwinston ( on keybase.
  • I have a public key ASDlWFACdSLc3gOp8yLr1jda7bFkjDYmEGY8MhBypnNiXgo

To claim this, I am signing this object:

dwinston /
Created Apr 3, 2017
Generate a password/passphrase that is just many words strung together
"""Generate n-word (default n=5) passwords separated by sep (default '-').
Uses your friendly neighborhood words file by default.
Simple Use: `python`
Help: `python --help`
import argparse
import random