dd if=/dev/urandom of=/dev/shm/random.bin bs=65536 count=10000
gcc -g -O3 -o sha256sum sha256sum.c
const fd = just.sys.shmopen('/omgthisiscool') | |
const size = 1 * 1024 * 1024 * 1024 | |
const ab = just.sys.mmap(fd, size) | |
const u32 = new Uint32Array(ab) | |
just.setInterval(() => { | |
just.print(Atomics.load(u32, 0)) | |
}, 1000) |
<p> | |
testing | |
</p> |
wc | |
wcb | |
scratch |
function checksum (file) { | |
const source = Buffer.alloc(65536) | |
const fd = openSync(file) | |
const hash = createHash('sha256') | |
let bytes = readSync(fd, source) | |
while (bytes > 0) { | |
if (bytes < 65536) { | |
hash.update(source.slice(0, bytes)) | |
} else { | |
hash.update(source) |
const { allFortunes } = sock | |
allFortunes.call(() => { | |
const html = getHTML(insertionSort([extra, ...allFortunes.getRows()])) | |
sock.writeString(`${rHTML}${utf8Length(html)}${END}${html}`) | |
}) |
sock.allFortunes = await compile(sock, { | |
formats: [], | |
sql: 'select * from Fortune', | |
fields: [{ format: 1, oid: INT4OID }, { format: 0, oid: VARCHAROID }], | |
name: 's2', | |
portal: '', | |
maxRows: 0, | |
htmlEscape: true, | |
params: [] | |
}) |
sock.allFortunes = await compile(sock, { | |
formats: [], | |
sql: 'select * from Fortune', | |
fields: [{ format: 1, oid: INT4OID }, { format: 0, oid: VARCHAROID }], | |
name: 's2', | |
portal: '', | |
maxRows: 0, | |
htmlEscape: true, | |
params: [] | |
}) |
const { Socket, TCP } = library('socket', {}) | |
const server = new Socket(TCP) | |
const read = Buffer.alloc(64 * 1024) | |
const write = Buffer.alloc(64 * 1024) | |
const bytes = new Uint8Array(read.bytes) | |
let off = 0, records = 0, resLength = 0 | |
const response = `HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nServer: dv8\r\nDate: ${(new Date()).toUTCString()}\r\nContent-Length: 13\r\n\r\nHello, World!` | |
while (1) { | |
resLength = write.write(response, off) | |
off += resLength |