Skip to content

Instantly share code, notes, and snippets.

View exonomyapp's full-sized avatar
💭
Decentralizing Life

Exonomy App exonomyapp

💭
Decentralizing Life
View GitHub Profile
@exonomyapp
exonomyapp / Shared VPS Projects Folder.md
Created August 24, 2024 08:42
How to set up a Shared Projects folder on our VPS

When setting up a shared projects folder for multi-user access to all the code we're developing on your VPS and where multiple users have their own accounts, we’ll want to choose a location that is accessible to all users but also secure. Here’s how we can achieve this on our Ubuntu 24.04 VPS:

Step 1: A location for the shared code folder to which users can be given access

A good place to store the shared code folder is within the /opt directory, which is typically used for optional software packages and can be a good place for shared resources.

For example, we can create the directory /opt/projects.

Step 2: Create the Shared Folder

First, create the directory where the code will be stored:

@exonomyapp
exonomyapp / Typing Databases.md
Created August 26, 2024 15:53
AI Commentary on How to Fully Type database.ts

Here's some AI commentary on our database.ts file to ensure that it's fully typed and follows best practices.

Analysis and Improvements:

  1. Type Annotation for db:

    • We've correctly typed the db variable as Database<sqlite3.Database, sqlite3.Statement> | null. This indicates that it can either be a Database object or null. However, to improve type safety, we could make db non-nullable once it's initialized.
  2. Environment Variables:

    • The dbPath is currently inferred as a string, which is fine, but we could explicitly type it to make our code more robust.
  3. Function Return Types:

Step 1: Decide on a Location for the Shared Code Folder

We will use /opt/projects as our shared folder where all code will be developed. The /opt directory is appropriate for optional software and shared resources.

Step 2: Create the Shared Folder

Let's create the directory /opt/projects where our code will be stored:

sudo mkdir /opt/projects
@exonomyapp
exonomyapp / Agile, Scrum, and Sprints.md
Last active September 9, 2024 16:30
This gist briefly introduces Agile, Scrum, and Sprints and then elaborates

Introduction to Agile, Scrum, and Sprint

Agile is a set of principles and practices designed to guide project management and software development in a flexible and iterative way. The core idea of Agile is to break large projects into smaller, manageable units of work, allowing teams to deliver incremental progress and receive feedback throughout the development process. This approach allows teams to adapt quickly to changes, be it in requirements or market conditions, and ultimately deliver higher-quality results.

Scrum is one of the most popular Agile frameworks used to implement Agile principles. Scrum provides a structured approach to team collaboration and product development, emphasizing teamwork, accountability, and continuous improvement. It is designed to help teams work on complex projects through time-boxed iterations called Sprints.

A Sprint is a short, defined period during which a specific set of work must be completed and made ready for review. Typically, a Sprint lasts be

There are several directives in nuxt.config.ts that you can use to explicitly tell Nuxt3 that your app is client-side only and does not need backend functions. Here are a few key ones:

1. Disable Server-Side Rendering (SSR):

Since our app is purely client-side and P2P, we should disable SSR entirely to avoid any server-side rendering behavior.

export default defineNuxtConfig({
  ssr: false,  // Disable server-side rendering
})
@exonomyapp
exonomyapp / Nuxt3 Settings and Preferences with Pinia.md
Created September 17, 2024 14:27
Nuxt3 Settings and Preferences with Pinia

Here’s how we can implement the "Settings" architecture using Pinia following the Nuxt3 approach:

1. Set Up Pinia in Nuxt3

First, make sure Pinia is installed and integrated into our Nuxt3 app:

  • Install Pinia:
    npm install pinia
@exonomyapp
exonomyapp / Coolify PostgreSQL.md
Created September 20, 2024 13:09
Coolify PostgreSQL

How to launch a PostgreSQL service using Coolify 3.x, ensure that we secure the server, harden the PostgreSQL instance, and perform necessary administrative tasks at the Ubuntu 24.04 VPS layer.

Step-by-Step Instructions for Launching PostgreSQL on Coolify 3.x

1. Log in to Coolify

First, we log into the Coolify 3.x dashboard using our credentials.

2. Create a New Service

  • From the sidebar, we navigate to "Services" and click "Add new service".
  • We select PostgreSQL from the list of available services.

When we install packages using npm i <package> --save-dev, we are specifically telling npm to install our package as a development dependency.:

--save-dev parameter:

  • This adds our package to the devDependencies section in the package.json file.
  • Usage: This means the package is intended only for development purposes, not for production builds. When deploying the application to production (with npm install --production or similar), packages listed under devDependencies won't be installed.
  • Example: Cypress, as a testing framework, is usually not needed in production environments, so it makes sense to include it in the devDependencies section.

Other common parameters:

  • No parameter (npm i <package>): This installs our package and adds it to the dependencies section in package.json, meaning it will be installed in both development and production environments. This is less ideal, for example, for a testing tool like Cypress.
  • *--global (npm i -g )

Automating Local Branch Tracking for Remote Branches

Problem Statement

In our project, we have a remote Git repository with several branches that contain important features and updates. However, there are several challenges we face regarding branch management:

  1. Remote Branch Awareness: Developers need to be aware of all the branches available on the remote repository, especially those created by other team members.
  2. Local Branch Tracking: We need to set up local branches that track these remote branches to ensure that we can easily pull updates and contribute to those branches.
  3. Avoiding Conflicts: We want to avoid creating local branches for remote branches that already exist locally to prevent errors and clutter.
@exonomyapp
exonomyapp / Exonomy Vouchers and IPFS.md
Last active September 26, 2024 02:56
How Exonomy Vouchers are Published to IPFS

Concept of Publishing a Digital Voucher Document to IPFS for global distribution to non-Exonomists

Publishing a document to IPFS means storing the content in a decentralized network. Instead of being stored on a single server, the data is broken into pieces and distributed across multiple nodes. The document is assigned a unique CID (Content Identifier) based on its content, ensuring that anyone with the CID can retrieve the document, no matter where it is stored. For our app, this means the voucher, once broadcasted, will be accessible globally and immutably, with its content hash being the identifier.

Step-by-Step Process

1. Step: Prepare the Document

  • Why: Before publishing to IPFS, we need to ensure that the data (voucher details) is structured properly for easy retrieval and validation.
  • Options:
  • You can publish the voucher as raw JSON, or you can format it for easier display, like converting it