Skip to content

Instantly share code, notes, and snippets.

View isocroft's full-sized avatar
😜
Seriously fooling around!

Ifeora Okechukwu isocroft

😜
Seriously fooling around!
View GitHub Profile
@isocroft
isocroft / processlist.sql
Created July 24, 2025 22:30 — forked from romuald/processlist.sql
Show PostgreSQL current (running) process list;
SELECT user, pid, client_addr, waiting, query, query_start, NOW() - query_start AS elapsed
FROM pg_stat_activity
WHERE query != '<IDLE>'
-- AND EXTRACT(EPOCH FROM (NOW() - query_start)) > 1
ORDER BY elapsed DESC;
@isocroft
isocroft / ride_hailing_app_design_database.sql
Last active July 11, 2025 07:26
A database schema for a ride hailing app that specializes in linking riders to drivers on frequently-travelled transport routes based on Google Maps info using either MySQL, SQLite or PostgreSQL as primary database
-- MySQL v8.0.16
-- PostgresSQL v16.9.2
CREATE DATABASE IF NOT EXISTS `test`
DEFAULT CHARACTER SET utf8 -- utf8mb4
DEFAULT COLLATE utf8_general_ci; -- utf8mb4_unicode_ci
SET default_storage_engine = INNODB;
CREATE TABLE rider_details (
@isocroft
isocroft / ecommerce_storefront_design_databse.sql
Last active July 3, 2025 05:26
A database schema for an e-commerce storefront-inventory-backoffice that specializes in selling apparels and ready-made clothing as well as smartphones using either MySQL, SQLite or PostgreSQL as primary database
-- SKU for Clothes: [Shirt Style]-[Color]-[Size]-[Material]-[Brand]-[Collection Month]-[Collection Year] (e.g. Material=spandex,cotton;Size=medium,small,large,extra-large;)
-- SKU for Smartphones: [Network]-[Color]-[Weight]-[OS]-[SIM Type]-[SIM Count]-[Display]-[Brand]-[Model] (e.g. Network=gsm;SIM Type=nano,micro;)
CREATE DATABASE IF NOT EXISTS `test`
DEFAULT CHARACTER SET utf8 -- utf8mb4
DEFAULT COLLATE utf8_general_ci; -- utf8mb4_unicode_ci
CREATE TABLE products ();
@isocroft
isocroft / fintech_wallet_ledger_design_database.sql
Last active July 5, 2025 20:32
A database schema for a fin-tech wallet types, accounts and transactions (multi-currency) app using either MySQL, SQLite or PostgreSQL as primary database
CREATE DATABASE IF NOT EXISTS `test`
DEFAULT CHARACTER SET utf8 -- utf8mb4
DEFAULT COLLATE utf8_general_ci; -- utf8mb4_unicode_ci
SET default_storage_engine = INNODB;
CREATE TABLE user_details (
id bigint NOT NULL,
first_name varchar(100) NOT NULL,
last_name varchar(100) NOT NULL,
@isocroft
isocroft / low_budget_social_media_site_database.sql
Last active July 6, 2025 19:58
The database schema for a low-budget social media site (Reddit-like or Medium-like or BlueSky-like) using either MySQL, SQLite or PostgreSQL as primary database
-- MySQL v8.0.16
-- PostgresSQL v16.9.2
CREATE DATABASE IF NOT EXISTS `test`
DEFAULT CHARACTER SET utf8 -- utf8mb4
DEFAULT COLLATE utf8_general_ci; -- utf8mb4_unicode_ci
SET default_storage_engine = INNODB;
CREATE TABLE user_details (
@isocroft
isocroft / exercise_file--bruteForce_wordlist_generator.sh
Last active June 21, 2025 12:56
A bash script for generating all possible unique passwords for brute-forcing a web servers' login endpoint without adequate security protections
#!/bin/bash
# BrutePassGen v1.0
# Coded by: github.com/isocroft
# X: @isocroft
# @INFO: A very minimal yet specific `readarray`-like implementation using `read`.
# @INFO: Older versions of bash (v3 and below) do not support `readarray` or `mapfile`.
if ! type -t readintoarray >/dev/null; then
@isocroft
isocroft / jest-custom-matchers.js
Created June 16, 2025 10:58
This is a file that holds a good amount of custom matchers for Jest
expect.extend({
toBeArrayContainingObject(received, argument) {
const pass = this.equals(received,
expect.arrayContaining([
expect.objectContaining(argument)
])
)
if (pass) {
@isocroft
isocroft / versionOne_ReactTestingLibrary_Async.js
Last active May 30, 2025 12:09
This is version 1 of a simple test for how using async/await with react testing library can slow down tests
import React, { useState } from "react";
import { render, act, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { roles, Components } from "constants/ui-copy";
function RecipeForm ({ onSubmit }) {
function formToObject(form) {
const formData = new FormData(form);
return Object.fromEntries(formData.entries());
}
@isocroft
isocroft / HttpButton.tsx
Last active July 6, 2025 14:38
A custom reactJS component for making a http request when JavaScript is disabled on the browser.
import React from "react";
import Button from "./Button";
import type { ButtonProps } from "./Button";
import { useAuthTokenFromContext } from "../AuthProvider";
export const HttpButton = ({
children,
action,
enctype = "application/x-www-form-urlencoded",
@isocroft
isocroft / reader-tagged_comments_specification.md
Last active July 7, 2025 03:35
A basic specification for reader-tagged comments proposal (essay)

Reader-Tagged Comments Specification

A handy standard specification proposal for writing very useful comments directed at anyone reading software source code with aided understanding as the primary objective.

[1]. Front Matter