- Create EC2 instance:
- linux/ubuntu 20.04
- MINIMUM 2GB RAM
- Click create
- Make sure to add 443 port in security groups
- Create Cloudflare domain pointing at server IP address, proxy status - DNS ONLY
- SSH to instance and follow instructions:
| 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 |
| #!/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-- { |
| '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}` |
by @delasy
This script is way more advanced than other scripts out there.
| // 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', |
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