Skip to content

Instantly share code, notes, and snippets.

View MinSomai's full-sized avatar
🇳🇵
from the land of Mountains, Nepal. Namaste!

Min Somai MinSomai

🇳🇵
from the land of Mountains, Nepal. Namaste!
View GitHub Profile
@MinSomai
MinSomai / scalable-scraping-puppeteer-cluster.js
Last active February 23, 2025 15:49
scalable scraping with puppeteer-cluster.
// Code structure
// app.js
// router.js
// controller.js
// service.js
// implementation
// This is hosted in aws Fargate. And this is the rough worst case calculation on the resource usage.
// Fargate configuration:
@MinSomai
MinSomai / middleware.ts
Created February 9, 2025 18:50
payloadCMS always light theme middleware.
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export function middleware(req: NextRequest) {
const res = NextResponse.next();
const currentTheme = req.cookies.get("payload-theme");
if (!req.cookies.has("payload-theme") || currentTheme?.value === "dark") {
res.cookies.set("payload-theme", "light")
@MinSomai
MinSomai / contemplative-llms.txt
Created January 7, 2025 16:20 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@MinSomai
MinSomai / amazon.md
Created September 12, 2022 15:54 — forked from terabyte/amazon.md
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

@MinSomai
MinSomai / SerializeContent.js
Last active June 26, 2022 13:32
Slatejs to Vue 3 html serializer - custom render function for SlateJS to vue 3 Vnodes
// How to use?
// Save this file as SerializeContent.js
//
// import SerializeContent from "../SerializeContent";
// <template>
// <SerializeContent :content="content" />
// </template>
import escapeHTML from "escape-html";
import { Text } from "slate";
@MinSomai
MinSomai / Readme.md
Created May 27, 2022 17:25
Official Wordpress Docker in japanese language (or other).
  1. Get Wordpress Docker
  2. Download Japanese Wordpress
  3. Copy the "wp-content/languages" directory from japanese wordpress.
  4. Paste it in the Wordpress Docker "wp-content"

Viola!

@MinSomai
MinSomai / copy.sh
Created May 8, 2022 20:02
Copy from current directory to another drive - exclude node_modules, etc | linux
rsync -rv --exclude=node_modules --exclude=site-packages ./myDirectory/* /media/USERNAME/MOUNT_NAME/PATH_TO_DIRECTORY
@MinSomai
MinSomai / docker-compose.yml
Created April 10, 2022 12:01
Initial SQL data import - Docker MySQL
mysql:
image: mysql:latest
container_name: mysql-container
ports:
- 3306:3306
volumes:
- ./dump.sql:/docker-entrypoint-initdb.d/dump.sql
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: name_db
@MinSomai
MinSomai / connectHTMLelements_SVG.png
Created April 6, 2022 07:16 — forked from alojzije/connectHTMLelements_SVG.png
Connect two elements / draw a path between two elements with SVG path (using jQuery)
connectHTMLelements_SVG.png
@MinSomai
MinSomai / MySql-5.6-installation guide.md
Created April 6, 2022 05:01 — forked from vinodpandey/MySql-5.6-installation guide.md
Install MySQL 5.6.xx on Ubuntu 18.04 & Ubuntu 20.04

MySQL Download URL

https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.46-linux-glibc2.12-x86_64.tar.gz

Open the terminal and follow along:

  • Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R