Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Based on https://stackoverflow.com/a/29079962/10955319
SOURCE_NS=$1
DEST_NS=$2
ZONE=$3
if [ "$SOURCE_NS" == "" ] || [ "$DEST_NS" == "" ] || [ "$ZONE" == "" ]
then
@adammcmaster
adammcmaster / panoptes-benchmark.sh
Last active June 19, 2020 15:05
Panoptes benchmarking
#!/bin/bash -e
ENDPOINT="${1:-https://panoptes-staging.zooniverse.org}"
export PANOPTES_CLIENT_ID=e094b63362fdef0548e0bbcc6e6cb5996c422d3a770074ef972432d57d41049c
CMD="panoptes -e ${ENDPOINT}"
echo "Running simultaneous full project listings..."
@adammcmaster
adammcmaster / project_cost_estimator.py
Created June 11, 2020 12:11
Estimating the cost of a list of projects
import datetime
import dateutil.parser
from panoptes_client import Panoptes, Project
PROJECT_IDS = (
10371,
10524,
11414,
@adammcmaster
adammcmaster / p4-ridges-automl-transform.py
Created January 14, 2020 16:13
A script to produce an AutoML training file from Zooniverse classifications for P4 Ridges
import csv
import json
import os
import re
subject_sets = {
'7585',
'7870',
'7888',
@adammcmaster
adammcmaster / org_workflow_stats.py
Created May 3, 2019 11:36
Print workflow stats for an organisation
"""
Requires panoptes-client and (on Python 2) futures.
pip install panoptes-client futures
"""
from panoptes_client import Panoptes, Organization
ORG_ID = 16
Panoptes.connect(
username='',
@adammcmaster
adammcmaster / strip_whitespace.py
Created October 5, 2018 15:34
Removing whitespace from existing subject metadata
from panoptes_client import Panoptes, Project
Panoptes.connect(
username='astopy',
password='',
admin=True,
)
processed = 0

Keybase proof

I hereby claim:

  • I am adammcmaster on github.
  • I am astopy (https://keybase.io/astopy) on keybase.
  • I have a public key whose fingerprint is CFA3 8B0E 8701 160B 96B2 5723 F592 0D1A 64A0 1E73

To claim this, I am signing this object:

@adammcmaster
adammcmaster / get_credited_names.py
Last active July 18, 2018 13:53
Get Panoptes credited names
# Requires panoptes-client 1.1 or newer
from panoptes_client import User
with open('login-names.txt') as users_f:
users = {u for u in (s.strip(' "\n') for s in users_f.readlines()) if not u.startswith('not-logged-in-')}
# A set comprehension inside a list() to weed out duplicates and then make it sortable
credited_names = list({u.credited_name for u in User.where(login=users)})
credited_names.sort()
@adammcmaster
adammcmaster / shax-total-lines-per-user.py
Created November 2, 2017 13:57
Generate a CSV file showing how many lines of transcription each user has submitted
import csv
import json
import sys
csv.field_size_limit(sys.maxsize)
line_count = {}
with open('shakespeares-world-classifications.csv') as f:
r = csv.DictReader(f)
import csv
INCLUDED_FIELDS = (
'classification_id',
'subject_ids',
'user_name',
'metadata',
'annotations'
)