mirror of
https://github.com/andwati/andwati.com.git
synced 2026-10-20 10:04:25 +00:00
polishing
This commit is contained in:
@@ -8,7 +8,7 @@ tags = ["tutorial", "Django", "Python", ".emv"]
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ tags = ["hugo", "blog", "Go"]
|
||||
|
||||
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.
|
||||
|
||||
@@ -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
|
||||
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
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ tags = ["postgresql", "archlinux", "manjaro", "garuda", "linux"]
|
||||
|
||||
Getting PostgreSQL up and running on Arch Linux-based distros
|
||||
|
||||
<!--more-->
|
||||
<!-- more -->
|
||||
|
||||
# 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
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ 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
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ sudo -iu postgres
|
||||
```
|
||||
|
||||
- Otherwise using su:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ su
|
||||
# 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:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ postgres --version ─╯
|
||||
postgres (PostgreSQL) 15.1
|
||||
```
|
||||
|
||||
### 2.2 Set applicable entries in **/etc/locale.gen**
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ echo "en_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen
|
||||
```
|
||||
|
||||
### 2.3 Then run **\*\*locale-gen\*\*** to generate locale settings
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ sudo locale-gen
|
||||
Generating locales...
|
||||
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:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
sudo su - postgres
|
||||
```
|
||||
|
||||
@@ -115,7 +115,7 @@ sudo su - postgres
|
||||
|
||||
### 3.1 Check PostgreSQL status with the following command:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ systemctl status postgresql ─╯
|
||||
postgresql.service - PostgreSQL database server
|
||||
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:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
sudo systemctl start postgresql
|
||||
```
|
||||
|
||||
### 3.3 Enable the PostgreSQL service to start automatically at boot by running the following command:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ sudo systemctl enable postgresql
|
||||
```
|
||||
|
||||
### 3.4 Verify that PostgreSQL is running by running the following command:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
$ sudo systemctl status postgresql ─╯
|
||||
● postgresql.service - PostgreSQL database server
|
||||
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
|
||||
|
||||
@@ -8,7 +8,7 @@ tags = ["blog", "hugo", "netlify","netlify-cms","github"]
|
||||
|
||||
Migrating to a better content management system through Netlify CMS
|
||||
|
||||
<!--more-->
|
||||
<!-- more -->
|
||||
|
||||
# Heavy Lifting
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ tags= ["git", "semver","workflow", "conventional commits"]
|
||||
|
||||
Adopting best practices in your git and build workflows.
|
||||
|
||||
<!--more-->
|
||||
<!-- more -->
|
||||
|
||||
# What is Semver?
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
+++
|
||||
title= "Subresource Integrity"
|
||||
description= "Understanding Subresource Integrity"
|
||||
description = "Understanding Subresource Integrity"
|
||||
date= 2023-04-29
|
||||
[taxonomies]
|
||||
tags= ["Subresource Integrity", "CSP", "CORS"]
|
||||
@@ -105,7 +105,7 @@ Access-Control-Allow-Origin: *
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -113,9 +113,9 @@ If the script or stylesheet fails to match its associated integrity value, the b
|
||||
|
||||
# References
|
||||
|
||||
- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
|
||||
- https://www.srihash.org/
|
||||
- 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-link-integrity
|
||||
- https://w3c.github.io/webappsec-subresource-integrity/#the-integrity-attribute
|
||||
- [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://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-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)
|
||||
@@ -8,5 +8,9 @@
|
||||
⬡
|
||||
<a href="/contact">Contact</a>
|
||||
</nav>
|
||||
<p>© 2022 - {{ now() | date(format="Y") }} Ian Andwati.</p>
|
||||
<p>
|
||||
© 2022 -
|
||||
{{ now() | date(format="%Y") }}
|
||||
Ian Andwati.
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
{% extends "page.html" %}
|
||||
{% import "post_macros.html" as post_macros %}
|
||||
{% import "post_macros.html" as page_macros %}
|
||||
{% block meta %}
|
||||
<meta name="description" content="{{ page.description }}" />
|
||||
<meta property="og:site_name" content="andwati.com" />
|
||||
@@ -24,6 +24,7 @@
|
||||
<article id="content">
|
||||
<header>
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page_macros::meta(page=page) }}
|
||||
</header>
|
||||
{{ page.content | safe }}
|
||||
</article>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% macro meta(page) %}
|
||||
<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 %}
|
||||
<span class="accent">⬡</span>
|
||||
{% for tag in page.taxonomies.tags %}
|
||||
@@ -18,7 +18,8 @@
|
||||
{{ self::meta(page=page) }}
|
||||
{% if page.summary %}{{ page.summary | safe }}{% endif %}
|
||||
<nav>
|
||||
<a href="{{ page.permalink }}">Read More</a>
|
||||
<a href="{{ page.permalink }}">Read More →</a>
|
||||
</nav>
|
||||
%d%
|
||||
</article>
|
||||
{% endmacro snippet %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "section.html" %}
|
||||
{% import "post_macros.html" as post_macros %}
|
||||
{% block content %}
|
||||
<main class="content">
|
||||
<main id="content">
|
||||
<header>
|
||||
<h1>Posts</h1>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user