Skip to content

Instantly share code, notes, and snippets.

View Johnetordoff's full-sized avatar

John Tordoff Johnetordoff

View GitHub Profile
/usr/local/bin/python3.9 /Users/johntordoff/osf_cookbook/unstaged_print.py
Checking unstaged files in repository: ../ember-osf-web
Unstaged files:
- config/environment.js
- mirage/config.ts
- mirage/scenarios/dashboard.ts
- mirage/views/search.ts
- tests/acceptance/institutions/dashboard-test.ts
- tests/acceptance/institutions/discover-test.ts
# Project Setup & Coordination Guide for Tech Lead
### Step 0: Knowing when you are a Tech Lead
- Your manger and director you are the Tech Lead and you are starting work then.
- If you are listed on documents as a Tech Lead, don't start acting as a Lead until you get explicit approval from your manager.
### Step 1: Create Project Slack Channel
To avoid confusion and ensure effective knowledge transfer between relevant parties, the first task as a Tech Lead is to create a Slack channel. This ensures that only relevant individuals are engaged in project execution and planning.
- **Channel Name:** The channel's name should follow the format `external-<project-name>`.
@Johnetordoff
Johnetordoff / gist:c8e46110361ab8e9e2c0e7117a9745a6
Created September 13, 2024 12:56
Testing instituional dashboard from no volume
How to test institutional dashboard locally from no volumes.
0. First ensure you have no pre-existing images or volumes, remove any you have, then pull images appropreaiate for
arm/amd, override elasticsearch6 if necesarry
1. Change Postgres env `POSTGRES_HOST_AUTH_METHOD: trust`
2. Start the postgres container `docker compose up -d postgres` and then enter bash inside of it. `docker compose exec postgres bash`
once in bash open postgres and create a new database for the OSF using `psql` to edit postgres.
```bash
root@14a01cd0126a:/# psql -Upostgres
postgres=# create database osf;
import unittest
from datetime import datetime
def is_leap_year(year):
return (year % 400 == 0) or (year % 100 != 0 and year % 4 == 0)
def calculate_leap_age(birthdate, current_date):
start_year = birthdate.year if birthdate.month > 2 else birthdate.year + 1
end_year = current_date.year - 1 if current_date.month < 2 or (current_date.month == 2 and current_date.day < 29) else current_date.year
return sum(is_leap_year(year) for year in range(start_year, end_year + 1))
from datetime import datetime
def is_leap_year(year):
return (year % 400 == 0) or (year % 100 != 0 and year % 4 == 0)
def calculate_leap_age(birthdate, current_date):
birthdate = datetime.strptime(birthdate, '%Y-%m-%d')
current_date = datetime.strptime(current_date, '%Y-%m-%d')
start_year = birthdate.year if birthdate.month > 2 else birthdate.year + 1
@Johnetordoff
Johnetordoff / gist:33b39ad275ccf7d5f3025ecfbc825d92
Created July 23, 2024 12:36
Built locally without libffi-dev
johntordoff@Johns-MacBook-Pro osf.io % docker build -t osf-py3
ERROR: "docker buildx build" requires exactly 1 argument.
See 'docker buildx build --help'.
Usage: docker buildx build [OPTIONS] PATH | URL | -
Start a build
johntordoff@Johns-MacBook-Pro osf.io % docker build -t osf-py3 .
[+] Building 8.0s (10/55) docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
{
"data": {
"id": "6z5qh",
"type": "preprints",
"attributes": {
"date_created": "2024-07-22T12:58:59.678577",
"date_modified": "2024-07-22T12:58:59.773680",
"date_published": "2024-07-22T12:58:59.765900",
"original_publication_date": null,
"doi": "10.123/9",
{
"data": [
{
"id": "refm5",
"type": "preprints",
"attributes": {
"date_created": "2024-07-22T12:48:42.497699",
"date_modified": "2024-07-22T12:48:42.603850",
"date_published": "2024-07-22T12:48:42.593816",
"original_publication_date": null,
{
"data":[
{
"type":"institutions",
"id":"668d6b40ef52ae0008dabe64"
},
{
"type":"institutions",
"id":"668d6b41ef52ae0008dabe65"
},
{
"data":[
{
"type":"institutions",
"id":"668407621f7f70000a72c7a2"
}
],
"links":{
"self":"http://localhost:8000/v2/preprints/vnbcp/",
"html":"http://localhost:8000/v2/preprints/vnbcp/institutions/"