mirror of
https://github.com/andwati/andwati.com.git
synced 2026-10-18 01:12:53 +00:00
nuxt init
This commit is contained in:
+24
-1
@@ -1 +1,24 @@
|
||||
/public
|
||||
# Nuxt dev/build outputs
|
||||
.output
|
||||
.data
|
||||
.nuxt
|
||||
.nitro
|
||||
.cache
|
||||
dist
|
||||
|
||||
# Node dependencies
|
||||
node_modules
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.fleet
|
||||
.idea
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
.PHONY: all build
|
||||
|
||||
BUILD_DIR := public
|
||||
|
||||
all: clean build
|
||||
|
||||
clean:
|
||||
rm -rfd ./$(BUILD_DIR)
|
||||
|
||||
build:
|
||||
zola build
|
||||
|
||||
serve:
|
||||
zola serve
|
||||
|
||||
update-zola:
|
||||
@./bin/update-zola
|
||||
@@ -1,8 +1,75 @@
|
||||
# TODO
|
||||
# Nuxt Minimal Starter
|
||||
|
||||
- [ ] create new post script
|
||||
- [ ] add google analytics
|
||||
- [ ] move goatcounter config to config.toml
|
||||
- [ ] modularize open graph(og) tags
|
||||
- [ ] add favicon to config
|
||||
- [ ] add latex support
|
||||
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
|
||||
|
||||
## Setup
|
||||
|
||||
Make sure to install dependencies:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm install
|
||||
|
||||
# pnpm
|
||||
pnpm install
|
||||
|
||||
# yarn
|
||||
yarn install
|
||||
|
||||
# bun
|
||||
bun install
|
||||
```
|
||||
|
||||
## Development Server
|
||||
|
||||
Start the development server on `http://localhost:3000`:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run dev
|
||||
|
||||
# pnpm
|
||||
pnpm dev
|
||||
|
||||
# yarn
|
||||
yarn dev
|
||||
|
||||
# bun
|
||||
bun run dev
|
||||
```
|
||||
|
||||
## Production
|
||||
|
||||
Build the application for production:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run build
|
||||
|
||||
# pnpm
|
||||
pnpm build
|
||||
|
||||
# yarn
|
||||
yarn build
|
||||
|
||||
# bun
|
||||
bun run build
|
||||
```
|
||||
|
||||
Locally preview production build:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
npm run preview
|
||||
|
||||
# pnpm
|
||||
pnpm preview
|
||||
|
||||
# yarn
|
||||
yarn preview
|
||||
|
||||
# bun
|
||||
bun run preview
|
||||
```
|
||||
|
||||
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
+++
|
||||
title = "cognitive inertia"
|
||||
description = "inertia"
|
||||
author = "mockingspectre"
|
||||
date = 2025-02-26
|
||||
[taxonomies]
|
||||
tags = ["cognition"]
|
||||
+++
|
||||
|
||||
Staring at the void
|
||||
|
||||
Cognitive inertia is the reason changing our habits can be difficult. If you want to overcome inertia you have to apply a force. I consider myself an eternal student, who is ready to learn anything, or so I thought. It happened but I had not noticed, I had stopped moving forward.
|
||||
|
||||
## Metawork
|
||||
|
||||
I will define this as the things we do before getting the "real" work doe. Its things like choosing the best IDE or text editor, setting up your coding environment, choosing the best note taking app, or even the 'best' operating system. They are the prerequisites of the actual work.
|
||||
|
||||
I had been stuck on this loop, always trying to craft the perfect workflow. Setting up the best personalized linux distro, switching note taking apps, trying out multiple layouts, stylings and technologies for my blog, the list is endless.
|
||||
|
||||
All of these metawork took more time thn the actual work; building, active learning and writing. Im going to stop all of these and start doing the important stuff.
|
||||
@@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<NuxtRouteAnnouncer />
|
||||
<NuxtWelcome />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
: ${ZOLA_REPO='https://github.com/getzola/zola'}
|
||||
: ${ZOLA_INSTALL_DIR="${HOME}/.cargo/bin"}
|
||||
|
||||
# Helpers for ANSI color and logging.
|
||||
name="$(basename $0)"; esc=''; reset="${esc}[0m"
|
||||
red() { local string="${1}"; echo "${esc}[31m${string}${reset}"; }
|
||||
yellow() { local string="${1}"; echo "${esc}[33m${string}${reset}"; }
|
||||
green() { local string="${1}"; echo "${esc}[32m${string}${reset}"; }
|
||||
blue() { local string="${1}"; echo "${esc}[34m${string}${reset}"; }
|
||||
magenta() { local string="${1}"; echo "${esc}[35m${string}${reset}"; }
|
||||
log() { local string="${1}"; echo "[$(blue $name)] ${string}"; }
|
||||
|
||||
prompt_for_update() {
|
||||
local current="${1}"
|
||||
local latest="${2}"
|
||||
|
||||
[ -n "${current}" ] \
|
||||
&& installed="You're using Zola $(yellow $current)" \
|
||||
|| installed="Zola is $(red 'not installed')"
|
||||
|
||||
log "${installed}, but $(magenta $latest) is available."
|
||||
|
||||
# Prompt for an update. Exit the entire script if declined.
|
||||
read -p "$(log "Would you like to install Zola $(magenta $latest)? [y/N]: ")" answer
|
||||
case $answer in
|
||||
[Yy]*) log "Downloading Zola $(magenta $latest) from GitHub." ;;
|
||||
[Nn]*|*) log $(red "Aborted!"); exit ;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_zola() {
|
||||
local version="${1}"
|
||||
local download_url="${ZOLA_REPO}/releases/download/${version}/zola-${version}-x86_64-unknown-linux-gnu.tar.gz"
|
||||
|
||||
curl --progress-bar --location $download_url | tar --gunzip --extract --directory=$ZOLA_INSTALL_DIR --file -
|
||||
}
|
||||
|
||||
update_zola() {
|
||||
# Find the current Zola version (if any).
|
||||
[ -n "$(which zola 2> /dev/null)" ] && current_version=$(zola --version | awk '{print "v"$2}')
|
||||
|
||||
# Find the latest available Zola version. Use --refs to avoid listing
|
||||
# annotated commit objects that include the dereference syntax '^{}'.
|
||||
# Find more background at https://stackoverflow.com/a/15472310.
|
||||
local latest_version=$(git ls-remote --tags --refs $ZOLA_REPO | # Fetch remote tags.
|
||||
sort -t '/' -k 3 -V | # Sort them by version.
|
||||
tail -n 1 | # Take the latest one.
|
||||
awk -F / '{print $3}') # Return only the tag.
|
||||
|
||||
if [ "${current_version}" != "${latest_version}" ]; then
|
||||
prompt_for_update "${current_version}" "${latest_version}"
|
||||
install_zola "${latest_version}"
|
||||
fi
|
||||
|
||||
log "You're using Zola $(magenta $latest_version). $(green "Everything is up-to-date!")"
|
||||
}
|
||||
|
||||
update_zola
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
title = "mockingspectre"
|
||||
description = "mockingspectre"
|
||||
base_url = "https://andwati.xyz"
|
||||
minify_html = true
|
||||
compile_sass = true
|
||||
generate_feeds = true
|
||||
feed_filenames = ["rss.xml"]
|
||||
taxonomies = [{ name = "tags", feed = false }]
|
||||
|
||||
[markdown]
|
||||
highlight_code = true
|
||||
highlight_theme = "gruvbox-dark"
|
||||
|
||||
[link_checker]
|
||||
skip_prefixes = [""]
|
||||
skip_anchor_prefixes = ["https://github.com/"]
|
||||
|
||||
[extra]
|
||||
author = "Ian Andwati"
|
||||
meta = [
|
||||
{ property = "og:title", content = "the og title" },
|
||||
{ property = "og:description", content = "the og description" },
|
||||
]
|
||||
@@ -1,6 +0,0 @@
|
||||
+++
|
||||
title = "0xmockinspectre"
|
||||
description = "offending binaries"
|
||||
+++
|
||||
|
||||
spend my free time working on hobby projects and sometimes I write about my experiences. In particular, I enjoy learning about offensive security and reverse engineering.
|
||||
@@ -1,4 +0,0 @@
|
||||
+++
|
||||
sort_by = "date"
|
||||
template= "archive.html"
|
||||
+++
|
||||
@@ -1,6 +0,0 @@
|
||||
+++
|
||||
title = "Contact"
|
||||
description = "Let's get in touch."
|
||||
+++
|
||||
|
||||
spend my free time working on hobby projects and sometimes I write about my experiences. In particular, I enjoy learning about offensive security and reverse engineering.
|
||||
@@ -1,7 +0,0 @@
|
||||
+++
|
||||
title = "Posts"
|
||||
template = "posts.html"
|
||||
page_template = "post.html"
|
||||
sort_by = "date"
|
||||
insert_anchor_links = "left"
|
||||
+++
|
||||
@@ -1,57 +0,0 @@
|
||||
+++
|
||||
title = "A Fresh Coat Of Paint"
|
||||
description = "Migrating to Zola"
|
||||
author = "mockigspectre"
|
||||
date = 2023-08-24
|
||||
[taxonomies]
|
||||
tags = ["zola", "blog", "tera", "rust"]
|
||||
+++
|
||||
|
||||
Using Zola as my preferred static site generator
|
||||
|
||||
After using Hugo for over eight months I got tired of it and looked for other alternatives. That's when I stumbled upon Zola. Zola is a static site generator (SSG), similar to [Hugo](https://gohugo.io/), [Pelican](https://blog.getpelican.com/), and [Jekyll](https://jekyllrb.com/).
|
||||
|
||||
It is written in Rust and uses the Tera template engine, similar to Jinja2, Django templates, Liquid, and Twig. SSGs use dynamic templates to transform content into static HTML pages. Static sites are thus very fast and require no databases, making them easy to host.
|
||||
|
||||
My previous Hugo site used a theme because I wasn't really ready to learn Go's template engine. I'm already familiar with Python Django and its template system so using Tera wasn't hard because it's similar to jinja2 and the Django template syntax.
|
||||
|
||||
Content is written in [CommonMark](https://commonmark.org/), a strongly defined, highly compatible specification of [Markdown](https://www.markdownguide.org/). Zola uses [pulldown-cmark](https://github.com/raphlinus/pulldown-cmark#pulldown-cmark) to parse markdown files. The goal of this library is 100% compliance with the CommonMark spec. It adds a few additional features such as parsing footnotes, Github-flavored tables, Github-flavored task lists, and strikethrough.
|
||||
|
||||
Zola comes with built-in syntax highlighting, but you must first enable it in the configuration file.
|
||||
|
||||
Zola is very minimalistic, it is installed only as a single binary, with no extra dependencies needed. It is configured in `toml` and you only use what is needed. For example here is the configuration for this site `config.toml`:
|
||||
|
||||
```toml
|
||||
title = "Ian Andwati"
|
||||
description = "Ian Andwati's personal website"
|
||||
base_url = "https://andwati.github.io"
|
||||
|
||||
generate_categories_pages = false
|
||||
generate_tags_pages = false
|
||||
generate_feed = true
|
||||
feed_filename = "rss.xml"
|
||||
minify_html = false
|
||||
taxonomies = [{ name = 'tags', feed = false }]
|
||||
compile_sass = true
|
||||
|
||||
[markdown]
|
||||
highlight_code = true
|
||||
highlight_theme = "gruvbox-dark"
|
||||
|
||||
[link_checker]
|
||||
|
||||
[extra]
|
||||
author = "Ian Andwati"
|
||||
```
|
||||
|
||||
## Inspiration
|
||||
|
||||
The motivation to use Zola also came from my decision to move from independently developed themes. I decided to write the HTML and CSS myself and endeavor to maintain the site individually. The base CSS is borrowed from [Reilly Tucker Siemens](https://tuckersiemens.com/) who had created a nice gruvbox palette for his site.
|
||||
|
||||
I improved on it by adding an archive page, pagination, a comment system, and Google Analytics (more of these in later posts). I also implemented article read time and word count.
|
||||
|
||||
## What next
|
||||
|
||||
The site is a work in progress and is far from polished. I plan on implementing a newsletter to notify readers of new posts. The site is primarily a dark theme, in the future I'll also add theme toggling and maybe different palettes.
|
||||
|
||||
You can subscribe to the site's RSS feed at [https://andwati.xyz/rss.xml](https://andwati.xyz/rss.xml).
|
||||
@@ -1,15 +0,0 @@
|
||||
+++
|
||||
title = "File over app"
|
||||
description = "Take control of your artifacts"
|
||||
author = "mockingspectre"
|
||||
draft = true
|
||||
date = 2023-12-18
|
||||
[taxonomies]
|
||||
tags = ["obsidian", "entropy", "notes"]
|
||||
+++
|
||||
|
||||
Take control of your artifacts
|
||||
|
||||
In my endless endevours to find the perfect note taking app led me to obsidian, a note taking software that uses markdown files as the file format. All software is ephemereal in nature and yoour artifacts need to survive the decline of your favorite app. The files you create should be available to you and shouldt rrequire specialized software to access.
|
||||
|
||||
Your data shouldt be locked behind a paywall or an authentication system that is not under your control.
|
||||
@@ -1,39 +0,0 @@
|
||||
+++
|
||||
title = "Django Secret Key Tutorial"
|
||||
description = "Managing secrets"
|
||||
author = "mockingspectre"
|
||||
date = 2022-11-11T15:34:14.160Z
|
||||
[taxonomies]
|
||||
tags = ["tutorial", "django", "python", ".env"]
|
||||
+++
|
||||
|
||||
Managing the Django SECRET_KEY variable.
|
||||
|
||||
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
|
||||
|
||||
# Using Environment Variables
|
||||
|
||||
The secret key should not be committed to version control. It is best practice to store the value in a .env file which is added to the .gitignore file to un-track its changes. The values can be loaded programmatically into your settings.py file.
|
||||
|
||||
# Generating A New Secret Key
|
||||
|
||||
This solution is using python's secrets lib on the back
|
||||
|
||||
```python
|
||||
from django.core.management.utils import get_random_secret_key
|
||||
# print new random secret key
|
||||
print(get_random_secret_key())
|
||||
```
|
||||
|
||||
This code can be run in the terminal as a command:
|
||||
|
||||
```python
|
||||
python -c 'from django.core.management.utils import get_random_secret_key; \
|
||||
print(get_random_secret_key())'
|
||||
```
|
||||
|
||||
Alternatively, If you are using python 3.6+ then you can use the `secrets.token_hex(\[nbytes=None])` function:
|
||||
|
||||
```python
|
||||
python3 -c 'import secrets; print(secrets.token_hex(100))'
|
||||
```
|
||||
@@ -1,34 +0,0 @@
|
||||
+++
|
||||
title = "Hello World"
|
||||
description = "Hello world"
|
||||
date = 2022-11-04
|
||||
author = "mockingspectre"
|
||||
[taxonomies]
|
||||
tags = ["hugo", "blog", "go"]
|
||||
+++
|
||||
|
||||
How it begins
|
||||
|
||||
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.
|
||||
|
||||
However, I still prefer to write using a blog.
|
||||
|
||||
# Why this?
|
||||
|
||||
The best way to learn something is to teach others the knowledge that you have gained. Regurgitating that information will solidify it more firmly in your mind.
|
||||
|
||||
# What I write?
|
||||
|
||||
Mostly random stuff and a few tutorials. I'll see where this goes.Although some of the blog posts may only be helpful to myself, but who knows, I hope they will be helpful to someone else in some day.
|
||||
|
||||
# Static blog generator
|
||||
|
||||
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 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
|
||||
|
||||
The site is hosted on github pages as evident by the \*.github.io domain name.I prefer this mainly because it is free and I don't have
|
||||
to switch to a different hosting provider.
|
||||
@@ -1,20 +0,0 @@
|
||||
+++
|
||||
title = "cognitive inertia"
|
||||
description = "inertia"
|
||||
author = "mockingspectre"
|
||||
date = 2025-02-26
|
||||
[taxonomies]
|
||||
tags = ["cognition"]
|
||||
+++
|
||||
|
||||
Staring at the void
|
||||
|
||||
Cognitive inertia is the reason changing our habits can be difficult. If you want to overcome inertia you have to apply a force. I consider myself an eternal student, who is ready to learn anything, or so I thought. It happened but I had not noticed, I had stopped moving forward.
|
||||
|
||||
## Metawork
|
||||
|
||||
I will define this as the things we do before getting the "real" work doe. Its things like choosing the best IDE or text editor, setting up your coding environment, choosing the best note taking app, or even the 'best' operating system. They are the prerequisites of the actual work.
|
||||
|
||||
I had been stuck on this loop, always trying to craft the perfect workflow. Setting up the best personalized linux distro, switching note taking apps, trying out multiple layouts, stylings and technologies for my blog, the list is endless.
|
||||
|
||||
All of these metawork took more time thn the actual work; building, active learning and writing. Im going to stop all of these and start doing the important stuff.
|
||||
@@ -1,172 +0,0 @@
|
||||
+++
|
||||
title ="Install PostgreSQL on Arch | Manjaro | Garuda Linux"
|
||||
description = "Getting PostgreSQL up and running on Arch Linux-based distros"
|
||||
date = 2023-02-16T15:34:14.160Z
|
||||
author = "mockingspectre"
|
||||
[taxonomies]
|
||||
tags = ["postgresql", "archlinux", "manjaro", "garuda", "linux"]
|
||||
+++
|
||||
|
||||
# Overview
|
||||
|
||||
**PostgreSQL** is a powerful open-source relational database management system (RDBMS) that allows you to store and manage large amounts of data. It was first released in 1996 and has become one of the most popular RDBMSs in the world.
|
||||
|
||||
PostgreSQL is designed to handle high levels of **concurrency**, providing features such as **MVCC (multi-version concurrency control)** that allow multiple users to access the same data simultaneously without conflicts. It is also **highly extensible**, with a large number of third-party extensions and libraries available that can be used to add functionality to the core database.
|
||||
|
||||
Some of the key features of PostgreSQL include support for **complex SQL queries**, **advanced indexing** and **query optimization**, **transactional integrity**, and support for a **wide range of programming languages** and development frameworks.PostgreSQL is used by a wide range of organizations, from small businesses to large enterprises, and is particularly popular in industries such as finance, healthcare, and e-commerce, where high levels of data security and reliability are critical.
|
||||
|
||||
In this tutorial, we’ll look at how to install PostgreSQL on Arch Linux, Manjaro, Garuda Linux, or any other Arch-based distro out there.
|
||||
|
||||
# PostgreSQL use cases
|
||||
|
||||
- **E-commerce websites:** PostgreSQL is a popular choice for e-commerce websites because it can handle large amounts of data and supports complex queries. It is used for product catalogs, order management, customer data, and more.
|
||||
- **Financial institutions:** PostgreSQL is used in financial institutions to store and manage transactional data, such as stock trades, bank transfers, and credit card transactions. It is highly secure and provides features such as transactional integrity and data encryption.
|
||||
- **Healthcare industry:** PostgreSQL is used in the healthcare industry to store patient data, such as medical records and diagnostic test results. It is also used for research purposes, where large amounts of data need to be stored and analyzed.
|
||||
- **Government agencies:** PostgreSQL is used by government agencies for a variety of purposes, including managing large datasets, storing and analyzing census data, and managing public health information.
|
||||
- **Mobile and web applications:** PostgreSQL is often used as a back-end database for mobile and web applications. It provides reliable data storage and retrieval and supports a wide range of programming languages and development frameworks.
|
||||
- **Geospatial applications:** PostgreSQL has built-in support for geospatial data and is often used for applications that require location-based data, such as mapping and GPS tracking.
|
||||
|
||||
# Why PostgreSQL?
|
||||
|
||||
Postgres offers a lot of advantages that make it an excellent choice for highly transactional environments regardless of application size and data volume. Its rich feature set and flexibility make it a popular choice for a wide range of applications and industries. Some of the top features are:
|
||||
|
||||
- **ACID Compliance:** PostgreSQL is ACID (Atomicity, Consistency, Isolation, Durability) compliant, which means it provides high reliability, consistency, and data integrity, even in the presence of hardware failures, power outages, and other system errors.
|
||||
- **Extensibility:** PostgreSQL is highly extensible, allowing developers to add new data types, operators, and functions using its extension framework. This makes it easy to customize PostgreSQL to meet the specific needs of your application.
|
||||
- **Concurrency:** PostgreSQL provides a high level of concurrency, allowing multiple users to access the same data at the same time without conflicts. It uses a Multi-Version Concurrency Control (MVCC) model that enables fast and reliable access to data, even under heavy load.
|
||||
- **Full-text search:** PostgreSQL provides a powerful full-text search engine that supports advanced search capabilities, such as stemming, ranking, and relevance matching.
|
||||
- **Advanced indexing:** PostgreSQL provides a wide range of indexing options, including B-tree, Hash, GiST, SP-GiST, GIN, and BRIN. These indexing options allow developers to optimize database performance for their specific use cases.
|
||||
- **JSON support:** PostgreSQL provides native support for storing and querying JSON data, making it easy to work with modern web and mobile applications that rely on JSON for data exchange.
|
||||
- **Security:** PostgreSQL provides a high level of security, with features such as SSL support, client authentication, and role-based access control. It also provides encryption for both data at rest and data in transit.
|
||||
- **Scalability:** PostgreSQL is designed to scale horizontally and vertically, allowing you to add more nodes to a cluster or increase the resources of a single node to handle more load.
|
||||
|
||||
# Install PostgreSQL on Arch | Manjaro | Garuda Linux
|
||||
|
||||
Now with all that fluff out of the way, let's get to business. The steps have been tested on Arch Linux with the KDE desktop.
|
||||
|
||||
> **Note:** Commands that should be run as the *postgres* user are prefixed by `[postgres]$` in this article.
|
||||
|
||||
## Step 1: Installing the PostgreSQL Package
|
||||
|
||||
```sh
|
||||
sudo pacman -Syu postgresql
|
||||
```
|
||||
|
||||
This command will update the package database and update all packages on the system then install the PostgreSQL package from your distribution mirrors. Never install a package without updating the system first. On a rolling release, this can lead to an unbootable system. Installing the package will also create a system user called *postgres*. You can now switch to the *postgres* user using a privilege elevation program.
|
||||
|
||||
You can switch to the PostgreSQL user by executing the following command:
|
||||
|
||||
- If you have sudo and are in sudoers
|
||||
|
||||
```sh
|
||||
sudo -iu postgres
|
||||
```
|
||||
|
||||
- Otherwise using su:
|
||||
|
||||
```sh
|
||||
su
|
||||
su -l postgres
|
||||
```
|
||||
|
||||
## Step 2: Initial Configuration
|
||||
|
||||
Before PostgreSQL can function correctly, the database cluster must be initialized.
|
||||
|
||||
### 2.1 We can confirm the installed PostgreSQL version by running
|
||||
|
||||
```sh
|
||||
postgres --version ─╯
|
||||
postgres (PostgreSQL) 15.1
|
||||
```
|
||||
|
||||
### 2.2 Set applicable entries in **/etc/locale.gen**
|
||||
|
||||
```sh
|
||||
echo "en_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen
|
||||
```
|
||||
|
||||
### 2.3 Then run **\*\*locale-gen\*\*** to generate locale settings
|
||||
|
||||
```sh
|
||||
sudo locale-gen
|
||||
Generating locales...
|
||||
en_US.UTF-8... done
|
||||
Generation complete.
|
||||
```
|
||||
|
||||
### 2.4 Initialize Postgres Data Directory
|
||||
|
||||
You must first log in as the **postgres** user using the following command before you can initialize PostgreSQL’s data directory:
|
||||
|
||||
```sh
|
||||
sudo su - postgres
|
||||
```
|
||||
|
||||
### 2.5 With the following command, you can now initialize PostgreSQL’s data directory
|
||||
|
||||
```sh
|
||||
[postgres]$ initdb -D /var/lib/postgres/data
|
||||
```
|
||||
|
||||
### Step 3: PostgreSQL Service Management
|
||||
|
||||
### 3.1 Check PostgreSQL status with the following command
|
||||
|
||||
```sh
|
||||
systemctl status postgresql ─╯
|
||||
postgresql.service - PostgreSQL database server
|
||||
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; preset: disabled)
|
||||
Active: inactive (dead)
|
||||
```
|
||||
|
||||
### 3.2 Start the PostgreSQL service by running the following command
|
||||
|
||||
```sh
|
||||
sudo systemctl start postgresql
|
||||
```
|
||||
|
||||
### 3.3 Enable the PostgreSQL service to start automatically at boot by running the following command
|
||||
|
||||
```sh
|
||||
sudo systemctl enable postgresql
|
||||
```
|
||||
|
||||
### 3.4 Verify that PostgreSQL is running by running the following command
|
||||
|
||||
```sh
|
||||
sudo systemctl status postgresql ─╯
|
||||
● postgresql.service - PostgreSQL database server
|
||||
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
|
||||
Active: active (running) since Thu 2023-02-16 22:52:43 EAT; 20s ago
|
||||
Main PID: 26106 (postgres)
|
||||
Tasks: 6 (limit: 8790)
|
||||
Memory: 16.9M
|
||||
CPU: 113ms
|
||||
CGroup: /system.slice/postgresql.service
|
||||
├─26106 /usr/bin/postgres -D /var/lib/postgres/data
|
||||
├─26107 "postgres: checkpointer "
|
||||
├─26108 "postgres: background writer "
|
||||
├─26110 "postgres: walwriter "
|
||||
├─26111 "postgres: autovacuum launcher "
|
||||
└─26112 "postgres: logical replication launcher "
|
||||
```
|
||||
|
||||
### Change postgres user password
|
||||
|
||||
To change the postgres user password execute the following command:
|
||||
|
||||
```sh
|
||||
sudo -u postgres psql -c "ALTER USER postgres PASSWORD '$PGPASSWORD';"
|
||||
```
|
||||
|
||||
# Resources
|
||||
|
||||
- [Arch Linux Wiki](https://wiki.archlinux.org/title/PostgreSQL)
|
||||
- [Wikipedia](https://en.wikipedia.org/wiki/PostgreSQL)
|
||||
- [PostgreSQL Documentation](https://www.postgresql.org/docs/)
|
||||
|
||||
# Conclusion
|
||||
|
||||
Installing PostgreSQL on Arch Linux-based distribution is a straightforward process that can be completed in just a few steps. By following the steps outlined above, you can install, configure, and start the PostgreSQL database server on your Arch Linux system. Once installed, you can use PostgreSQL to store, manage, and query data for a wide range of applications and use cases. With its advanced features and high level of extensibility, PostgreSQL is a popular choice for developers and businesses seeking a robust and reliable database management system.
|
||||
|
||||
You can connect to the PostgreSQL server using the psql command-line client or a graphical tool such as pgAdmin.
|
||||
@@ -1,157 +0,0 @@
|
||||
+++
|
||||
title = "Integrating Netlify CMS"
|
||||
description = "Integrating netlify cms"
|
||||
date = 2022-11-24T15:34:14.160Z
|
||||
author = "mockingspectre"
|
||||
[taxonomies]
|
||||
tags = ["blog", "hugo", "netlify","netlify-cms","github"]
|
||||
+++
|
||||
|
||||
Migrating to a better content management system through Netlify CMS
|
||||
|
||||
# Heavy Lifting
|
||||
|
||||
I use [Visual Studio Code](https://code.visualstudio.com/) to manually edit the blog post content on this website. This is quite a hassle because I have to deal with
|
||||
markdown files. There are many problems with this approach and several gotchas. I have to work on a local site repository to be able to edit the content. My GitHub credentials are also required to push my local changes to my remote repository on GitHub so that it can trigger the build process and publish the site.
|
||||
|
||||
This process has helped me a lot to master markdown syntax and some practice on my git skills. It’s fun to update the website content following these steps but sometimes it can be frustrating. At those times, I really miss the user interface of content management systems. After careful consideration, I moved on with Netlify CMS. At its core, Netlify CMS is an open-source React app that acts as a wrapper for the Git workflow, using the GitHub, GitLab, or Bitbucket API. This provides many advantages, including:
|
||||
|
||||
- **Fast, web-based UI:** With rich-text editing, real-time preview, and drag-and-drop media uploads.
|
||||
- **Platform agnostic:** Works with most static site generators.
|
||||
- **Easy installation:** Add two files to your site and hook up the backend by including those files in your build process or linking to our Content Delivery Network (CDN).
|
||||
- **Modern authentication:** Using GitHub, GitLab, or Bitbucket and JSON web tokens.
|
||||
- **Flexible content types:** Specify an unlimited number of content types with custom fields.
|
||||
- **Fully extensible:** Create custom-styled previews, UI widgets, and editor plugins.
|
||||
|
||||
# Redeploying to Netlify
|
||||
|
||||
I decided to move the site from GitHub pages to Netlify hosting to take full control of the platform. Hugo sites on Netlify can benefit from automatic framework detection and control over Hugo version selection. When you link a repository for a project, Netlify tries to detect the framework your site is using. If your site is built with Hugo, Netlify provides a suggested build command and publish directory: Hugo and public. The build process is straight forward but you can add custom options to your `netlify.toml` file, here are my options:
|
||||
|
||||
```toml
|
||||
[build]
|
||||
command = "hugo"
|
||||
publish = "public"
|
||||
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.105.0"
|
||||
```
|
||||
|
||||
# Setting up Netlify CMS
|
||||
|
||||
You can adapt Netlify CMS to a wide variety of projects. It works with any content written in markdown, JSON, YAML, or TOML files, stored in a repo on GitHub, GitLab, or Bitbucket. You can Netlify CMS to a site that's built with a common static site generator, like Jekyll, Hugo, Hexo, or Gatsby. The official documentation for installing on your website can be found at the [official site](https://www.netlifycms.org/docs/intro/)
|
||||
|
||||
## Steps
|
||||
|
||||
**Step 1**
|
||||
|
||||
Create a static admin folder containing all Netlify CMS files, stored at the root of your published site. Where you store this folder in the source files depends on your static site generator. For Hugo, it is the `static` folder.
|
||||
|
||||
`/static/admin`
|
||||
|
||||
**Step 2**
|
||||
|
||||
Inside the admin folder, create two files: `index.html` and `config.yml`. The first file `admin/index.html` is an entry point to Netlify CMS. You will access the CMS interface from `yourwebsite.com/admin` when everything is ready.
|
||||
|
||||
**Step 3**
|
||||
|
||||
The first file, `admin/index.html`, is the entry point for the Netlify CMS admin interface. Paste this code in index.html and save. This HTML starter page will load the Netlify CMS Javascript file:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Content Manager</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Include the script that builds the page and powers Netlify CMS -->
|
||||
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
**Step 4**
|
||||
|
||||
Now let’s move to the configuration section. These are the configurations that go into the `config.yml` file. This process is different for every site. I followed the guidelines on the website and made minor adjustments. It worked on my website. The configuration options are available at the [docs](<https://www.netlifycms.org/docs/add-to-your-site/#:~:text=%2C%20MyTemplate)-,Configuration,-Configuration%20is%20different>). This is how I configured my config.yml file:
|
||||
|
||||
```yaml
|
||||
backend:
|
||||
name: git-gateway
|
||||
branch: netlify-cms # Branch to update (optional; defaults to master)
|
||||
|
||||
# This line should *not* be indented
|
||||
publish_mode: editorial_workflow
|
||||
|
||||
media_folder: "static/images/uploads" # Media files will be stored in the repo under static/images/uploads
|
||||
public_folder: "/images/uploads" # The src attribute for uploaded media will begin with /images/uploads
|
||||
|
||||
collections:
|
||||
- name: "post" # Used in routes, e.g., /admin/collections/blog
|
||||
label: "posts" # Used in the UI
|
||||
folder: "content/post" # The path to the folder where the documents are stored
|
||||
create: true # Allow users to create new documents in this collection
|
||||
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
|
||||
fields: # The fields for each document, usually in front matter
|
||||
- { label: "Layout", name: "layout", widget: "hidden", default: "blog" }
|
||||
- { label: "Title", name: "title", widget: "string" }
|
||||
- { label: "Draft", name: "draft", widget: "boolean", default: true }
|
||||
- { label: "Publish Date", name: "date", widget: "datetime" }
|
||||
- { label: "Last Modified", name: "lastmod", widget: "datetime" }
|
||||
- { label: "Body", name: "body", widget: "markdown" }
|
||||
- { label: "Keywords", name: "keywords", widget: "list" }
|
||||
- { label: "Tags", name: "tags", widget: "list" }
|
||||
- { label: "Categories", name: "categories", widget: "list" }
|
||||
- { label: "Comments", name: "comment", widget: "boolean", default: true }
|
||||
- {
|
||||
label: "Table of Contents",
|
||||
name: "toc",
|
||||
widget: "boolean",
|
||||
default: true,
|
||||
}
|
||||
```
|
||||
|
||||
**Step 5**
|
||||
|
||||
**Authentication**
|
||||
|
||||
Now that the Netlify CMS files are in place and configured, all that's left is to enable authentication.
|
||||
Netlify offers a built-in authentication service called Identity. In order to use it, connect your site repo with Netlify. Netlify has published a general [Step-by-Step Guide](https://www.netlify.com/blog/2016/10/27/a-step-by-step-guide-deploying-a-static-site-or-single-page-app/) for this, along with detailed guides for many popular static site generators
|
||||
|
||||
Let’s first enable Netlify Identity and Git Gateway:
|
||||
|
||||
- On your Netlify account, go to **Settings > Identity** and select **Enable Identity Service**
|
||||
- Under **Registration preferences**, select **Invite Only**.
|
||||
- If you want to enable login from external providers such as Google and GitHub, check the boxes you want to use, under **External Providers** section. I find it practical to log in with GitHub, so I added it.
|
||||
- Go to **Services > Git Gateway**, and click **Enable Git Gateway**. This authenticates with your Git Host and generates and API token.
|
||||
- Everything is almost set up. What we need now is a front-end interface to connect. We will add the following script in two places, to include the **Netlify Identity Widget** on our website:
|
||||
|
||||
```html
|
||||
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
|
||||
```
|
||||
|
||||
We will use Netlify's [script injection](https://docs.netlify.com/site-deploys/post-processing/snippet-injection/) feature to add the script to our site. To use snippet injection, go to **Site Settings > Build & Deploy > Post processing**. Find the Snippet Injection section and select **Add Snippet**. Write a name for the script in the first box (e.g. Netlify Identity Widget). Paste the script inside the second box. Choose Insert before the `</body>` option and save.
|
||||
|
||||
Lastly, we will add the following script before the closing `<body>` tag of our website’s main index page. This script allows the user to redirect back to the `/admin/` path after completing the login with the Netlify Identity Widget:
|
||||
|
||||
```html
|
||||
<script>
|
||||
if (window.netlifyIdentity) {
|
||||
window.netlifyIdentity.on("init", (user) => {
|
||||
if (!user) {
|
||||
window.netlifyIdentity.on("login", () => {
|
||||
document.location.href = "/admin/";
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
**Step 5**
|
||||
|
||||
Now we’re all set. Since we set our registration preferences to **“Invite Only”**, we need to invite ourselves as site users. To do this, select the Identity tab from the Netlify site dashboard and select the Invite Users button. Add your email address and send an invitation. You will receive an email. In your email, click **“accept the invitation”**. You will be directed to your website admin sign-up panel. Choose a password. Now you are ready to log in to Netlify CMS.
|
||||
|
||||
# Setting up a custom domain
|
||||
|
||||
I bought a custom domain from [Namecheap](https://namecheap.com), they provide some pretty good deals. After pointing the nameservers for the domain to the Netlify nameservers, voila! everything worked smoothly. For HTTPS support, Netlify enables automatic TLS certificates with Let’s Encrypt.
|
||||
@@ -1,196 +0,0 @@
|
||||
+++
|
||||
title = "Export default and module.exports in Javascript"
|
||||
description = "Modules are the building blocks of modern JavaScript applications, allowing for the encapsulation of code into reusable components. Two primary systems govern the exportation of these modules: export default in ES6 and module.exports in CommonJS. "
|
||||
author = "mockingspectre"
|
||||
date = 2024-01-17
|
||||
[taxonomies]
|
||||
tags = ["javascript", "node"]
|
||||
+++
|
||||
|
||||
Modules are the building blocks of modern JavaScript applications, allowing for the encapsulation of code into reusable components. Two primary systems govern the exportation of these modules: export default in ES6 and module.exports in CommonJS.
|
||||
|
||||
Javascript is a popular programming language that can run both in the browser and on the server. However, different environments may have different ways of organizing and importing Javascript modules. In this article, we will compare two common methods of exporting and importing modules: **export default** and **module.exports**.
|
||||
|
||||
## What are modules?
|
||||
|
||||
Modules are reusable pieces of code that can be separated into different files. Modules can export values, functions, classes, or objects that can be imported by other modules. This way, modules can avoid polluting the global scope and enable code reuse and modularity.
|
||||
|
||||
## How to export modules in Node.js?
|
||||
|
||||
Node.js is a runtime environment that allows Javascript to run on the server. Node.js uses a module system called CommonJS, which is based on the require and module.exports syntax.
|
||||
|
||||
To export a module in Node.js, you can assign the value that you want to export to the module.exports object. For example:
|
||||
|
||||
```javascript
|
||||
// my-module.js
|
||||
// export a function
|
||||
module.exports = function add(a, b) {
|
||||
return a + b;
|
||||
};
|
||||
|
||||
// export an object
|
||||
module.exports = {
|
||||
name: "Alice",
|
||||
age: 25,
|
||||
};
|
||||
```
|
||||
|
||||
To import a module in Node.js, you can use the require function and pass the path of the module file as an argument. The require function will return the value of module.exports from the module file. For example:
|
||||
|
||||
```javascript
|
||||
// main.js
|
||||
// import a function
|
||||
const add = require("./my-module.js");
|
||||
console.log(add(2, 3)); // 5
|
||||
|
||||
// import an object
|
||||
const person = require("./my-module.js");
|
||||
console.log(person.name); // Alice
|
||||
console.log(person.age); // 25
|
||||
```
|
||||
|
||||
Note that Node.js will cache the modules that are imported with require, so if you import the same module multiple times, you will get the same instance of the module.
|
||||
|
||||
## How to export modules in ES6?
|
||||
|
||||
ES6 is the version of Javascript that introduced many new features, including a native module system. ES6 modules use the `import` and `export` syntax.
|
||||
|
||||
To export a module in ES6, you can use the `export` keyword followed by the declaration of the value that you want to export. You can also use the export keyword with curly braces to export a list of named values. For example:
|
||||
|
||||
```javascript
|
||||
// my-module.js
|
||||
// export a function
|
||||
export function add(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
// export a class
|
||||
export class Person {
|
||||
constructor(name, age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
}
|
||||
|
||||
// export an object
|
||||
export const person = {
|
||||
name: "Alice",
|
||||
age: 25,
|
||||
};
|
||||
```
|
||||
|
||||
To import a module in ES6, you can use the `import` keyword followed by the name of the value that you want to import and the path of the module file. You can also use the import keyword with curly braces to import a list of named values. For example:
|
||||
|
||||
```javascript
|
||||
// main.js
|
||||
// import a function
|
||||
import { add } from "./my-module.js";
|
||||
console.log(add(2, 3)); // 5
|
||||
|
||||
// import a class
|
||||
import { Person } from "./my-module.js";
|
||||
const person = new Person("Bob", 30);
|
||||
console.log(person.name); // Bob
|
||||
console.log(person.age); // 30
|
||||
|
||||
// import an object
|
||||
import { person as Alice } from "./my-module.js";
|
||||
console.log(Alice.name); // Alice
|
||||
console.log(Alice.age); // 25
|
||||
```
|
||||
|
||||
Note that ES6 modules are imported and executed only once, so if you import the same module multiple times, you will get the same instance of the module.
|
||||
|
||||
## What is the difference between export default and module.exports?
|
||||
|
||||
One of the main differences between export default and module.exports is that export default is an ES6 feature, while module.exports is a CommonJS feature. Therefore, they are not compatible with each other by default. However, some tools like Babel or Webpack can transpile ES6 modules to CommonJS modules, or vice versa, to make them work together.
|
||||
|
||||
Another difference is that export default can only export one value per module, while module.exports can export any value, including multiple values. For example:
|
||||
|
||||
```javascript
|
||||
// my-module.js
|
||||
// export default a function
|
||||
export default function add(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
// export default an object
|
||||
export default {
|
||||
name: "Alice",
|
||||
age: 25,
|
||||
};
|
||||
|
||||
// export default a class
|
||||
export default class Person {
|
||||
constructor(name, age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```javascript
|
||||
// my-module.js
|
||||
// export a function
|
||||
module.exports = function add(a, b) {
|
||||
return a + b;
|
||||
};
|
||||
|
||||
// export an object
|
||||
module.exports = {
|
||||
name: "Alice",
|
||||
age: 25,
|
||||
};
|
||||
|
||||
// export a class
|
||||
module.exports = class Person {
|
||||
constructor(name, age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
Note that you can only have one export default statement per module, but you can have multiple module.exports statements. However, each module.exports statement will overwrite the previous one, so only the last one will be exported.
|
||||
|
||||
To import a default export, you can use the import keyword without curly braces and assign any name to the imported value. For example:
|
||||
|
||||
```javascript
|
||||
// main.js
|
||||
// import a default export
|
||||
import add from "./my-module.js";
|
||||
console.log(add(2, 3)); // 5
|
||||
|
||||
// import another default export
|
||||
import person from "./my-module.js";
|
||||
console.log(person.name); // Alice
|
||||
console.log(person.age); // 25
|
||||
|
||||
// import another default export
|
||||
import Person from "./my-module.js";
|
||||
const person = new Person("Bob", 30);
|
||||
console.log(person.name); // Bob
|
||||
console.log(person.age); // 30
|
||||
```
|
||||
|
||||
To import a module.exports value, you can use the require function and assign any name to the imported value. For example:
|
||||
|
||||
```javascript
|
||||
// main.js
|
||||
// import a module.exports value
|
||||
const add = require("./my-module.js");
|
||||
console.log(add(2, 3)); // 5
|
||||
|
||||
// import another module.exports value
|
||||
const person = require("./my-module.js");
|
||||
console.log(person.name); // Alice
|
||||
console.log(person.age); // 25
|
||||
|
||||
// import another module.exports value
|
||||
const Person = require("./my-module.js");
|
||||
const person = new Person("Bob", 30);
|
||||
console.log(person.name); // Bob
|
||||
console.log(person.age); // 30
|
||||
```
|
||||
|
||||
Node’s JavaScript has diverged from that of the browser. Understanding both CommonJS modules and ES6 modules is your first step in becoming a 10X developer. Happy coding!
|
||||
@@ -1,409 +0,0 @@
|
||||
+++
|
||||
title = "mmuctf 2025 writeup"
|
||||
description = "mmuctf 2025 challenges writeup"
|
||||
date = 2025-08-03
|
||||
[taxonomies]
|
||||
tags = ["ctf", "rev", "web", "forensics"]
|
||||
+++
|
||||
|
||||
|
||||
Over the weekend, I had the opportunity to participate in the mmuctf 2025. It was an individual jeopardy style CTF targeted towards beginners and intermediate people in cybersecurity. This is a write-up to explore some challenges I did, or at least almost did.
|
||||
|
||||
## Welcome
|
||||
|
||||
>Through the shadows of the cave, at the door I had a zeal to get a welcome flag, but I couldn't see it though
|
||||
I could hear it calling for me to get it. Happy hacking
|
||||
{: .prompt-info }
|
||||
|
||||
This was a sanity check flag. I believe competitions pose such challenges that you can't get zero points. It's the same as flags in Discord servers, a flag after completing the feedback form, or just other free points.
|
||||
|
||||
The challenge description talked about the `door`, my first instinct was to view the source of the front page. I got this html comment with what looked liked a base64 encoded string `<!--bW11Y3Rme3dlbGNvbWVfZmxhZ19hZGlvc19NdWNoQGNob30= -->`
|
||||
|
||||
```zsh
|
||||
┌──(mockingspectre㉿blackout)-[~/ctf/mmuctf2025]
|
||||
└─$ echo -n "bW11Y3Rme3dlbGNvbWVfZmxhZ19hZGlvc19NdWNoQGNob30=" | base64 -d
|
||||
mmuctf{welcome_flag_adios_Much@cho}
|
||||
```
|
||||
|
||||
## My First App
|
||||
|
||||
>Our intern dev swears this app’s secure...
|
||||
|
||||
This was a web challenge with an account creation form. Let's fire up Burp. The account creation request didn't seem suspicious for now, so I sent it to the repeater to abuse it some more. The response seemed interesting, the user id was in the query parameter: `GET /profile.php?id=5 HTTP/1.1`. This was a nice candidate for an Insecure Direct Object Reference(IDOR). I tried repeating the request with values from 0-4. The flag was at 1, the admin user's account.
|
||||
|
||||
```txt
|
||||
mmuctf{1d0r_4dm1n_4cc3ss_1s_c0mpr0m1s3d}
|
||||
```
|
||||
|
||||
## Ledilect
|
||||
|
||||
>Sometimes the path you take is just a jump away.
|
||||
|
||||
This was a simple one, I knew what the challenge wanted, but I couldn't get myself to exploit it, definitely a skill issue. The webapp had a landing page that had a button that made this request:
|
||||
|
||||
```txt
|
||||
GET /portal/jump.php?url=https://example.com HTTP/1.1
|
||||
Host: redacted
|
||||
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
|
||||
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
||||
Accept-Language: en-US, en;q=0.5
|
||||
Accept-Encoding: gzip, deflate, br
|
||||
Connection: keep-alive
|
||||
Referer: redacted
|
||||
Cookie: PHPSESSID=ce7743f6cd447d7a1ee94e230c3d9cdb
|
||||
Upgrade-Insecure-Requests: 1
|
||||
Priority: u=0, i
|
||||
```
|
||||
|
||||
Looking at that, I suspected an open redirect vulnerability, but I don't know anything about this bug class. I let it rest.
|
||||
|
||||
## Meet my X
|
||||
|
||||
>In the�days оf cοmfort i met this girl at the Jobless соrner. Аt the�doоrs and windows of iddleness i approached, oops she smiled and thats how i knew she was the one. I guess thatsss whyyy i learned on getting Flags because be warned she later left me at first it feels like a green flag i guess no life was there on blood(heart_break)
|
||||
|
||||
This challenge involved homoglyphs, a character or a sequence of characters that looks very similar or identical to another character or sequence of characters, but has a different meaning, encoding, or origin.
|
||||
|
||||
A sentence might look normal, but if you copy it into a text editor that shows Unicode details or a specialized homoglyph detector, you'll see different underlying character codes.
|
||||
|
||||
I used these online decoders, <https://wulfsige.com/crypto/> and <https://holloway.nz/steg/> to get the flag:
|
||||
|
||||
```txt
|
||||
mmuctf{oops_twitter_steg_1s_fun}
|
||||
```
|
||||
|
||||
## Shadow
|
||||
|
||||
>Look beyond the appearance, perhaps their numerical essence will guide you to the flag.
|
||||
Can you reveal what lurks in the shadow?
|
||||
|
||||
This was another stego challenge; there is an image with what looks like a color palette. The description hints at 'numerical essence', so it might be something to deal with the hex values of the colors. I used this site <https://imagecolorpicker.com/> to extract the hex values.
|
||||
|
||||
```txt
|
||||
#6d6d75
|
||||
#637466
|
||||
#7b346c
|
||||
#773479
|
||||
#355f68
|
||||
#316464
|
||||
#336e5f
|
||||
#316e35
|
||||
#64335f
|
||||
#6d337d
|
||||
```
|
||||
|
||||
Decoded becomes
|
||||
|
||||
```txt
|
||||
mmuctf{4lw4y5_h1dd3n_1n5d3_m3}
|
||||
```
|
||||
|
||||
## Revealme
|
||||
|
||||
>We found this mysterious executable on an old USB stick... Can you figure out how to get it to reveal the flag?
|
||||
|
||||
The provided file is an ELF executable binary.
|
||||
|
||||
```zsh
|
||||
┌──(mockingspectre㉿blackout)-[~/ctf/mmuctf2025]
|
||||
└─$ file revealme
|
||||
revealme: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=d8546bb2c10c0226384fb2771684af9bc150b55e, for GNU/Linux 3.2.0, stripped
|
||||
```
|
||||
|
||||
```zsh
|
||||
┌──(mockingspectre㉿blackout)-[~/ctf/mmuctf2025]
|
||||
└─$ checksec --file=revealme
|
||||
RELRO STACK CANARY NX PIE RPATH RUNPATH Symbols FORTIFY Fortified Fortifiable FILE
|
||||
Partial RELRO No canary found NX enabled PIE enabled No RPATH No RUNPATH No Symbols No 0 2 revealme
|
||||
```
|
||||
|
||||
Opening it with Binary Ninja gives us a quick win:
|
||||
|
||||
```asm
|
||||
00401179 int32_t main(int32_t argc, char** argv, char** envp)
|
||||
|
||||
|
||||
00401179 55 push rbp {__saved_rbp}
|
||||
0040117a 4889e5 mov rbp, rsp {__saved_rbp}
|
||||
0040117d 4883ec70 sub rsp, 0x70
|
||||
00401181 488d05800e0000 lea rax, [rel data_402008]
|
||||
00401188 4889c7 mov rdi, rax {data_402008, "Enter the secret passphrase: "}
|
||||
0040118b b800000000 mov eax, 0x0
|
||||
00401190 e8abfeffff call printf
|
||||
00401195 488b15a42e0000 mov rdx, qword [rel stdin]
|
||||
0040119c 488d4590 lea rax, [rbp-0x70 {buf}]
|
||||
004011a0 be64000000 mov esi, 0x64
|
||||
004011a5 4889c7 mov rdi, rax {buf}
|
||||
004011a8 e8b3feffff call fgets
|
||||
004011ad 488d4590 lea rax, [rbp-0x70 {buf}]
|
||||
004011b1 488d156e0e0000 lea rdx, [rel data_402026]
|
||||
004011b8 4889d6 mov rsi, rdx {data_402026}
|
||||
004011bb 4889c7 mov rdi, rax {buf}
|
||||
004011be e88dfeffff call strcspn
|
||||
004011c3 c644059000 mov byte [rbp+rax-0x70 {buf}], 0x0
|
||||
004011c8 488d4590 lea rax, [rbp-0x70 {buf}]
|
||||
004011cc 488d15550e0000 lea rdx, [rel data_402028]
|
||||
004011d3 4889d6 mov rsi, rdx {data_402028, "OpenSesame123!"}
|
||||
004011d6 4889c7 mov rdi, rax {buf}
|
||||
004011d9 e892feffff call strcmp
|
||||
004011de 85c0 test eax, eax
|
||||
004011e0 7511 jne 0x4011f3
|
||||
|
||||
|
||||
004011e2 488d054f0e0000 lea rax, [rel data_402038]
|
||||
004011e9 4889c7 mov rdi, rax {data_402038, "Correct! The flag is: mmuctf{r3v3rs1ng_st4rt3r}"}
|
||||
004011ec e83ffeffff call puts
|
||||
004011f1 eb0f jmp 0x401202
|
||||
|
||||
|
||||
004011f3 488d056e0e0000 lea rax, [rel data_402068]
|
||||
004011fa 4889c7 mov rdi, rax {data_402068, "Nope, try again."}
|
||||
004011fd e82efeffff call puts
|
||||
|
||||
|
||||
00401202 b800000000 mov eax, 0x0
|
||||
00401207 c9 leave {__saved_rbp}
|
||||
00401208 c3 retn {__return_addr}
|
||||
```
|
||||
|
||||
Flag:
|
||||
|
||||
```txt
|
||||
mmuctf{r3v3rs1ng_st4rt3r}
|
||||
```
|
||||
|
||||
## Flicker
|
||||
|
||||
>An ordinary looking Android app... or is it?
|
||||
|
||||
The provided app is an Android APK. Let's fire up jadx-gui. The package name is `com.example.blink`. There is an interesting class `r2d2`. In the onCreate method, there is an image string variable that seems to contain base64 image data.
|
||||
|
||||
```zsh
|
||||
┌──(mockingspectre㉿blackout)-[~/ctf/mmuctf2025]
|
||||
└─$ cat output.txt | base64 -d > decoded_image.png
|
||||
```
|
||||
|
||||
flag:
|
||||
|
||||
```txt
|
||||
CTF{PUCKMAN}
|
||||
```
|
||||
|
||||
## Open_Secrets
|
||||
|
||||
>Someone trusted the wrong site and network didn’t forget. Can you piece together what was left behind?
|
||||
Some people still think locks are optional on digital doors.*
|
||||
|
||||
The provided file was a network capture pcap file. For people who don't know, pcap (a packet capture) consists of an application programming interface (API) for capturing network traffic.The challenge title and filename hint at unencrypted traffic. Open up Wireshark and apply an HTTP filter. There is an HTTP stream that leaks the flag:
|
||||
|
||||
```txt
|
||||
mmuctf{plaintext_login_leak}
|
||||
```
|
||||
|
||||
## C-x C-s
|
||||
|
||||
> Ugh, I keep typing ^x ^s in my shell instead of saving, should’ve stuck with Emacs
|
||||
|
||||
This one made me mad. I thought I had the flag, but I couldn't get it. The provided file is a PCAP file. Another network forensics challenge, or so I thought.
|
||||
|
||||
opened the file with Wireshark packet and noticed a new kind of communication, to be honest, I didn't know this was possible until I understood what was happening...
|
||||
|
||||
I found some articles dealing with this
|
||||
|
||||
- <https://abawazeeer.medium.com/kaizen-ctf-2018-reverse-engineer-usb-keystrok-from-pcap-file-2412351679f4>
|
||||
- <https://res260.medium.com/usb-pcap-forensics-barcode-scanner-nsec-ctf-2021-writeup-part-1-3-b0a5392c9313>
|
||||
- <https://steemit.com/reverseengineering/@nileshevrywhr/auth0-ctf-reverse-engineering-usb-keystrokes-from-pcaps>
|
||||
|
||||
The source and destination use object IDs for communication, something I gathered when reading about the SNMP
|
||||
protocol, USB(Universal Serial Bus)
|
||||
it's apparent I'm not dealing with any 802.x traffic
|
||||
|
||||
Interrupts happen whenever you press a key or click a button, anything that "interrupts" the CPU, after which it has to process your input. Each URB_INTERRUPT in the file corresponds to a key pressed, and the Leftover Capture Data field shows the hex value of the key in 8-byte format.
|
||||
|
||||
Creating a filter to list all interrupt communication with non-empty 8 bytes
|
||||
|
||||
```txt
|
||||
usb.transfer_type == 0x01
|
||||
```
|
||||
|
||||
```txt
|
||||
usb.transfer_type == 0x01 && usb.dst == "host" && !(usb.capdata == 00:00:00:00:00:00:00:00)
|
||||
```
|
||||
|
||||
Crafting a tshark command to get the leftover capture data for the above filters and redirect it into a file
|
||||
|
||||
```zsh
|
||||
tshark -r log.pcap -Tfields -Eseparator=, -e thekey.pcapng -Y 'usb.transfer_type == 0x01 && usb.dst == "host" && !(usb.capdata == 00:00:00:00:00:00:00:00)' | sed 's/://g' > usb.capdata
|
||||
```
|
||||
|
||||
```zsh
|
||||
┌──(mockingspectre㉿blackout)-[~/ctf/mmuctf2025]
|
||||
└─$ tshark -r thekey.pcapng -Tfields -Eseparator=, -e usb.capdata -Y 'usb.transfer_type == 0x01 && usb.dst == "host" && !(usb.capdata == 00:00:00:00:00:00:00:00)' | sed 's/://g' > usb.capdata
|
||||
|
||||
┌──(mockingspectre㉿blackout)-[~/ctf/mmuctf2025]
|
||||
└─$ cat usb.capdata
|
||||
0000190000000000
|
||||
00000c0000000000
|
||||
00000c1000000000
|
||||
0000102c00000000
|
||||
00002c0000000000
|
||||
0000090000000000
|
||||
00000f0000000000
|
||||
0000040000000000
|
||||
0000040a00000000
|
||||
................
|
||||
```
|
||||
|
||||
Python script to decode the hex values to strings:
|
||||
|
||||
```python
|
||||
keyboard = {
|
||||
2: "PostFail", 4: "a", 5: "b", 6: "c", 7: "d", 8: "e", 9: "f", 10: "g", 11: "h", 12: "i", 13: "j", 14: "k", 15: "l", 16: "m", 17: "n", 18: "o", 19: "p", 20: "q", 21: "r", 22: "s", 23: "t", 24: "u", 25: "v", 26: "w", 27: "x", 28: "y", 29: "z", 30: "1", 31: "2", 32: "3", 33: "4", 34: "5", 35: "6", 36: "7", 37: "8", 38: "9", 39: "0", 40: "Enter", 41: "esc", 2: "del", 43: "tab", 44: "space", 45: "-", 47: "[", 48: "]", 51: "DownArrow", 54: "1", 55: "*", 56: "/", 57: "CapsLock", 79: "RightArrow", 80: "LeftArrow"
|
||||
}
|
||||
|
||||
|
||||
with open("usb.capdata") as file:
|
||||
i = 1
|
||||
for line in file:
|
||||
bytesArray = bytearray.fromhex(line.strip())
|
||||
for byte in bytesArray:
|
||||
if byte != 0:
|
||||
keyVal = int(byte)
|
||||
|
||||
|
||||
if keyVal in keyboard:
|
||||
print(keyboard[keyVal])
|
||||
else:
|
||||
print("no map found for this value: " + str(keyVal))
|
||||
|
||||
|
||||
i += 1
|
||||
```
|
||||
|
||||
Running the code outputs what seems to be Vim motions. I wasn't able to decipher this to a correct flag:
|
||||
|
||||
```txt
|
||||
v
|
||||
i
|
||||
m
|
||||
space
|
||||
space
|
||||
f
|
||||
l
|
||||
a
|
||||
g
|
||||
g
|
||||
*
|
||||
t
|
||||
t
|
||||
x
|
||||
t
|
||||
Enter
|
||||
i
|
||||
3
|
||||
t
|
||||
t
|
||||
h
|
||||
e
|
||||
space
|
||||
f
|
||||
l
|
||||
a
|
||||
g
|
||||
g
|
||||
space
|
||||
i
|
||||
s
|
||||
space
|
||||
c
|
||||
t
|
||||
f
|
||||
esc
|
||||
v
|
||||
b
|
||||
3
|
||||
u
|
||||
u
|
||||
3
|
||||
a
|
||||
3
|
||||
[
|
||||
[
|
||||
m
|
||||
y
|
||||
3
|
||||
-
|
||||
3
|
||||
f
|
||||
a
|
||||
v
|
||||
o
|
||||
r
|
||||
i
|
||||
t
|
||||
e
|
||||
e
|
||||
3
|
||||
-
|
||||
e
|
||||
d
|
||||
i
|
||||
t
|
||||
o
|
||||
r
|
||||
3
|
||||
-
|
||||
3
|
||||
i
|
||||
s
|
||||
3
|
||||
-
|
||||
v
|
||||
i
|
||||
m
|
||||
3
|
||||
]
|
||||
esc
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
h
|
||||
a
|
||||
u
|
||||
esc
|
||||
v
|
||||
i
|
||||
3
|
||||
[
|
||||
3
|
||||
3
|
||||
u
|
||||
3
|
||||
esc
|
||||
3
|
||||
DownArrow
|
||||
DownArrow
|
||||
w
|
||||
q
|
||||
Enter
|
||||
a
|
||||
tab
|
||||
a
|
||||
e
|
||||
```
|
||||
|
||||
These are the challenges I had the time to tackle. if you have any insights or suggestions. Share them in the comments
|
||||
@@ -1,118 +0,0 @@
|
||||
+++
|
||||
title = "Setting up Obsidian sync in Windows"
|
||||
description = "Syncing Obsidian in Windows with Windows Task Scheduler with git"
|
||||
author = "mockingspectre"
|
||||
date = 2023-10-01
|
||||
[taxonomies]
|
||||
tags = ["obsidian", "git","sync", "windows", "cron", "task scheduler", "powershell"]
|
||||
+++
|
||||
|
||||
Syncing Obsidian in Windows with Windows Task Scheduler and git
|
||||
|
||||
[Obsidian](https://obsidian.md/) is a powerful note-taking and knowledge management tool that has gained a dedicated following among researchers, writers, and knowledge workers. To make the most of Obsidian, it's essential to keep your notes synchronized across devices and ensure your data is regularly backed up.Obsidian is the private and flexible writing app that adapts to the way you think.
|
||||
|
||||
Obsidian is free for personal use.It does not charge based on features or usage.You only pay if you use Obsidian commercially.
|
||||
|
||||
In this article, we'll guide you through the process of setting up automated synchronization for your Obsidian vault on Windows using Windows Task Scheduler and a PowerShell script.[^note]
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before we dive into setting up the synchronization task, ensure you have the following prerequisites in place:
|
||||
|
||||
1. **Obsidian Installed:** Make sure Obsidian is [installed](https://obsidian.md/download) on your Windows computer, and you have an existing Obsidian vault that you want to sync.
|
||||
|
||||
1. **Git Installed:** You'll need Git installed and configured with your Obsidian vault's repository. If you haven't already done this, you can download Git from the [official website](https://git-scm.com/downloads) and follow the installation instructions.
|
||||
|
||||
1. **PowerShell Script:** The provided PowerShell script, sync.ps1, should be located in your Obsidian vault folder.
|
||||
|
||||
## Understanding the PowerShell Script
|
||||
|
||||
The provided PowerShell script, sync.ps1, is the heart of our synchronization task. It automates the process of committing changes in your Obsidian vault's Git repository and pushing them to your remote repository (e.g., GitHub or GitLab). Here's a brief overview of the script:
|
||||
|
||||
```ps1
|
||||
# Define the folder path
|
||||
$FolderPath = "C:\path\to\obsidian-vault"
|
||||
|
||||
# Change directory to the repository folder
|
||||
Set-Location -Path $FolderPath
|
||||
|
||||
# Check if the working tree is clean
|
||||
$IsClean = (git diff-index --quiet HEAD --) -or (git diff-files --quiet)
|
||||
|
||||
if ($IsClean) {
|
||||
Write-Host "Working tree is clean. Skipping commit and pushing changes."
|
||||
git push
|
||||
} else {
|
||||
# Get the current date in the desired format (Day - Date)
|
||||
$CommitMessage = "$(Get-Date -Format 'dddd - yyyy-MM-dd HH:mm:ss')"
|
||||
|
||||
# Commit the changes
|
||||
git add .
|
||||
git commit -m $CommitMessage
|
||||
|
||||
# Push the changes
|
||||
git push
|
||||
}
|
||||
```
|
||||
|
||||
This script does the following:
|
||||
|
||||
- Sets the folder path to your Obsidian vault.
|
||||
- Checks if there are any changes to commit. If the vault is clean (no changes), it skips the commit and only pushes changes.
|
||||
- If there are changes, it commits them with a timestamped message and then pushes them to the remote repository.
|
||||
|
||||
## Setting up Windows Task Scheduler
|
||||
|
||||
Now that we have our PowerShell script ready, let's set up a scheduled task using Windows Task Scheduler to automate the synchronization process. Follow these steps:
|
||||
|
||||
1. **Open an Elevated PowerShell Prompt:** To run the necessary commands, open PowerShell as an administrator.
|
||||
|
||||
1. **Define Task Variables:** Execute the following commands to define variables for your task:
|
||||
|
||||
```ps1
|
||||
$ScriptPath = "C:\path\to\obsidian-vault\sync.ps1"
|
||||
$TaskName = "obsidian-sync"
|
||||
$UserAccount = "$env:USERDOMAIN\$env:USERNAME"
|
||||
```
|
||||
|
||||
Replace $ScriptPath with the actual path to your sync.ps1 script, $TaskName with a name for your task.
|
||||
|
||||
1. **Configure Task Trigger:** Set up a trigger for your task. In this example, we'll schedule the task to run daily at 9:00 PM:
|
||||
|
||||
```ps1
|
||||
$Trigger = New-ScheduledTaskTrigger -Daily -At '9:00 PM'
|
||||
```
|
||||
|
||||
You can adjust the schedule according to your preference.
|
||||
|
||||
1. Define Task Principal and Settings: Configure the task's principal (the user account under which the task will run) and settings:
|
||||
|
||||
```ps1
|
||||
$Principal = New-ScheduledTaskPrincipal -UserId $UserAccount -RunLevel Highest
|
||||
$Settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -RunOnlyIfNetworkAvailable -WakeToRun
|
||||
```
|
||||
|
||||
These settings ensure that the task runs with the necessary privileges and conditions.
|
||||
|
||||
1. **Define Task Action:** Specify the action that the task will perform, which is running the PowerShell script:
|
||||
|
||||
```ps1
|
||||
$Action = New-ScheduledTaskAction -Execute 'PowerShell.exe' -Argument "-ExecutionPolicy Bypass -WindowStyle Hidden -File `"$ScriptPath`""
|
||||
```
|
||||
|
||||
This action runs PowerShell with the provided script.
|
||||
|
||||
1. **Create the Scheduled Task:** Finally, create the scheduled task and register it with Windows Task Scheduler:
|
||||
|
||||
```ps1
|
||||
$Task = New-ScheduledTask -Action $Action -Trigger $Trigger -Principal $Principal -Settings $Settings
|
||||
Register-ScheduledTask -TaskName $TaskName -InputObject $Task
|
||||
```
|
||||
|
||||
The Obsidian synchronization task is now set up and ready to run automatically based on the schedule you defined.
|
||||
|
||||
# Inspiration
|
||||
|
||||
When looking up on how to implement this I found some breakthrough from this [stack overflow](https://stackoverflow.com/questions/7195503/setting-up-a-cron-job-in-windows) post. There are suggestions on how to do this using cron jobs in wsl. They are worth a look at. This article on [powershell](https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/new-scheduledtask?view=windowsserver2022-ps) with windows server was also helpful.
|
||||
|
||||
[^note]: This method is only optimal for desktop sync. To sync across devices obsidian has a paid plan that has some extra features Such as Sync notes across devices, End-to-end encryption, Version history, Priority email support. Consider checking it out at [https://obsidian.md/pricing](https://obsidian.md/pricing)
|
||||
@@ -1,87 +0,0 @@
|
||||
+++
|
||||
title= "Semantic Versioning(SemVer) and Conventional Commits"
|
||||
description = "Adopting best practices in your git and build workflows."
|
||||
date= 2023-01-24T15:34:14.160Z
|
||||
author = "mockingspectre"
|
||||
[taxonomies]
|
||||
tags= ["git", "semver","workflow", "conventional commits"]
|
||||
+++
|
||||
|
||||
Adopting best practices in your git and build workflows.
|
||||
|
||||
# What is Semver?
|
||||
|
||||
Semantic versioning or just SemVer is a dependency naming guidline that aims to bring some sanity into naming libraries and packages in software development. It is a standard versioning system created by **Tom Preston Werner** (co-founder of Github) that’s used to communicate what changes are in a release.
|
||||
|
||||
An efficient and smooth versioning becomes crucial for efficient software delivery expecially for projects that expose a public API. This saves the developers the chaos that is **dependency hell**.Dependency hell is a colloquial term for the frustration of some software users who have installed software packages which have dependencies on specific versions of other software packages.
|
||||
|
||||
The dependency issue arises when several packages have dependencies on the same shared packages or libraries, but they depend on different and incompatible versions of the shared packages. If the shared package or library can only be installed in a single version, the user may need to address the problem by obtaining newer or older versions of the dependent packages. This, in turn, may break other dependencies and push the problem to another set of packages.
|
||||
|
||||
## Semantic Versioning Specifications
|
||||
|
||||
### Summary
|
||||
|
||||
Semantic versioning is based on three numbers that indicate the versions of the software and the compatibilities.They are `X.Y.Z` corresponding to `Major.Minor.Patch`
|
||||
|
||||
- **Major Version (X):**Introduces major changes to the code and breaking changes toward backward compatibility
|
||||
- **Minor Version (Y):** These code changes don’t introduce breaking changes. This could be adding a new feature that doesn't break changes but are not exactly bug fixes.
|
||||
- **Patches (Z):** Mainly correspond to bug fixes
|
||||
|
||||
### Examples in common packages
|
||||
|
||||
#### React(v18.2.0)
|
||||
|
||||

|
||||
|
||||
- **Major -> 18**
|
||||
- **Minor -> 2**
|
||||
- **Patch -> 0**
|
||||
|
||||
---
|
||||
|
||||
#### Pipx(v1.1.0)
|
||||
|
||||

|
||||
|
||||
- **Major -> 1**
|
||||
- **Minor -> 1**
|
||||
- **Patch -> 0**
|
||||
|
||||
---
|
||||
|
||||
## Start at v0.1.0 or v1.0.0?
|
||||
|
||||
Convention recommends that in the initial development phase the starting version should be 0.1.0 which makes sense since it’s not in production yet.
|
||||
|
||||
The version should only be bumped to 1.0.0 only if it is being used in production and stable.
|
||||
|
||||
If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.
|
||||
|
||||
# Conventional Commits
|
||||
|
||||
Conventional Commits is a convention on top of commit messages that are used to automate version changes. It provides an easy set of rules for creating commit messages and works well with SemVer by describing features, fixes and breaking changes that correspond to SemVer standards.
|
||||
|
||||
## Summary
|
||||
|
||||
The commit message should be structured as follows:
|
||||
|
||||
```
|
||||
<type>[optional scope]: <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer(s)]
|
||||
```
|
||||
|
||||
The commit contains the following structural elements, to communicate intent to the consumers of your library:
|
||||
|
||||
1. fix: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning).
|
||||
2. feat: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning).
|
||||
3. BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.
|
||||
4. types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends build:, chore:, ci:, docs:, style:, refactor:, perf:, test:, and others.
|
||||
5. footers other than BREAKING CHANGE: <description> may be provided and follow a convention similar to git trailer format.
|
||||
|
||||
# Resources
|
||||
|
||||
<https://semver.org/>
|
||||
<https://www.conventionalcommits.org/en/v1.0.0/>
|
||||
@@ -1,120 +0,0 @@
|
||||
+++
|
||||
title= "Subresource Integrity"
|
||||
description = "Understanding Subresource Integrity"
|
||||
date= 2023-04-29
|
||||
author = "mockingspectre"
|
||||
[taxonomies]
|
||||
tags= ["subresource integrity", "csp", "cors"]
|
||||
+++
|
||||
|
||||
Understanding Subresource Integrity
|
||||
|
||||
In my junior year while I was learning HTML and CSS I got to use the Bootstrap css library.The easiest way to obtain the files was from a Content Delivery Network(CDN). I could see links such as:
|
||||
|
||||
```html
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
```
|
||||
|
||||
I didn't bother with the `integrity` attribute of the link(guess I wasn't curios enough). The integrity attribute has a cryptographic hash value that is important in CDNs and its called the Subresource Integrity.
|
||||
|
||||
Subresource Integrity (SRI) is a security feature in web browsers that helps prevent malicious or compromised scripts from being loaded and executed on a website.a security feature that enables browsers to verify that resources they fetch (for example, from a CDN) are delivered without unexpected manipulation. It works by allowing you to provide a cryptographic hash that a fetched resource must match.
|
||||
|
||||
When a resource, such as a script or stylesheet, fails the SRI check, the browser will block the resource from being loaded and displayed on the website.
|
||||
|
||||
# How Subresource Integrity Helps
|
||||
|
||||
Subresource Integrity (SRI) is a security feature that helps protect against certain types of attacks, such as those that involve malicious modifications to third-party resources that a website loads.
|
||||
|
||||
SRI works by allowing a website to specify a cryptographic hash for a particular external resource (such as a JavaScript file or a CSS stylesheet) that it expects to load. When a user's browser fetches that resource, it checks the hash against the actual contents of the resource. If the hash doesn't match, the browser will refuse to load the resource, indicating that it may have been tampered with.
|
||||
|
||||
This can help prevent a variety of attacks, such as those involving a compromised content delivery network (CDN) or a man-in-the-middle attacker who intercepts and modifies network traffic. By using SRI, a website can help ensure that it is loading only the resources it expects, and that those resources have not been tampered with in transit.
|
||||
|
||||
# Using it
|
||||
|
||||
Using Subresource Integrity (SRI) involves a few steps, but it is relatively straightforward.An integrity value begins with at least one string, with each string including a prefix indicating a particular hash algorithm (currently the allowed prefixes are sha256, sha384, and sha512), followed by a dash, and ending with the actual base64-encoded hash.
|
||||
|
||||
- Generate a cryptographic hash(a base64-encoded cryptographic hash) of the external resource you want to load on your website. This can be done using a hash function such as SHA-256.
|
||||
|
||||
- Add the hash as an attribute to the tag that loads the external resource. For example, for a JavaScript file, you would add the integrity attribute to the `<script>` tag like this:
|
||||
|
||||
```html
|
||||
<script
|
||||
src="https://example.com/example.js"
|
||||
integrity="sha256-ABC123XYZ456"
|
||||
></script>
|
||||
```
|
||||
|
||||
> An integrity value may contain multiple hashes separated by whitespace. A resource will be loaded if it matches one of those hashes.
|
||||
|
||||
Make sure the hash you've generated matches the actual contents of the external resource.
|
||||
|
||||
Test your website to ensure that the external resource is loading correctly and that the SRI feature is working as intended.
|
||||
|
||||
# Tools for generating SRI hashes
|
||||
|
||||
You can use a tool such as the [SRI Hash Generator](https://www.srihash.org/) to generate the hash and check it against the file's contents.
|
||||
|
||||
You can generate SRI hashes from the command-line with openssl using a command invocation such as:
|
||||
|
||||
```sh
|
||||
cat FILENAME.py | openssl dgst -sha384 -binary | openssl base64 -A
|
||||
```
|
||||
|
||||
or with shasum using a command invocation such as:
|
||||
|
||||
```sh
|
||||
shasum -b -a 384 FILENAME.js | awk '{ print $1 }' | xxd -r -p | base64
|
||||
```
|
||||
|
||||
> The pipe-through xxd step takes the hexadecimal output from shasum and converts it to binary.
|
||||
> The pipe-through awk step is necessary because shasum will pass the hashed filename in its output to xxd. That can have disastrous consequences if the filename happens to have valid hex characters in it — because xxd will also decode that and pass it to base64.
|
||||
|
||||
In a Windows environment, you can create a tool for generating SRI hashes with the following code:
|
||||
|
||||
```bat
|
||||
@echo off
|
||||
set bits=384
|
||||
openssl dgst -sha%bits% -binary %1% | openssl base64 -A > tmp
|
||||
set /p a= < tmp
|
||||
del tmp
|
||||
echo sha%bits%-%a%
|
||||
pause
|
||||
```
|
||||
|
||||
To use that code:
|
||||
|
||||
1. Save that code in a file named sri-hash.bat in the Windows SendTo folder in your environment (for example, C:\Users\USER\AppData\Roaming\Microsoft\Windows\SendTo).
|
||||
1. Right-click a file in the File Explorer, select Send to…, and then select sri-hash. You will see the integrity value in a command box.
|
||||
1. Select the integrity value and right-click to copy it to the Clipboard.
|
||||
1. Press any key to dismiss the command box
|
||||
|
||||
# Cross-Origin Resource Sharing and Subresource Integrity
|
||||
|
||||
When verifying the subresource integrity of a resource that originates from a different domain than the document it's embedded in, web browsers will check the resource using Cross-Origin Resource Sharing (CORS) to ensure that the domain serving the resource allows it to be shared with the requesting domain.
|
||||
As a result, the resource must be served with an Access-Control-Allow-Origin header that permits the resource to be shared with the requesting domain. For example, the header could include a wildcard (\*) to allow any domain to access the resource.
|
||||
|
||||
```
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
If the script or stylesheet fails to match its associated integrity value, the browser will refuse to execute the script or apply the stylesheet and return a network error, indicating that the fetching of that script or stylesheet failed. This behavior ensures that the resource being loaded is trustworthy and helps to protect users from potential security threats.
|
||||
|
||||
# References
|
||||
|
||||
- [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)
|
||||
@@ -1,65 +0,0 @@
|
||||
+++
|
||||
title = "What say you?"
|
||||
description = "Adding a comment system by utterances"
|
||||
author = "mockingspectre"
|
||||
date = 2023-08-24T15:34:14.160Z
|
||||
[taxonomies]
|
||||
tags = ["blog", "utterances"]
|
||||
+++
|
||||
|
||||
Free speech enhanced
|
||||
|
||||
There is no point in writing online if your readers cannot provide feedback for your writings. You might as well be shouting at a void. My ideal commenting system has to be free, open source and should not be a hassle to setup. Luckily, [utterances 🔮](https://github.com/utterance/utterances) checks all of these conditions
|
||||
|
||||
It is a lightweight comments widget built on GitHub issues. Use GitHub issues for blog comments, wiki pages and more! The notable features are:
|
||||
|
||||
- Open source. 🙌
|
||||
- No tracking, no ads, always free. 📡🚫
|
||||
- No lock-in. All data stored in GitHub issues. 🔓
|
||||
- Styled with Primer, the css toolkit that powers GitHub. 💅
|
||||
- Dark theme. 🌘
|
||||
- Lightweight. Vanilla TypeScript. No font downloads, JavaScript frameworks or polyfills for evergreen browsers. 🐦🌲
|
||||
|
||||
## How it works
|
||||
|
||||
When Utterances loads, the GitHub [issue search API](https://developer.github.com/v3/search/#search-issues) is used to find the issue associated with the page based on url, pathname or title. If it cannot find an issue that matches the page, [utterances-bot](https://github.com/utterances-bot) will automatically create an issue the first time someone comments.
|
||||
|
||||
To comment, users must authorize the utterances app to post on their behalf using the GitHub [OAuth flow](https://developer.github.com/v3/oauth/#web-application-flow). Alternatively, users can comment on the GitHub issue directly.
|
||||
|
||||
# Setting up Utterances
|
||||
|
||||
### Repository
|
||||
|
||||
Choose the repository utterances will connect to.
|
||||
|
||||
Make sure the repo is public, otherwise your readers will not be able to view the issues/comments.
|
||||
Make sure the utterances app is installed on the repo, otherwise users will not be able to post comments.
|
||||
If your repo is a fork, navigate to its settings tab and confirm the issues feature is turned on.
|
||||
|
||||
```
|
||||
repo:
|
||||
username/repo
|
||||
```
|
||||
|
||||
A public GitHub repository. This is where the blog post issues and issue-comments will be posted.
|
||||
|
||||
### Theme
|
||||
|
||||
Choose an Utterances theme that matches your blog.
|
||||
|
||||
### Enable Utterances
|
||||
|
||||
Add the following script tag to your blog's template. Position it where you want the comments to appear. Customize the layout using the .utterances and .utterances-frame selectors.
|
||||
|
||||
```js
|
||||
<script
|
||||
src="https://utteranc.es/client.js"
|
||||
repo="[ENTER REPO HERE]"
|
||||
issue-term="title"
|
||||
theme="gruvbox-dark"
|
||||
crossorigin="anonymous"
|
||||
async
|
||||
></script>
|
||||
```
|
||||
|
||||
The complete documentation can be found at [https://utteranc.es](https://utteranc.es/)
|
||||
@@ -1,122 +0,0 @@
|
||||
+++
|
||||
title = "Configure Vue.js app With Tailwind CSS"
|
||||
description = "Tailwindcss in vuejs "
|
||||
author = "mockingspectre"
|
||||
date = 2021-06-12
|
||||
[taxonomies]
|
||||
tags = ["javascript", "vuejs" , "tailwindcss"]
|
||||
+++
|
||||
A guide on how to use [Tailwind CSS](https://tailwindcss.com/) in your Vue project.
|
||||
|
||||
>**Note**
|
||||
> This article was originaly published on my old medium blog. I moved it here for archival purposes.
|
||||
|
||||
Tailwind is a utility-first CSS framework for rapidly building custom user interfaces. It is an un-opinionated framework which means that it doesn't come with custom configurations like Bootstrap or Bulma(Yeah, I know, no one should tell you how to live your life).
|
||||
|
||||
Now let's get to the juicy part that brought us all here. I'll assume that we are using Vue 3 and the Vue CLI is already installed.
|
||||
|
||||
## Create a new Vue project
|
||||
|
||||
Open a terminal window and type the following commands to create a new Vue project in the current directory.
|
||||
|
||||
```sh
|
||||
vue create vue-app
|
||||
```
|
||||
|
||||
wait for the dependencies installation to finish then
|
||||
|
||||
```sh
|
||||
cd vue-app
|
||||
```
|
||||
|
||||
to change into the project directory.
|
||||
|
||||
## Install the Tailwind CSS and its peer dependencies as a dev dependency using npm
|
||||
|
||||
```sh
|
||||
npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
|
||||
```
|
||||
|
||||
## Create your configuration files
|
||||
|
||||
Next, generate your `tailwind.config.js` and `postcss.config.js` files:
|
||||
|
||||
```sh
|
||||
npx tailwindcss init -p
|
||||
```
|
||||
|
||||
This command will create a minimal `tailwind.config.js` file at the root of your project:
|
||||
|
||||
```js
|
||||
// tailwind.config.js
|
||||
module.exports = {
|
||||
purge: [],
|
||||
darkMode: false, // or 'media' or 'class'
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
variants: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
```
|
||||
|
||||
It will also create a `postcss.config.js` file that includes tailwindcss and autoprefixer already configured.Postcss is needed to process tailwind:
|
||||
|
||||
```js
|
||||
// postcss.config.js
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Configure Tailwind to remove unused styles in production
|
||||
|
||||
In your tailwind.config.js file, configure the purge option with the paths to all of your pages and components so Tailwind can tree-shake unused styles in production builds:
|
||||
|
||||
```js
|
||||
// tailwind.config.js
|
||||
module.exports = {
|
||||
purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
|
||||
darkMode: false, // or 'media' or 'class'
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
variants: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
```
|
||||
|
||||
## Include Tailwind in your CSS
|
||||
|
||||
Navigate to `src/assets/css` and create a new `tailwind.css` file in the folder, and use the @tailwind directive to include Tailwind’s base, components, and utilities styles in the file.
|
||||
|
||||
```css
|
||||
/* ./src/assets/css/tailwind.css */
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
```
|
||||
|
||||
Tailwind will swap these directives out at build-time with all of the styles it generates based on your configured design system.
|
||||
|
||||
## Import Tailwind into your Vue app
|
||||
|
||||
Finally, ensure your CSS file is being imported in your `./src/main.js` file:
|
||||
|
||||
```js
|
||||
// src/main.js
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import './index.css'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
```
|
||||
|
||||
You're finished! Now when you run npm run dev, Tailwind CSS will be ready to use in your Vue app! You can now proceed to create awesome stuff
|
||||
@@ -0,0 +1,6 @@
|
||||
// @ts-check
|
||||
import withNuxt from './.nuxt/eslint.config.mjs'
|
||||
|
||||
export default withNuxt(
|
||||
// Your custom configs here
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: '2025-07-15',
|
||||
devtools: { enabled: true },
|
||||
|
||||
modules: [
|
||||
'@nuxt/content',
|
||||
'@nuxt/eslint',
|
||||
'@nuxt/image',
|
||||
'@nuxt/scripts',
|
||||
'@nuxt/ui',
|
||||
'@nuxt/test-utils'
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "nuxt-app",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "nuxt build",
|
||||
"dev": "nuxt dev",
|
||||
"generate": "nuxt generate",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/content": "3.6.3",
|
||||
"@nuxt/eslint": "1.8.0",
|
||||
"@nuxt/image": "1.11.0",
|
||||
"@nuxt/scripts": "0.11.10",
|
||||
"@nuxt/test-utils": "3.19.2",
|
||||
"@nuxt/ui": "3.3.2",
|
||||
"@unhead/vue": "^2.0.14",
|
||||
"better-sqlite3": "^12.2.0",
|
||||
"eslint": "^9.33.0",
|
||||
"nuxt": "^4.0.3",
|
||||
"typescript": "^5.9.2",
|
||||
"vue": "^3.5.18",
|
||||
"vue-router": "^4.5.1"
|
||||
}
|
||||
}
|
||||
Generated
+12865
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,2 @@
|
||||
User-Agent: *
|
||||
Disallow:
|
||||
-362
@@ -1,362 +0,0 @@
|
||||
/* TODO: Future considerations.
|
||||
- Reset all margin and padding for * to 0.
|
||||
- Use the <abbr> tag for abbreviations.
|
||||
- Support footnotes or asides for notes sections.
|
||||
- Serve fonts from the local server rather than Google's API.
|
||||
- Support a "display title" in an [extra] section to allow for <br> elements
|
||||
or other manual control over title display. */
|
||||
|
||||
@charset "utf-8";
|
||||
@import url('https://fonts.googleapis.com/css?family=Noto+Sans|Noto+Serif|Noto+Sans+Mono');
|
||||
|
||||
:root {
|
||||
/* Fonts and Text Sizes */
|
||||
--default-serif-font: "Noto Serif", serif;
|
||||
--default-sans-font: "Noto Sans", sans-serif;
|
||||
--default-mono-font: "Noto Sans Mono", monospace;
|
||||
--default-font-size: 14px;
|
||||
--header-font-size: 2.0em;
|
||||
/* Not sure I like this as the default, but it keeps inline code blocks from
|
||||
overlapping. */
|
||||
--default-line-height: 1.5;
|
||||
|
||||
/* Gruvbox Dark Colors */
|
||||
--background-color: #1d2021;
|
||||
--foreground-color: #ebdbb2;
|
||||
--link-color: #458588;
|
||||
--muted-color: #928374;
|
||||
--primary-accent-color: #b16286;
|
||||
--secondary-accent-color: #689d6a;
|
||||
--code-background-color: #282828;
|
||||
--inline-code-background-color: #3c3836;
|
||||
}
|
||||
|
||||
.accent {
|
||||
color: var(--primary-accent-color);
|
||||
}
|
||||
|
||||
/* Required for sticky footer. */
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
/* Required for sticky footer. */
|
||||
flex-direction: column;
|
||||
/* Required for sticky footer. */
|
||||
margin: 0;
|
||||
line-height: var(--default-line-height);
|
||||
font-size: var(--default-font-size);
|
||||
font-family: var(--default-serif-font);
|
||||
background-color: var(--background-color);
|
||||
color: var(--foreground-color);
|
||||
border-top: 0.5em solid var(--primary-accent-color);
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1 0 auto;
|
||||
/* Required for sticky footer. */
|
||||
}
|
||||
|
||||
/* FIXME: For reasons that utterly bewilder me, an <article> with this id needs
|
||||
to be inside a <main> with no id. I have a strong feeling I've done
|
||||
something wrong here. */
|
||||
#content {
|
||||
max-width: 48em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding-right: 1.4em;
|
||||
padding-left: 1.4em;
|
||||
padding-bottom: 1.4em;
|
||||
}
|
||||
|
||||
header {
|
||||
overflow: hidden;
|
||||
/* FIXME: This WILL cut off titles that are too long! */
|
||||
margin-top: 1.4em;
|
||||
margin-bottom: 1.4em;
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
header>div.logo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
header>h1 {
|
||||
text-align: center;
|
||||
font-size: var(--header-font-size);
|
||||
font-family: var(--default-sans-font);
|
||||
padding-top: 2.8rem;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.7rem;
|
||||
}
|
||||
|
||||
header .post-meta {
|
||||
text-align: center;
|
||||
padding-top: 0.5em;
|
||||
padding-bottom: 0.9em;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.post-meta time {
|
||||
// TODO: This color doesn't look great in with a light color scheme...
|
||||
color: var(--muted-color);
|
||||
}
|
||||
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
padding-top: 1.2rem;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
|
||||
p {
|
||||
padding-top: 0.4em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
/* Default text uses serif, so use sans-serif to differentiate quoted text. */
|
||||
font-family: var(--default-sans-font);
|
||||
font-style: italic;
|
||||
/* Indent blockquotes, but align the start with where text in code begins. */
|
||||
margin: 0 1.25rem;
|
||||
padding-left: 1.25rem;
|
||||
padding-right: 1.25rem;
|
||||
border-left: 3px solid var(--secondary-accent-color);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* ---- Anchor links --------------------------------------------------------*/
|
||||
|
||||
/* Add a # to the left of a subheading when it references an internal link... */
|
||||
:where(h2, h3, h4, h5, h6)>a[href^="#"]::before {
|
||||
content: "#";
|
||||
display: inline-block;
|
||||
width: 1.2rem;
|
||||
margin-left: -1.2rem;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* ... but only display the internal anchor link when hovered over. */
|
||||
:where(h2, h3, h4, h5, h6):hover>a[href^="#"]::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* When internal links are linked directly, display with the accent color. */
|
||||
:where(h2, h3, h4, h5, h6):target>a[href^="#"]::before {
|
||||
opacity: 1;
|
||||
color: var(--primary-accent-color);
|
||||
}
|
||||
|
||||
/* ---- Media ---------------------------------------------------------------*/
|
||||
|
||||
img.logo {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
img,
|
||||
video {
|
||||
/* Media should fill the width of its container if possible. */
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
figure {
|
||||
/* Don't add margins to figures. */
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
figcaption {
|
||||
/* De-emphasize figure captions. */
|
||||
font-size: 0.85rem;
|
||||
color: var(--muted-color);
|
||||
}
|
||||
|
||||
/* ---- Code blocks ---------------------------------------------------------*/
|
||||
|
||||
pre {
|
||||
display: block;
|
||||
padding: 0.25rem 1.25rem;
|
||||
font-size: 85%;
|
||||
border-left: 0.25rem solid var(--primary-accent-color);
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 0 0.4rem;
|
||||
// background-color: #3c3836;
|
||||
background-color: var(--inline-code-background-color);
|
||||
/* Inline code blocks look less aggresive with a little rounding. */
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
pre,
|
||||
code {
|
||||
overflow: auto;
|
||||
font-family: var(--default-mono-font);
|
||||
}
|
||||
|
||||
/* Without this the <code> tag gains a little padding that offsets text by like
|
||||
2 pixels. Let's *not* do that. */
|
||||
pre>code {
|
||||
padding: 0;
|
||||
background-color: var(--code-background-color);
|
||||
// Code inside a pre block doesn't need rounded borders.
|
||||
border-radius: unset;
|
||||
}
|
||||
|
||||
/* ---- Tables --------------------------------------------------------------*/
|
||||
|
||||
table {
|
||||
/* FIXME: Use flexbox for centering? Frankly, this is still bad on mobile.
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
*/
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
text-align: left;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
/* Headers in a row (column scoped) get a colored bottom border. */
|
||||
th[scope="col"] {
|
||||
padding-top: 0.4em;
|
||||
border-bottom: 3px solid var(--secondary-accent-color);
|
||||
}
|
||||
|
||||
/* Headers in a column (row scoped) get a colored right border. */
|
||||
th[scope="row"] {
|
||||
border-right: 3px solid var(--secondary-accent-color);
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: center;
|
||||
border: 1px solid var(--muted-color);
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
vertical-align: bottom;
|
||||
padding-left: 0.4em;
|
||||
padding-right: 0.4em;
|
||||
border: 1px solid var(--muted-color);
|
||||
}
|
||||
|
||||
/* ---- Footer, nav, and copyright ------------------------------------------*/
|
||||
|
||||
footer {
|
||||
border-top: 0.5em solid var(--primary-accent-color);
|
||||
text-align: center;
|
||||
/* FIXME: Using the code background color could look awkward if a post ends
|
||||
in a code snippet. */
|
||||
background-color: var(--code-background-color);
|
||||
padding: 1.4em;
|
||||
flex-shrink: 0;
|
||||
/* Required for sticky footer. */
|
||||
}
|
||||
|
||||
footer a {
|
||||
color: var(--secondary-accent-color);
|
||||
}
|
||||
|
||||
/* Give footer nav links some breathing room. */
|
||||
footer>nav>a {
|
||||
// margin: 0 1.4em;
|
||||
margin: 0 0.4em;
|
||||
}
|
||||
|
||||
/* FIXME: This could probably go away with global margin/padding adjustments. */
|
||||
footer p {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
footer p,
|
||||
footer a {
|
||||
font-family: var(--default-sans-font);
|
||||
/* It doesn't seem as though Google fonts support direct usage of OpenType
|
||||
features like 'c2sc' and 'smcp'.
|
||||
|
||||
FIXME: It's not clear why numerals don't seem to obey this property. */
|
||||
font-variant-caps: all-small-caps;
|
||||
}
|
||||
|
||||
/* ---- Media Queries ------------------------------------------------------ */
|
||||
|
||||
@media(min-width: 427px) {
|
||||
:root {
|
||||
--default-font-size: 16px
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 470px) {
|
||||
:root {
|
||||
--default-font-size: 17px;
|
||||
}
|
||||
|
||||
/* Above this size, increase the header margins. Smaller sizes benefit from
|
||||
extra breathing room in the title. */
|
||||
header {
|
||||
margin-left: 2.8em;
|
||||
margin-right: 2.8em;
|
||||
}
|
||||
|
||||
header>div.logo {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
img.logo {
|
||||
margin-right: 0.8em;
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 625px) {
|
||||
:root {
|
||||
--default-font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 802px) {
|
||||
:root {
|
||||
--default-font-size: 19px;
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 1003px) {
|
||||
:root {
|
||||
--default-font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 1225px) {
|
||||
:root {
|
||||
--default-font-size: 21px;
|
||||
}
|
||||
|
||||
/* On larger devices, give the anchor link some more space. */
|
||||
:where(h2, h3, h4, h5, h6)>a[href^="#"]::before {
|
||||
width: 1.8rem;
|
||||
margin-left: -1.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media(min-width: 1496px) {
|
||||
:root {
|
||||
--default-font-size: 22px;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,54 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>50x Borked</title>
|
||||
<meta name="author" content="Reilly Tucker Siemens">
|
||||
<meta name="description" content="50x Borked">
|
||||
<meta property="og:site_name" content="tuckersiemens.com">
|
||||
<meta property="og:locale" content="en-us">
|
||||
<meta property="og:title" content="50x Borked">
|
||||
<meta property="og:description" content="50x Borked">
|
||||
<meta property="og:image" content="https://tuckersiemens.com/self.jpg">
|
||||
<meta property="twitter:card" content="summary">
|
||||
<meta property="twitter:site" content="@TuckerSiemens">
|
||||
<meta property="twitter:title" content="50x Borked">
|
||||
<meta property="twitter:description" content="50x Borked">
|
||||
<meta property="twitter:image" content="https://tuckersiemens.com/self.jpg">
|
||||
<link rel="dns-prefetch" href="https://fonts.googleapis.com/">
|
||||
<link rel="stylesheet" href="/site.css">
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
||||
</head>
|
||||
<body>
|
||||
<main id="content">
|
||||
<header>
|
||||
<h1>50[0234] Borked</h1>
|
||||
</header>
|
||||
<figure>
|
||||
<video src="50x.mp4" type="video/mp4" autoplay loop controls></video>
|
||||
<figcaption>
|
||||
Video from <a href="https://www.sakugabooru.com/post/show/174648">sakugabooru</a>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</main>
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
⬡
|
||||
<a href="/posts">Posts</a>
|
||||
⬡
|
||||
<a href="/tags">Tags</a>
|
||||
⬡
|
||||
<a href="/contact">Contact</a>
|
||||
</nav>
|
||||
<p>
|
||||
©
|
||||
2021 Reilly Tucker Siemens ⬡
|
||||
<a href="https://github.com/reillysiemens/tuckersiemens.com">Source</a>
|
||||
⬡
|
||||
<a href="/rss.xml">Feed</a>
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
||||
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg">
|
||||
<polygon points="64 4, 124 32, 124 96, 64 124, 4 96, 4 32" fill="#b16286"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 151 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
google-site-verification: google52b8421f5e6826b8.html
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};r.d(o,{default:function(){return p}});var i=r(757),a=r.n(i);const l=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},s=/^\\begin{/;var d=function(e,t){let n;const r=[],o=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;n=e.search(o),-1!==n;){n>0&&(r.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));const o=t.findIndex((t=>e.startsWith(t.left)));if(n=l(t[o].right,e,t[o].left.length),-1===n)break;const i=e.slice(0,n+t[o].right.length),a=s.test(i)?i:e.slice(t[o].left.length,n);r.push({type:"math",data:a,rawData:i,display:t[o].display}),e=e.slice(n+t[o].right.length)}return""!==e&&r.push({type:"text",data:e}),r};const c=function(e,t){const n=d(e,t.delimiters);if(1===n.length&&"text"===n[0].type)return null;const r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if("text"===n[e].type)r.appendChild(document.createTextNode(n[e].data));else{const o=document.createElement("span");let i=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(i=t.preProcess(i)),a().render(i,o,t)}catch(o){if(!(o instanceof a().ParseError))throw o;t.errorCallback("KaTeX auto-render: Failed to parse `"+n[e].data+"` with ",o),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(o)}return r},f=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const l=c(o,t);if(l){for(let e=0;e<a;e++)r.nextSibling.remove();n+=l.childNodes.length-1,e.replaceChild(l,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";-1===t.ignoredTags.indexOf(r.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&f(r,t)}}};var p=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},f(e,n)};return o=o.default}()}));
|
||||
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user