Skip to content

Instantly share code, notes, and snippets.

View delasy's full-sized avatar

Aaron Delasy delasy

View GitHub Profile
@delasy
delasy / output.txt
Created April 24, 2021 23:49
Program to check speed of different setTimeout arguments
This program was created to determine which setTimeout is faster
Timeout of -1 = 1ms
Timeout of 0 = 1ms
Timeout of 1 = 1ms
Timeout of 2 = 2ms
Timeout of 3 = 3ms
Timeout of 4 = 5ms
Timeout of 5 = 6ms
Timeout of 6 = 7ms
Timeout of 7 = 8ms
@delasy
delasy / n8n-on-aws.md
Created August 23, 2022 09:01
N8N on AWS

N8N on AWS

  1. Create EC2 instance:
  • linux/ubuntu 20.04
  • MINIMUM 2GB RAM
  • Click create
  1. Make sure to add 443 port in security groups
  2. Create Cloudflare domain pointing at server IP address, proxy status - DNS ONLY
  3. SSH to instance and follow instructions:

Install packages

@delasy
delasy / count-words
Last active August 14, 2024 09:56
Words counter made in The programming language
#!/usr/bin/env the run
const CWD := process_cwd() + path_SEP
const IGNORE_LIST := ["build"]
fn traverse (path := "") str[] {
entities := fs_scandirSync(CWD + path)
pathPrefix := path.empty ? "" : path + path_SEP
mut result: str[]
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-- {
@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}`
@delasy
delasy / HAMSTER-KOMBAT-PLAYGROUND-GAMES-PRMO-CODE-KEYS-GENERATOR.md
Last active November 13, 2024 09:30
[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 / 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 / API-GAMEPROMO-IO-CLONE.md
Last active September 10, 2024 10:02
GamePromo API Clone

GamePromo API Clone

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

Installation

npm init -y
npm install body-parser express
@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 / 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