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

What is Testing?

Testing in software development is the process of verifying that your code works as expected. It's like proofreading an essay or double-checking a math problem to ensure everything is correct. Testing helps you find bugs (errors in the code) before your users do, making your applications more reliable and easier to maintain.

Why is Testing Important?

  1. Catch Bugs Early: Testing helps you identify and fix issues early in the development process, which is usually easier and less costly than fixing them later.
  2. Documentation: Tests can serve as documentation for your code, showing how it is supposed to work.
  3. Confidence in Changes: When you modify your code, tests ensure that everything still works as expected.
  4. Better Code Quality: Writing tests often forces you to write cleaner, more modular code, which is easier to understand and maintain.
@exonomyapp
exonomyapp / NuxtAuth.md
Created August 10, 2024 10:21
Nuxt Auth for Google and GitHub Authentication

In a Nuxt.js application, the @nuxtjs/auth module (commonly referred to as Nuxt Auth) plays a critical role in managing authentication and securing your application. When you want to support authentication for both Google and GitHub users, Nuxt Auth simplifies the integration by providing a unified system for handling authentication, token management, and user sessions.

Role of Nuxt Auth

  1. Abstraction of Authentication Providers:

    • Nuxt Auth abstracts the complexities of dealing with multiple authentication providers, like Google and GitHub. It provides pre-built strategies that you can easily configure to enable OAuth authentication with these providers.
  2. Token Management:

    • Nuxt Auth handles token storage and management, ensuring that your application correctly handles user sessions, token expiration, and refreshing tokens as needed. This is crucial for maintaining a secure and seamless user experience.
@exonomyapp
exonomyapp / LayeredAuthentication.md
Last active August 10, 2024 17:58
Nuxt Layers to facilitate modular (optional, conditional) authentication providers

Multi-provider authentication in Nuxt.js is typically organized using layers. This layered approach allows for a clean separation of concerns, making the authentication process more modular, maintainable, and scalable. Here's how this layered structure is commonly organized:

1. Authentication Providers Layer

  • OAuth/OIDC Providers: This layer handles integration with various third-party authentication providers, such as Google, Facebook, GitHub, etc. Each provider is configured separately with its respective credentials and settings.
  • Custom Authentication Providers: In addition to third-party providers, this layer can also include custom authentication methods, like using a custom API for login or integrating with enterprise authentication systems.

2. Authentication Service Layer

  • Abstraction over Providers: This layer acts as an abstraction over the various authentication providers. It handles the common tasks such as redirecting users to the appropriate provider, ma

Managing SOGo Webmail Theming with Docker Volumes

Introduction

This guide is designed for our team of system administrators and developers who want to customize the appearance of our SOGo webmail instance without modifying the Docker image. By using Docker volumes and a GitHub repository, we can dynamically inject a custom theme into our running SOGo container, allowing for easy maintenance and updates.

Prerequisites

Before proceeding, we need to ensure the following:

  • Basic Docker knowledge: Understanding of Docker containers, images, and volumes.
@exonomyapp
exonomyapp / GitHub Action to execute script on VPS.md
Last active August 27, 2024 15:29
GitHub Action to execute script on VPS

GitHub Action can run a shell script on your personal VPS, but it requires a few steps to set up secure communication between GitHub and your VPS. Here’s a general approach on how you can achieve this:

  1. Set Up SSH Access:

    • Ensure that your VPS allows SSH connections. You’ll need to have SSH access set up on your VPS.
  2. Create SSH Keys:

    • Generate an SSH key pair on your local machine (or wherever you are setting up the GitHub Action). You can use the following command:
      ssh-keygen -t rsa -b 4096 -C "[email protected]"
@exonomyapp
exonomyapp / Layers and Modularity in Nuxt Authentication.md
Last active September 10, 2024 14:29
Layers and Modularity in Nuxt Authentication

To create a comprehensive Nuxt Layer strategy that supports various authentication providers and storage/database solutions, we need a well-organized folder and file structure that separates concerns, allows for easy extension, and maintains modularity. Below is a recommended folder structure and file organization:

Project Root

/my-nuxt-app
│
├── /app/                 	# Primary application layer
│   ├── /components/      	# Reusable Vue components
│   ├── /layouts/         	# Application layouts
│   ├── /pages/           	# Application pages
@exonomyapp
exonomyapp / Provider Specifics.md
Created August 18, 2024 18:34
Provider Specifics and Handling of Unique Aspects

Each OAuth provider has unique aspects that distinguish it from others, ranging from the required scopes to the way they handle user data, token exchange, and API quirks. Below are the key differences and important notes for each of the listed providers:

1. Google

  • Scopes: Common scopes include email, profile, and openid. Google supports a wide range of APIs, so you may need additional scopes like https://www.googleapis.com/auth/calendar for accessing specific services.
  • ID Token: Google provides an ID token as part of the OAuth flow when using the openid scope, which is a JWT that contains user identity information.
  • User Info Endpoint: Google's user info endpoint is https://www.googleapis.com/oauth2/v3/userinfo.
  • Token Expiry: Refresh tokens are typically long-lived, but access tokens expire quickly, usually within 1 hour.

2. Facebook

  • Scopes: Common scopes include email, public_profile, and user_friends. Facebook has granular scop
@exonomyapp
exonomyapp / Global South Auth Providers.md
Last active August 18, 2024 19:10
Authentication Providers Popular in the "Global South"

Here's a list of the top 10 most popular authentication providers from China, India, Southeast Asia, Russia, and Africa, excluding the original 10 providers. Each of these platforms is tailored to its region, with unique features and conditions that set them apart, including unique aspects of their authentication flows. These unique aspects highlight the different authentication needs and challenges developers face when working with providers in these regions, particularly in managing security, localization, and integration with regional services.

1. WeChat (China)

  • Platform: Super app used for messaging, social media, payments, and more.
  • Scopes: Provides access to user profile, contacts, payments, and social data.
  • User Base: Over 1 billion active users, making it the dominant platform in China.
  • Unique Aspects:
    • Super App Functionality: WeChat is more than just social media; it’s also used for payments, shopping, and even government services.
  • **Mini
@exonomyapp
exonomyapp / nuxt.config.js.md
Created August 18, 2024 22:55
Configuring and using auth-next

Example Usage:

  • nuxt.config.js:
    export default {
      modules: [
        '@nuxtjs/auth-next',
        '@nuxtjs/axios',
      ],
      auth: {
@exonomyapp
exonomyapp / Parent-child-issue-relationship.md
Created August 23, 2024 14:21
GitHub Action for Managing Parent-Child Issue Relationships

Functional Specification: GitHub Action for Managing Parent-Child Issue Relationships


Title: Automated Management of Parent-Child Issue Relationships in GitHub Projects

Version: 1.0

Author: Tamir Halperin