Skip to content

Instantly share code, notes, and snippets.

View carc1n0gen's full-sized avatar

Carson Evans carc1n0gen

View GitHub Profile
@carc1n0gen
carc1n0gen / busboy-fields-before-file.js
Last active July 12, 2019 14:11
How to read form fields before the file in a multipart upload
// NOTE: this only works if the file upload form field appears last
const busboy = require('connect-busboy');
const express = require('express');
const app = express();
app.use(busboy());
app.post('/upload', (req, res) => {
@carc1n0gen
carc1n0gen / thread_safe_random_numbers.c
Last active July 12, 2019 14:11
Thread safe random numbers in c
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <threads.h>
//#define NUM_THREADS 7
// Thread safe random numbers by tempering the upper 32 bits
// of a 64 bit int. The calculations are based on a seed.