Skip to content

Instantly share code, notes, and snippets.

View delasy's full-sized avatar

Aaron Delasy delasy

View GitHub Profile
@delasy
delasy / cla.md
Last active April 30, 2026 06:49

Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects ("Projects") made available by Aaron Delasy ("Licensor"). This Individual Contributor License Agreement ("Agreement") sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to the Licensor in respect of any of the Projects (collectively "Contributions"). If you have any questions respecting this Agreement, please contact aaron@delasy.com.

You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.

Copyright License. You hereby grant, and agree to grant, to the Licensor a non-exclusive, perpetual, irrevocable, worl

@delasy
delasy / main.c
Created January 6, 2025 04:48
Find all files/folders case-insensitively matching search criteria
// cc main.c -o main.out
// ./main.out <path>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <dirent.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@delasy
delasy / gist:e15f3ec5971a7ca33d9dac713ad83100
Last active January 4, 2025 07:47
Check files in current folder start with a certain content (Node.js)
const fs = require("node:fs");
const path = require("node:path");
const banner = `<text-goes-here>`;
const exclusions = ["Dockerfile", "build"];
function traverseFolder (folderPath) {
const realFolderPath = fs.realpathSync(folderPath);
const entries = fs.readdirSync(realFolderPath, { withFileTypes: true });
@delasy
delasy / COMPARE-NODE.JS-C.md
Last active October 12, 2024 21:32
C vs Node.js performance comparison

So I compared Node.js and C code you can find tests below, this was the task:

There's a staircase with N steps, and you can climb 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters.
For example, if N is 4, then there are 5 unique ways:
1, 1, 1, 1
2, 1, 1
1, 2, 1
1, 1, 2
2, 2
What if, instead of being able to climb 1 or 2 steps at a time, you could climb any number from a set of p

@delasy
delasy / INTERVIEW-QUESTIONS.md
Created September 30, 2024 11:53
Interview Questions

Coding Interview Questions

React.js

What version of react you worked with?

What is React?

What is JSX?

What is the difference between Element and Component?

What are fragments?

How to apply validation on props in React?

@delasy
delasy / API-GAMEPROMO-IO-CLONE.md
Last active January 26, 2025 19:39
GamePromo API Clone

GamePromo API Clone

The only difference is that it dumps all data to a file dump.log.

Before that you need to actually have Node.js installed.

Installation

npm init -y
@delasy
delasy / apply-hamsterkombat-promo-code.js
Last active October 7, 2024 08:34
Script that randomly applies promo codes for HamsterKombat
// insert hamster-kombat-playground-games-promo-keys-generator.js here
// with removed `async function main() {...}` and `main().catch(Logger.panic);`
const { CronJob } = require('cron');
const HK_TOKEN = '<api-token>';
async function applyPromo(promoCode) {
await fetch('https://api.hamsterkombatgame.io/clicker/apply-promo', {
method: 'POST',
@delasy
delasy / HAMSTER-KOMBAT-PLAYGROUND-GAMES-PRMO-CODE-KEYS-GENERATOR.md
Last active April 9, 2025 14:06
[FREE] Hamster Kombat playground promo code keys generator.

HamsterKombat Playground Promo Code Keys Generator

by @delasy

Warning

THIS SCRIPT IS NO LONGER MAINTAINED.

USE IT AT YOUR OWN RISK AFTER 2024-09-26.

This script is way more advanced than other scripts out there.

  • allows generating HamsterKombat coupon code for free using your machine.
@delasy
delasy / timer.react.tsx
Created May 11, 2024 19:27
timer implementation in React.js with TypeScript
'use client'
import { useEffect, useRef, useState } from 'react'
function formatTime (time: number): string {
const t = `00${time % 1_000}`.slice(-3)
const s = `0${Math.floor(time / 1_000) % 60}`.slice(-2)
const m = `0${Math.floor(time / 60_000) % 60}`.slice(-2)
const h = `0${Math.floor(time / 3_600_000) % 24}`.slice(-2)
return `${h}:${m}:${s}.${t}`
fn calcFileLines (filePath: str) int {
content := fs_readFileSync(filePath).str()
return content.lines().len
}
fn traverse (path: str) str[] {
entries := fs_scandirSync(path)
mut files: str[]
loop i := entries.len - 1; i >= 0; i-- {