Skip to content

Instantly share code, notes, and snippets.

View oneshadab's full-sized avatar
💻
Focusing

Shadman Shadab oneshadab

💻
Focusing
View GitHub Profile
// > file-sync-blocking.test.mjs
import test from 'node:test';
import assert from 'node:assert';
import fs from "node:fs";
test('reading file 10,000 times with callback blocking', (t) => {
for (let i = 0; i < 10000; i++ ) {
const data = fs.readFileSync("./text.txt", { encoding: 'utf-8'})
assert.strictEqual(data, "Hello, world")
}
/* eslint-disable @typescript-eslint/no-unused-vars */
const sizes = [1000, 100000, 1000000, 10000000, 100000000];
async function run() {
let count = 0;
const counts: {
forOf: {
[key in number]: number;
};
#!/bin/bash
set -e
# Helper functions
log() {
echo >&2 -e "${1-}"
}
# Setup vars
#! /bin/bash
set -e
# --- Globals ---
declare default_remote=newscred
declare remote
declare branch
# --- Function definitions ---
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Out test</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
#include <bits/stdc++.h>
using namespace std;
int main()
{
printf("Hello World\n");
return 0;
}