Skip to content

Instantly share code, notes, and snippets.

package org.example;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.LockSupport;
class Task {
int id;
String data;
Thread thread;
@oldshensheep
oldshensheep / draw_canvas.html
Last active August 26, 2022 05:15
draw canvas. a modern approach.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
import java.io.FileOutputStream;
import java.io.IOException;
public class Hello {
public static void main(String[] args) throws IOException {
long a = System.currentTimeMillis();
int size = (int) (Math.pow(10, 8) * 4); //bytes
byte[] bytes = new byte[size];
for (int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) i;