Skip to content

Instantly share code, notes, and snippets.

View bnewbold's full-sized avatar

bnewbold

View GitHub Profile
@bnewbold
bnewbold / auth_jwt.go
Created June 12, 2024 01:46
example of doing atproto JWT service auth validation
package main
// copied from Jaz's https://github.com/ericvolp12/jwt-go-secp256k1
import (
"crypto"
"errors"
atcrypto "github.com/bluesky-social/indigo/atproto/crypto"
"github.com/golang-jwt/jwt/v5"
#!/usr/bin/env python3
"""
Script demonstrating how to create posts using the Bluesky API, covering most of the features and embed options.
To run this Python script, you need the 'requests' and 'bs4' (BeautifulSoup) packages installed.
"""
import re
import os

AT-URIs with DIDs are not "URLs". Can they be parsed using exiting libraries in popular programming langauges?

Typescript / Javascript

Typescript implementation (@atproto/uri) is implemented "from scratch".

Assuming that the "URL" class in the formal web platform does not work.

The popular url-parse NPM package works:

@bnewbold
bnewbold / atproto_crypography_march2023.md
Last active May 18, 2023 04:19
atproto Cryptography Notes (Spring 2023)

Cryptography in atproto and did:plc

Public key cryptography is used in several aspects of atproto ("AT Protocol"). This short, informal, not-very-official document clarifies some details of which specific systems, keys, serialization formats, and signing/verification procedures are used.

For folks who are already familiar with atproto, the quick things to note are:

  • yes, it is expected for everybody to support two curve types
  • take the SHA-256 hash of repo commit nodes before signing/verifying them
  • depending on library/language used, p256 may have quirks with "compressed" encoding
  • yes, DID documents do require two similar-but-different encodings for public keys (did:web and multibase)
@bnewbold
bnewbold / notes.md
Last active November 22, 2021 22:35
OpenAlex Journal Metadata

Running some quick initial metadata quality checks on OpenAlex Journal list. This is from the pre-release, dated in file names as 2021-10-11 (but announced in late November 2021).

Looking for ISSN-L dupes:

cat openalex-journals.txt | cut -f5 | rg '\-' | sort | uniq -d | wc -l
# 146

cat openalex-journals.txt | cut -f5 | rg '\-' | sort | uniq -D | wc -l

293

This is a list of raw "unstructured" citations extracted from the 2021-01 Crossref public metadata dump, which had issues when parsed with GROBID 0.7.

To clarify, these citation strings strings come directly from publishers, and were not extracted from PDFs. This subset of citations is biased in that neither the publisher nor Crossref made a successful match to an existing paper with a DOI.

The format of the list is the citation string followed by notes on the issue. Almost all of these were manually re-verified using a recent version of GROBID

@bnewbold
bnewbold / extract_refs.py
Created August 13, 2021 02:39
Quick bulk XML extraction of wikipedia references using mwxml and wikiciteparser
#!/usr/bin/env python3
import sys
import json
import mwxml
import mwtypes
import mwtypes.files
import mwparserfromhell
from wikiciteparser.parser import parse_citation_template
@bnewbold
bnewbold / rscvd_fatcat_check.py
Created April 17, 2021 00:17
RSCVD Fatcat Fuzzycat Lookup
#!/usr/bin/env/python3
"""
To run this script you need the 'fuzzycat' and 'elasticsearch' pip packages
installed (eg, 'pip install fuzzycat')
"""
import sys
import csv
import json
import elasticsearch
@bnewbold
bnewbold / gist:e3c2007c580d5c55c96efc145efc7eca
Created March 21, 2021 00:40
2020-03-16 to 2021-03-15 great meals
Monday March 23 french onion soup and butter miso carrots
Tuesday March 24 pasta al pesto genovese e asparago
Thursday April 2 Coronation chickpeas and yogurt tomatoes
Friday April 3 queso fondido
Sunday April 5 Sun-dried tomato almond pesto pasta
Monday April 6 gua bao! (割包)
Wednesday April 8 okonomiyaki
Friday April 10 broccoli pesto pasta + burrata salad
Sunday April 12 veggie reuben
Thursday April 16 pipian pascal
#!/usr/bin/env python3
"""
Depends on:
- articlemetaapi
Refs:
- https://github.com/scieloorg/articlemetaapi/blob/master/articlemeta/client.py
- https://github.com/scieloorg/xylose/blob/master/xylose/scielodocument.py
"""