-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-color.js
38 lines (26 loc) · 877 Bytes
/
test-color.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import net from 'node:net';
import { oklch2rgb } from './helpers/oklch2rgb.js';
// Launch Option
// -netconport 22333 -tools
const sleep = ms => new Promise(r => setTimeout(r, ms));
const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
async function cringe(socket) {
while(socket) {
socket.write(`cl_crosshaircolor_r ${randomInt(0, 255)}; cl_crosshaircolor_g ${randomInt(0, 255)}; cl_crosshaircolor_b ${randomInt(0, 255)};\n`);
await sleep(100);
}
}
const socket = net.Socket();
socket.connect(22333, '127.0.0.1', function() {
console.log('Connected');
socket.write('echo "Hello World"\n');
cringe(socket);
});
socket.on('data', function(data) {
const text = data.toString('utf-8');
console.log(text);
});
socket.on('close', function() {
console.log('Connection closed');
});
// socket.destroy();