polishing

This commit is contained in:
2023-08-08 23:47:23 +03:00
parent b162a6ed10
commit a149ad95d8
10 changed files with 36 additions and 30 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ tags = ["tutorial", "Django", "Python", ".emv"]
Managing the Django SECRET_KEY variable. Managing the Django SECRET_KEY variable.
<!--more--> <!-- more -->
The Django `SECRET_KEY` variable is very crucial to your Django application. The secret key must be a large random value and it must be kept secret. Leaking this value to unauthorized people could lead to a security breach. The SECRET_KEY is used in Django for cryptographic signing. It is used to generate tokens and hashes, they can be recreated using this variable. If it is not configured Django throws a `django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty` error The Django `SECRET_KEY` variable is very crucial to your Django application. The secret key must be a large random value and it must be kept secret. Leaking this value to unauthorized people could lead to a security breach. The SECRET_KEY is used in Django for cryptographic signing. It is used to generate tokens and hashes, they can be recreated using this variable. If it is not configured Django throws a `django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty` error
+2 -2
View File
@@ -8,7 +8,7 @@ tags = ["hugo", "blog", "Go"]
How it begins How it begins
<!--more--> <!-- more -->
In this post-web2.0 age, people seem to blog less and less, and blogs seem to be dying slowly. People are separated in different Apps where the content is not searchable by search engines. In this post-web2.0 age, people seem to blog less and less, and blogs seem to be dying slowly. People are separated in different Apps where the content is not searchable by search engines.
@@ -27,7 +27,7 @@ Mostly random stuff and a few tutorials. I'll see where this goes.Although some
I use hugo as a static site generator.After trying a couple of blogging platforms and trying to build a few from scratch I decided to I use hugo as a static site generator.After trying a couple of blogging platforms and trying to build a few from scratch I decided to
throw in the towel and opt in for a ready made solution, no need reinventing the wheel. throw in the towel and opt in for a ready made solution, no need reinventing the wheel.
Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again.Hugo provides a robust theming system that is easy to implement but capable of producing even the most complicated websites.Hugo's Go-based templating provides just the right amount of logic to build anything from the simple to complex. For this site I decided to go with the [even theme](https://github.com/olOwOlo/hugo-theme-even). The commenting system is implemented using [Utterances](https://utteranc.es/) Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again.Hugo provides a robust theming system that is easy to implement but capable of producing even the most complicated websites.Hugo's Go-based templates provide just the right amount of logic to build anything from the simple to complex. For this site I decided to go with the [even theme](https://github.com/olOwOlo/hugo-theme-even). The commenting system is implemented using [Utterances](https://utteranc.es/)
# Blog site hosting # Blog site hosting
@@ -8,7 +8,7 @@ tags = ["postgresql", "archlinux", "manjaro", "garuda", "linux"]
Getting PostgreSQL up and running on Arch Linux-based distros Getting PostgreSQL up and running on Arch Linux-based distros
<!--more--> <!-- more -->
# Overview # Overview
@@ -50,7 +50,7 @@ Now with all that fluff out of the way, let's get to business. The steps have be
## Step 1: Installing the PostgreSQL Package ## Step 1: Installing the PostgreSQL Package
```shell ```sh
$ sudo pacman -Syu postgresql $ sudo pacman -Syu postgresql
``` ```
@@ -60,13 +60,13 @@ You can switch to the PostgreSQL user by executing the following command:
- If you have sudo and are in sudoers - If you have sudo and are in sudoers
```shell ```sh
$ sudo -iu postgres $ sudo -iu postgres
``` ```
- Otherwise using su: - Otherwise using su:
```shell ```sh
$ su $ su
# su -l postgres # su -l postgres
``` ```
@@ -77,20 +77,20 @@ Before PostgreSQL can function correctly, the database cluster must be initializ
### 2.1 We can confirm the installed PostgreSQL version by running: ### 2.1 We can confirm the installed PostgreSQL version by running:
```shell ```sh
$ postgres --version ─╯ $ postgres --version ─╯
postgres (PostgreSQL) 15.1 postgres (PostgreSQL) 15.1
``` ```
### 2.2 Set applicable entries in **/etc/locale.gen** ### 2.2 Set applicable entries in **/etc/locale.gen**
```shell ```sh
$ echo "en_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen $ echo "en_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen
``` ```
### 2.3 Then run **\*\*locale-gen\*\*** to generate locale settings ### 2.3 Then run **\*\*locale-gen\*\*** to generate locale settings
```shell ```sh
$ sudo locale-gen $ sudo locale-gen
Generating locales... Generating locales...
en_US.UTF-8... done en_US.UTF-8... done
@@ -101,7 +101,7 @@ Generation complete.
You must first log in as the **postgres** user using the following command before you can initialize PostgreSQL’s data directory: You must first log in as the **postgres** user using the following command before you can initialize PostgreSQL’s data directory:
```shell ```sh
sudo su - postgres sudo su - postgres
``` ```
@@ -115,7 +115,7 @@ sudo su - postgres
### 3.1 Check PostgreSQL status with the following command: ### 3.1 Check PostgreSQL status with the following command:
```shell ```sh
$ systemctl status postgresql ─╯ $ systemctl status postgresql ─╯
postgresql.service - PostgreSQL database server postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; preset: disabled) Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; preset: disabled)
@@ -124,19 +124,19 @@ $ systemctl status postgresql
### 3.2 Start the PostgreSQL service by running the following command: ### 3.2 Start the PostgreSQL service by running the following command:
```shell ```sh
sudo systemctl start postgresql sudo systemctl start postgresql
``` ```
### 3.3 Enable the PostgreSQL service to start automatically at boot by running the following command: ### 3.3 Enable the PostgreSQL service to start automatically at boot by running the following command:
```shell ```sh
$ sudo systemctl enable postgresql $ sudo systemctl enable postgresql
``` ```
### 3.4 Verify that PostgreSQL is running by running the following command: ### 3.4 Verify that PostgreSQL is running by running the following command:
```shell ```sh
$ sudo systemctl status postgresql ─╯ $ sudo systemctl status postgresql ─╯
● postgresql.service - PostgreSQL database server ● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled) Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
+1 -1
View File
@@ -8,7 +8,7 @@ tags = ["blog", "hugo", "netlify","netlify-cms","github"]
Migrating to a better content management system through Netlify CMS Migrating to a better content management system through Netlify CMS
<!--more--> <!-- more -->
# Heavy Lifting # Heavy Lifting
@@ -8,7 +8,7 @@ tags= ["git", "semver","workflow", "conventional commits"]
Adopting best practices in your git and build workflows. Adopting best practices in your git and build workflows.
<!--more--> <!-- more -->
# What is Semver? # What is Semver?
+8 -8
View File
@@ -1,6 +1,6 @@
+++ +++
title= "Subresource Integrity" title= "Subresource Integrity"
description= "Understanding Subresource Integrity" description = "Understanding Subresource Integrity"
date= 2023-04-29 date= 2023-04-29
[taxonomies] [taxonomies]
tags= ["Subresource Integrity", "CSP", "CORS"] tags= ["Subresource Integrity", "CSP", "CORS"]
@@ -105,7 +105,7 @@ Access-Control-Allow-Origin: *
# How browsers handle Subresource Integrity # How browsers handle Subresource Integrity
Web browsers employ several mechanisms to handle Subresource Integrity (SRI). When a <script> or <link> element with an integrity attribute is encountered by the browser, it compares the script or stylesheet to the expected hash given in the integrity value before executing the script or applying the stylesheet. Web browsers employ several mechanisms to handle Subresource Integrity (SRI). When a **script** or **link** element with an integrity attribute is encountered by the browser, it compares the script or stylesheet to the expected hash given in the integrity value before executing the script or applying the stylesheet.
For resources served from a different domain than the document in which it's embedded, the browser also checks the resource using Cross-Origin Resource Sharing (CORS) to ensure that the origin serving the resource allows it to be shared with the requesting domain. This additional check is important for preventing unauthorized access to sensitive resources. For resources served from a different domain than the document in which it's embedded, the browser also checks the resource using Cross-Origin Resource Sharing (CORS) to ensure that the origin serving the resource allows it to be shared with the requesting domain. This additional check is important for preventing unauthorized access to sensitive resources.
@@ -113,9 +113,9 @@ If the script or stylesheet fails to match its associated integrity value, the b
# References # References
- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP - [https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)
- https://www.srihash.org/ - [https://www.srihash.org/](https://www.srihash.org/)
- https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity - [https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)
- https://html.spec.whatwg.org/multipage/semantics.html#attr-script-integrity - [https://html.spec.whatwg.org/multipage/semantics.html#attr-script-integrity](https://html.spec.whatwg.org/multipage/semantics.html#attr-script-integrity)
- https://html.spec.whatwg.org/multipage/semantics.html#attr-link-integrity - [https://html.spec.whatwg.org/multipage/semantics.html#attr-link-integrity](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-integrity)
- https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute - [https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute](https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute)
+5 -1
View File
@@ -8,5 +8,9 @@
⬡ ⬡
<a href="/contact">Contact</a> <a href="/contact">Contact</a>
</nav> </nav>
<p>© 2022 - {{ now() | date(format="Y") }} Ian Andwati.</p> <p>
© 2022 -
{{ now() | date(format="%Y") }}
Ian Andwati.
</p>
</footer> </footer>
+2 -1
View File
@@ -1,5 +1,5 @@
{% extends "page.html" %} {% extends "page.html" %}
{% import "post_macros.html" as post_macros %} {% import "post_macros.html" as page_macros %}
{% block meta %} {% block meta %}
<meta name="description" content="{{ page.description }}" /> <meta name="description" content="{{ page.description }}" />
<meta property="og:site_name" content="andwati.com" /> <meta property="og:site_name" content="andwati.com" />
@@ -24,6 +24,7 @@
<article id="content"> <article id="content">
<header> <header>
<h1>{{ page.title }}</h1> <h1>{{ page.title }}</h1>
{{ page_macros::meta(page=page) }}
</header> </header>
{{ page.content | safe }} {{ page.content | safe }}
</article> </article>
+3 -2
View File
@@ -1,6 +1,6 @@
{% macro meta(page) %} {% macro meta(page) %}
<div class="post-meta"> <div class="post-meta">
<time datetime="{{ page.date }}">{{ page.date | date(format="%F") }}</time> <time datetime="{{ page.date }}">{{ page.date | date(format="%B %d,%Y") }}</time>
{% if page.taxonomies.tags %} {% if page.taxonomies.tags %}
<span class="accent">⬡</span> <span class="accent">⬡</span>
{% for tag in page.taxonomies.tags %} {% for tag in page.taxonomies.tags %}
@@ -18,7 +18,8 @@
{{ self::meta(page=page) }} {{ self::meta(page=page) }}
{% if page.summary %}{{ page.summary | safe }}{% endif %} {% if page.summary %}{{ page.summary | safe }}{% endif %}
<nav> <nav>
<a href="{{ page.permalink }}">Read More</a> <a href="{{ page.permalink }}">Read More →</a>
</nav> </nav>
%d%
</article> </article>
{% endmacro snippet %} {% endmacro snippet %}
+1 -1
View File
@@ -1,7 +1,7 @@
{% extends "section.html" %} {% extends "section.html" %}
{% import "post_macros.html" as post_macros %} {% import "post_macros.html" as post_macros %}
{% block content %} {% block content %}
<main class="content"> <main id="content">
<header> <header>
<h1>Posts</h1> <h1>Posts</h1>
</header> </header>