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
{% load i18n %} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title> | |
{% block head_title %} | |
{% endblock head_title %} | |
</title> |
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 | |
CURRENT_DIR=$(dirname "$0") | |
BASE_DIR=$CURRENT_DIR/../../.. | |
# Define output filename | |
OUTPUT_FILE="$BASE_DIR/site_static/site/js/combined.js" | |
echo "" > $OUTPUT_FILE |
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
{% load query_params_tags %} | |
<div class="grid md:grid-cols-12 grid-cols-1 mt-8"> | |
<div class="md:col-span-12 text-center"> | |
<nav aria-label="Page navigation example"> | |
<ul class="inline-flex items-center -space-x-px"> | |
{% if page_obj.has_previous %} | |
<li><a href="{% modify_query page=page_obj.previous_page_number %}" class="size-[40px] inline-flex justify-center items-center text-slate-400 bg-white dark:bg-slate-900 rounded-s-3xl hover:text-white border border-gray-100 dark:border-gray-800 hover:border-sky-600 dark:hover:border-sky-600 hover:bg-sky-600 dark:hover:bg-sky-600"><i class="uil uil-angle-left text-[20px] rtl:rotate-180 rtl:-mt-1"></i></a></li> | |
{% if page_obj.number > 3 %} | |
<li><a href="{% modify_query page=1 %}" class="size-[40px] inline-flex justify-center items-center text-slate-400 hover:text-white bg-white dark:bg-slate-900 border border-gray-100 dark:border-gray-800 hover:border-sky-600 dark:hove |
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
import base64 | |
from functools import wraps | |
from django.conf import settings | |
from django.http import HttpResponse | |
from django.utils.encoding import force_str | |
def basic_authentication(function): | |
@wraps(function) | |
def wrap(request, *args, **kwargs): |
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
#!/bin/bash | |
echo "Did you update the CHANGELOG.md and commit the changes? (y/N)" | |
read answer | |
if [[ $answer != "y" && $answer != "Y" ]]; then | |
echo "Please update and commit the changelog before building." | |
exit 1 | |
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
#!/bin/bash | |
# Get old and new versions | |
read -p "Enter old software version (major.minor.patch): " old_version | |
read -p "Enter new software version (major.minor.patch): " new_version | |
# Check if versions are valid | |
if ! [[ $old_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ || $new_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Invalid version format. Please enter in major.minor.patch format." | |
exit 1 |
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
import base64 | |
import ecdsa | |
def generate_vapid_keypair(): | |
""" | |
Generate a new set of encoded key-pair for VAPID | |
""" | |
pk = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p) | |
vk = pk.get_verifying_key() |
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 html.parser import HTMLParser | |
import requests | |
from pprint import pprint | |
class OpenGraphParser(HTMLParser): | |
""" | |
Parses the Open Graph tags and returns a dictionary with values: | |
For example, |
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
import re | |
from html.parser import HTMLParser | |
class HTMLStripper(HTMLParser): | |
# stackoverflow.com/questions/753052/strip-html-from-strings-in-python | |
def __init__(self): | |
super().__init__() | |
self.reset() | |
self.strict = False |
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
import re | |
from crispy_forms import layout, bootstrap | |
from crispy_forms.helper import FormHelper | |
from django import forms | |
from django.conf import settings | |
from django.contrib.auth import authenticate | |
from django.contrib.auth.forms import PasswordResetForm as PasswordResetFormBase | |
from django.contrib.auth.forms import SetPasswordForm as SetPasswordFormBase | |
from django.urls import reverse_lazy, reverse |
NewerOlder