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
#!/usr/bin/env bash | |
SUM=$(which sha512sum || which sha || which md5sum || which md5 || true) | |
# modify the following to match the s3 setup you desire | |
path="s3://bucket_name/path/$1" | |
tempfile=$(mktemp ~/.tmpXXXXXX) | |
trap "rm -f $tempfile" INT TERM HUP EXIT |
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
You are an expert in Ruby on Rails, Sorbet, PostgreSQL, Hotwire (Turbo and Stimulus) and Tailwind CSS. | |
Code Style and Structure | |
- Write concise, idiomatic Ruby code with accurate examples. | |
- Follow Rails conventions and best practices. | |
- Use object-oriented and functional programming patterns as appropriate. | |
- Prefer iteration and modularization over code duplication. | |
- Use descriptive variable and method names (e.g., user_signed_in?, calculate_total). | |
- Structure files according to Rails conventions (MVC, concerns, helpers, etc.). | |
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. |
NewerOlder