Skip to content

Instantly share code, notes, and snippets.

View jayrbolton's full-sized avatar
🍕

Jay R Bolton jayrbolton

🍕
View GitHub Profile
@jayrbolton
jayrbolton / jgi_readqc.wdl
Created March 25, 2019 17:20
jgi qc pipeline for shifter
workflow jgi_read_qc
{
File raw_fastq
Array[String] sketch_dbs = [ "nt", "refseq", "silva" ]
call subsample
{
input:
infile=raw_fastq
}

List-of-counters UI challenge for evaluating frameworks

Stage 1

Create a counter component with

  • Some text displaying total count
  • An "increment" button
  • A "decrement" button

Stage 2

# A task is a docker image, a command, and optional hardware prefs
# A pipeline is a collection of sequential or parallel tasks with a shared volume mount
# Pipelines are submitted to HTCondor
# A small application layer would handle the job submission to HTCondor,
# pulling docker images and running containers with correct mounts and settings
# Define an HTCondor job with a docker image, command, and node requirements or preferences
subsample = Task(
image='jgi/subsample',
# Define a docker workflow (independent of KBase)
# - output and input files
# - minimum node requirements for a job
# - whether to exit on any failure or continue on failure
# - pass through environment variables
# - htcondor, etc backend
# - automatically figure out serial and concurrent execution based on task input and output
def subsample():
Simple doc fetch
{
coll: "wsprov_object",
keys: ["1:2:3"],
user_ids: [],
page_limit: 10
}
produces aql:
@jayrbolton
jayrbolton / counters.js
Last active January 3, 2019 22:45
counter list example
const Component = require('..')
const h = require('../h')
// A single counter that can be incremented and decremented
const Counter = function (start) {
return Component('div', {
count: start,
add: ({ count }, n) => ({ count: count + n }),
view: ({ count, add }) => {
return h('div', [
@jayrbolton
jayrbolton / readable-regexes.md
Last active December 20, 2018 01:43
readable regexes

Regexes could be a lot more readable with a little bit more verbosity

  • Match characters in single quotes
  • Use plain keywords for groups of chars (like whitespace)
  • Slightly alter some syntax to make more explicit

Match an exact string with single quotes: 'hello world'

Match either strings: 'hello' | 'world' (matches 'hello' or 'world')

JSON generated by markdown

One downside of JSON is it is not very readable, especially when used as a configuration language.

To fix this, we can embed JSON data in a markdown file using a certain format that is readable and commentable. A script takes the markdown file and converts it into one or more JSON files.

Define the start of a JSON file in your markdown with a header that is a link to a local json file, such as:

## [my_config.json](my_config.json)

Simple spec for small HTTP JSON APIs using JSON Schema

Throughout the spec we use JSON schema documents

Documentation

/docs serves a list of your endpoints.

["products", "orders", "customers"]