Skip to content

Instantly share code, notes, and snippets.

@mertcanaltin
mertcanaltin / nodejs-bench.js
Created November 2, 2025 13:09
nodejs bench for Buffer.copy
// 100 chunks × 4KB streaming test
const { performance } = require('perf_hooks');
// Prepare test data: 100 chunks of 4KB each
const numChunks = 100;
const chunkSize = 4096; // 4KB
const chunks = [];
for (let i = 0; i < numChunks; i++) {
@mertcanaltin
mertcanaltin / test-streaming.js
Last active November 2, 2025 15:37
test-streaming.js for workerd buffer.copy bottleneck
import { Buffer } from 'node:buffer';
// 100 chunks × 4KB benchmark
export default {
async fetch(request, env) {
const url = new URL(request.url);
const tick = env?.TICK
? async () => { await env.TICK.fetch(new Request('http://tick/')); }
: async () => {};
# Node.js Structured Logging API - RFC
**Author:** @mertcanaltin
**Status:** REVIEW
**Date:** 2025-01-22
**Issue:** [#49296](https://github.com/nodejs/node/issues/49296)
---
## Summary
ℹ tests 5381
ℹ suites 28
ℹ pass 5336
ℹ fail 44
ℹ cancelled 0
ℹ skipped 1
ℹ todo 0
ℹ duration_ms 649.137542
✖ failing tests:
@mertcanaltin
mertcanaltin / chat.py
Created July 10, 2023 13:13
This code demonstrates a simple chat interface with ChatGPT using Python. It utilizes the Transformers library and the ChatGPT model. The code prompts the user for input, processes it with the model, and generates a response. The model used in this example is "gpt3.5-turbo," but you can choose a different model if desired. By adjusting the `max_…
from transformers import ChatGPT
# ChatGPT modelini yükleyin
model = ChatGPT("gpt3.5-turbo")
# Başlamak için bir "sohbet" fonksiyonu oluşturun
def sohbet_et():
while True:
kullanici_girdisi = input("Kullanıcı: ")
@mertcanaltin
mertcanaltin / fizzbuzz.js
Created March 15, 2023 13:55
This code checks all numbers from 1 to 100 and prints "Fizz" when the number is exactly divisible by 3, "Buzz" when the number is exactly divisible by 5, and "FizzBuzz" when the number is divisible by both. Otherwise, it just prints the number.
for (let i = 1; i <= 100; i++) {
if (i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz");
} else if (i % 3 === 0) {
console.log("Fizz");
} else if (i % 5 === 0) {
console.log("Buzz");
} else {
console.log(i);
}
@mertcanaltin
mertcanaltin / gist:af29d940eb9e7f77b4a384aad2830e80
Last active September 8, 2022 17:51
a unix/mac terminal command that can git pull all repos at once update
find . -maxdepth 1 -type d -exec sh -c '(cd {} && git reset --hard && git clean -fd && git submodule update --init --recursive && git pull && git fetch)' ';'
const users = [{
name:'mert',
age:10
},
{
name:'mert',
age:29
},
{
name:'ali',
const getUsers = () => {
return new Promise(async(resolve,reject) => { // resolve:işlem başarılı buyur datan , reject:bir problem oluştu ben bunu reddettim
const { data } = await axios('https://jsonplaceholder.typicode.com/users');
resolve(data);
// reject('bir sorun oluştu!');
})
}
const getPost = (post_id) => {
const getComments = (number) => {
return new Promise((resolve,reject) => { // resolve:işlem başarılı buyur datan , reject:bir problem oluştu ben bunu reddettim
if(number === 1){
resolve({text:'selam'}); //number da döner obje de
}
reject('bir problem oldu');
})
}
getComments(1) //getComments parametresi 1.satır