Skip to content

Instantly share code, notes, and snippets.

const getRandomIdString = (steps = 1) => {
let seed = "";
for (let i = 0; i < steps; i++) {
seed += crypto.randomUUID();
}
return seed.replaceAll("-", "");
};
@FlameWolf
FlameWolf / generateMalluNames.js
Last active March 14, 2024 08:10
Mallu name generator
function generateMalluNames(randomise = false) {
const alphabet = new Array(26);
const vowels = ["a", "e", "i", "o", "u"];
const softConsonants = ["b", "c", "d", "g", "j", "k", "p", "r", "s", "t", "z"];
for (let i = 0; i < 26; i++) {
alphabet[i] = String.fromCharCode(i + 97);
if (i === 16) {
alphabet[i] += "u";
}
}
@FlameWolf
FlameWolf / Git-Reset-Hard.sh
Created April 16, 2024 04:37
Revert to a previous commit discarding all changes made afterwards
git reset --hard [Commit-SHA-Id]
git push origin [Branch-Name] --force
@FlameWolf
FlameWolf / Psychological-Pitfalls-of-Communism.md
Created June 20, 2024 17:00
The Psychological Pitfalls of Communism: A Critical Analysis

The Psychological Pitfalls of Communism: A Critical Analysis

Introduction:

Communism, as a political and economic ideology, has captivated minds and shaped nations throughout the 20th century and beyond. While its proponents have often painted it as a utopian solution to societal inequalities, the practical implementation of communist systems has consistently resulted in failure, oppression, and human suffering. This essay aims to explore the fundamental psychological pitfalls inherent in communist ideology, examining how these flaws interact with human nature to create dysfunctional societies.

Our analysis will cover five key areas:

  1. The Myth of Equality and Individual Differences: We will explore how communist ideology fails to account for the vast array of individual differences in human populations, leading to misallocation of resources and stifling of personal growth.
const toBase62String = function (value) {
const base = 62n;
const digits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const sign = value < 0n ? "-" : "";
let [result, quotient] = ["", sign ? 0n - value : value];
do {
result = `${digits[Number(quotient % base)]}${result}`;
} while ((quotient /= base));
return `${sign}${result}`;
};
@FlameWolf
FlameWolf / rot18.js
Last active April 30, 2025 13:54
ROT18 Implementation in JavaScript
const rot18 = (() => {
const forward = "ABCDEFGHIJKLM01234";
const reverse = "NOPQRSTUVWXYZ56789";
const charMap = new Map();
for (let loopIndex = 0; loopIndex < 18; loopIndex++) {
const key = forward[loopIndex];
const val = reverse[loopIndex];
charMap.set(key, val);
charMap.set(val, key);
if (/\D/.test(key)) {
@FlameWolf
FlameWolf / is-palindrome.js
Created January 21, 2025 10:15
Unicode-sensitive Palindrome Checker
const segmenter = new Intl.Segmenter();
const areStringsEqual = (first, second) => first.localeCompare(second, undefined, { sensitivity: "accent" }) === 0;
const isPalindrome = word => {
const graphemes = Array.from(segmenter.segment(word)).map(x => x.segment);
let [left, right] = [0, graphemes.length - 1];
while (left < right) {
if (!areStringsEqual(graphemes[left], graphemes[right])) {
return false;
}
left++, right--;
ServiceBus:
amqps://ListenOnlyAccessKey:6FzpNGirGuIRnlxDi91lLqXwb7UIIW6oK%2BASbFuvJ9U%[email protected]:5671/?verify=verify_none
EventHubs:
amqps://ListenOnlyAccessKey:jMfGyHUDh5JZuFuKGo5lgudLFZBa3HqV6%2BAEhJX2Cfg%[email protected]:5671/?verify=verify_none
@FlameWolf
FlameWolf / reverseUnicodeText.js
Created August 7, 2025 11:56
Reverse a Unicode text while preserving grapheme clusters
const segmenter = new Intl.Segmenter();
const zeroWidthSpace = "\u200B";
/**
* Checks if the combination of segments is a single grapheme unit.
* @param {Intl.SegmentData} combination
* @returns {Boolean}
*/
const isGraphemeUnit = combination => Array.from(segmenter.segment(combination)).length === 1;
/**
* Removes unwanted zero-width spaces based on their context in the text.