Skip to content

Instantly share code, notes, and snippets.

View asencis's full-sized avatar

asencis asencis

View GitHub Profile
@asencis
asencis / greek-alphabet.json
Last active March 9, 2021 16:30
Entire Greek Alphabet: Names, Display, Unicode Number & HTML Code (Capital & Small)
[
{
"name": "Alpha",
"capital": {
"display": "A",
"unicode": "U+0391",
"html": "Α"
},
"small": {
"display": "α",
@asencis
asencis / languages_iso_639-1.html
Created March 2, 2021 12:06
Languauge ISO 639-1 Codes Select HTML Example
```html
<select
id="languagesISO639-1"
name="languagesSelect"
>
<option value="af">Afrikaans</option>
<option value="sq">Albanian - shqip</option>
<option value="am">Amharic - አማርኛ</option>
<option value="ar">Arabic - العربية</option>
<option value="an">Aragonese - aragonés</option>
@asencis
asencis / datasets.types.json
Created February 25, 2021 15:12
Datacite Dataset Type Object
{
"types": {
"resourceTypeGeneral": "Dataset",
"resourceType": "Dataset",
"schemaOrg": "Dataset",
"citeproc": "dataset",
"bibtex": "misc",
"ris": "DATA"
}
}
@asencis
asencis / collection.types.json
Created February 25, 2021 15:04
Datacite Collection Type Object
{
"types": {
"resourceTypeGeneral": "Collection",
"resourceType": "Report",
"schemaOrg": "Collection",
"citeproc": "report",
"bibtex": "misc",
"ris": "GEN"
}
}
@asencis
asencis / orcidRegex.js
Last active June 23, 2022 17:18
ORCID Identifier Regex
const isORCID = (identifier) => {
return identifier.length > 0 && /(\d{4}-){3}\d{3}(\d|X)/.test(identifier)
}
@asencis
asencis / django_migrations.sh
Created January 13, 2021 09:41
Django migrations hell? Try truncating `django_migrations` table.
#!/bin/sh
# docker-compose -f docker-compose.asencis.development.yml --env-file .env.development exec web python manage.py dbshell -- -c 'TRUNCATE django_migrations;'
# docker-compose -f docker-compose.asencis.development.yml --env-file .env.developemt exec web python manage.py migrate --plan
python manage.py dbshell -- -c 'TRUNCATE django_migrations;'
python manage.py migrate --plan
# Once we have the migrations "plan" of execution...migrate first, if error, use the --fake flag, e.g.:
python manage.py migrate auth 0001_initial
@asencis
asencis / Dockerfile
Created January 7, 2021 09:57
Python Application Sample Dockerfile
# Inherit from the Python 3.9.1 slim buster Docker image
FROM python:3.9.1-slim-buster
# Set the working directory
WORKDIR /app
# Install application dependencies
COPY ./requirements.txt ./
RUN pip install -r requirements.txt
@asencis
asencis / 2.md
Last active December 11, 2020 15:26
Django’s ORM and Database Migrations
@asencis
asencis / 1.md
Last active December 11, 2020 11:15
The anatomy of a Django application (settings.py, urls.py)

The anatomy of a Django application (settings.py, urls.py, wsgi.py, asgi.py)

References: settings.py

settings.py

The settings.py file gives us an extremely convenient way to define project level configurations. This is where we define databases, email providers, error logging, caching backends, message brokers, default file storage etc.

A common setting is the DEBUG paramater:

@asencis
asencis / datacite_4.3.1_schema.json
Created October 6, 2020 10:29
Proposed Datacite kernel-4.3(.1) Schema amendment
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"nameType": {
"type": "string",
"enum": [
"Organizational",
"Personal"
]