This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker | |
docker exec -it -u0 containerid bash | |
# compose | |
docker compose run --rm -u0 serviceid bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "common_name": "blue tit", "genus": "cyanistes", "species": "caeruleus", "bto_species_code": "bluti" }, | |
{ "common_name": "great tit", "genus": "parus", "species": "major", "bto_species_code": "greti" }, | |
{ "common_name": "coal tit", "genus": "periparus", "species": "ater", "bto_species_code": "coati" }, | |
{ "common_name": "marsh tit", "genus": "poecile", "species": "palustris", "bto_species_code": "marti" }, | |
{ "common_name": "nuthatch", "genus": "sitta", "species": "europaeus", "bto_species_code": "nutha" }, | |
{ "common_name": "great spotted woodpecker", "genus": "dendrocopos", "species": "major", "bto_species_code": "grswo" }, | |
{ "common_name": "goldcrest", "genus": "regulus", "species": "regulus", "bto_species_code": "goldc" }, | |
{ "common_name": "goldfinch", "genus": "carduelis", "species": "carduelis", "bto_species_code": "goldf" }, | |
{ "common_name": "blackbird", "genus": "turdus", "species": "merula", "bto_species_code": "blabi" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start from a small, trusted base image with the version pinned down | |
FROM ruby:2.5-slim-stretch AS base | |
# Install system dependencies required both at runtime and build time | |
# The image uses Postgres but you can swap it with mariadb-dev (for MySQL) or sqlite-dev | |
RUN apt-get update && \ | |
apt-get install --no-install-recommends -y \ | |
build-essential \ | |
# git is required for installing gems from git repos | |
git \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: sidekiq 6+ introduces new `.scan` method on Sets, use this when the version matches | |
# https://github.com/mperham/sidekiq/wiki/API#scan | |
# e.g. rs = Sidekiq::RetrySet.new, rs.scan('string-to-look-for') | |
# ----------------------------------------------------------------------- | |
# remove any old jobs that won't finish and are in the DEAD set / Morgue | |
rs = Sidekiq::RetrySet.new | |
jobs_to_remove_from_retry = rs.select do |job| | |
# 'workflow_attached_image' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from azure.core.credentials import AzureKeyCredential | |
from azure.search.documents import SearchClient | |
from urllib.parse import urlparse | |
from progress.bar import Bar | |
from sys import platform | |
import re | |
import subprocess | |
import mimetypes | |
import sys | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflow_ids = [] | |
subject_set_ids = [] | |
workflow_ids.map do |wf_id| | |
subject_set_ids.map do |set_id| | |
set_subject_ids = SetMemberSubject.where(subject_set_id: set_id).pluck(:subject_id) | |
# UNCOMMMENT ONE OF THESE, I DO A SANITY CHECK COUNT FIRST, THEN UNRETIRE | |
# run a count for sanity check | |
# SubjectWorkflowStatus.where.not(retired_at: nil).where(workflow_id: wf_id, subject_id: set_subject_ids).count | |
# RUN THE UNRETIRE | |
SubjectWorkflowStatus.where.not(retired_at: nil).where(workflow_id: wf_id, subject_id: set_subject_ids).update_all(retired_at: nil, retirement_reason: nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
creds="$basicUsername:$basicPassword" | |
host="https://designator.zooniverse.org/api/workflows" | |
if [ -n "$1" ]; then | |
curl -v --user $creds -X POST "${host}/${1}/unlock" | |
curl -v --user $creds -X POST "${host}/${1}/reload" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Zooniverse Public Stream Debug</title> | |
<script src="https://js.pusher.com/5.1/pusher.min.js"></script> | |
</head> | |
<body> | |
<h1>Zooniverse Public Stream Debug</h1> | |
<p> | |
See the console log statements for the json event payloads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. The underlying cause of the issue | |
# ~17:00-17:30 on Friday 18th October, 2019 | |
# the commands I used to work on the translation fix issue | |
# fix the workflow strings for an older survey task (missing descriptions) | |
# https://www.zooniverse.org/lab/3040/workflows/2485 | |
workflow = Workflow.find 2485 | |
tasks = workflow.tasks | |
task_string_extractor = TasksVisitors::ExtractStrings.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select id, tasks --(kv.value -> 'type') | |
from | |
workflows w, | |
jsonb_each(w.tasks) kv | |
WHERE kv.value -> 'type' = '"single"' | |
AND id IN ( | |
select id FROM | |
(SELECT id, (SELECT COUNT(*) FROM jsonb_object_keys(tasks)) as keys FROM workflows)as keys_tuple | |
WHERE keys = 1 | |
) |
NewerOlder