Skip to content

Instantly share code, notes, and snippets.

View b5's full-sized avatar
💭
use of moved value

Brendan O'Brien b5

💭
use of moved value
View GitHub Profile
@b5
b5 / github_golang_api_v4.gql
Created November 24, 2022 23:00
GraphQL Example: Fetch stargazers at "go" topic
query ($cursor: String) {
topic(name: "go") {
repositories(
after: $cursor
first: 100
orderBy: {field: STARGAZERS, direction: DESC}
) {
totalCount
pageInfo {
endCursor
@b5
b5 / cr_to_crlf_replacer.go
Created February 27, 2018 00:18
Dealing with Solo Carriage Returns in csv.Reader
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"encoding/csv"
)
@b5
b5 / wnfs_private_file_walkthrough.go
Created August 20, 2021 19:07
constructing a private file in WNFS v2
package wnfs
import (
"context"
"testing"
mockipfs "github.com/qri-io/wnfs-go/ipfs/mock"
"github.com/qri-io/wnfs-go/mdstore"
)
@b5
b5 / skylark_transformations_tutorial.md
Created June 11, 2018 15:57
Qri Skylark Transformations Tutorial

Qri ("query") is about datasets. A transformion is a repeatable script for generating a dataset. Skylark is a scripting langauge from Google that feels a lot like python. This package implements skylark as a transformation syntax. Skylark tranformations are about as close as one can get to the full power of a programming language as a transformation syntax. Often you need this degree of control to generate a dataset.

Typical examples of a skylark transformation include:

  • combining paginated calls to an API into a single dataset
  • downloading unstructured structured data from the internet to extract
  • re-shaping raw input data before saving a dataset

We're excited about skylark for a few reasons:

  • python syntax - many people working in data science these days write python, we like that, skylark likes that. dope.
  • deterministic subset of python - unlike python, skylark removes properties that reduce introspection into code behaviour
@b5
b5 / main.go
Last active June 22, 2020 21:54
"local" dsync
package main
import (
"bufio"
"context"
"os"
"path/filepath"
coreiface "github.com/ipfs/interface-go-ipfs-core"
"github.com/qri-io/dag/dsync"

Log

Qri is a version control system (VCS) for datasets. Since most VCS's provide some system for collaborating, we aim to do the same. Collaboration within the context of a version control system means coordinating who has done what. Providing tools to syncronize collaborator's actions is a prerequisite for working together effectively.

The characteristics we want:

  • provide a foundation for about version histories.
  • trak & map to human names
  • Decentralized.
  • Offline first. Accomodate sync lags that may be years in length
  • as-small-as-possible storage footprint, size must be calculatable
load("http.star", "http")
load("bsoup.star", "bsoup")
baseUrl = "http://www.lawhelp.org"
def download(ctx):
soup, rows = fetch_page(baseUrl + '/dc/find-legal-help/directory/')
pages = page_links(soup)
@b5
b5 / gov.noaa.esrl-walk.job.json
Last active April 24, 2019 15:35
github.com/qri-io/walk job
{
"Seeds": [
"https://esrl.noaa.gov/"
],
"SeedsPath": "",
"Crawl": true,
"Domains": [
"https://esrl.noaa.gov/"
],
"IgnorePatterns": null,
@b5
b5 / gov.epa.yosemite-walk.job.json
Created April 24, 2019 15:28
github.com/qri-io/walk job
{
"Seeds": [
"https://yosemite.epa.gov"
],
"SeedsPath": "",
"Crawl": true,
"Domains": [
"https://yosemite.epa.gov"
],
"IgnorePatterns": null,
@b5
b5 / labels.json
Created February 27, 2019 17:41
qri github labels
[
{
"name": "bug",
"color": "ee0701"
},
{
"name": "chore",
"color": "14272D"
},
{