Skip to content

Instantly share code, notes, and snippets.

View caesaneer's full-sized avatar

Dan Casler caesaneer

View GitHub Profile
const path = require('path')
const webpack = require('webpack')
const HtmlWebPackPlugin = require('html-webpack-plugin')
const ErrorOverlayPlugin = require('error-overlay-webpack-plugin')
module.exports = {
devtool: 'cheap-module-source-map',
mode: 'development',
entry: {
index: './src/index.js',
{
"presets": [
"env",
"react",
"stage-2"
],
"plugins": [
"transform-react-jsx-source"
]
}
// ════════════════════════════════════════════════════════════════════════════════════════════════╡
const Hapi = require('hapi')
const Inert = require('inert')
const chalk = require('chalk')
const path = require('path')
// ════════════════════════════════════════════════════════════════════════════════════════════════╡
// Set path to production build
package main
import (
"crypto/sha256"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"github.com/labstack/echo"
// ════════════════════════════════════════════════════════════════════════════════════════════════╡
const { parentPort, workerData } = require('worker_threads')
const crypto = require('crypto')
const util = require('util')
const fs = require('fs')
// ════════════════════════════════════════════════════════════════════════════════════════════════╡
const asyncFs = util.promisify(fs.readFile)
package ktor.benchmark
/* ktlint-disable no-wildcard-imports */
import io.ktor.application.*
import io.ktor.response.*
import io.ktor.request.*
import io.ktor.routing.*
import io.ktor.http.*
import io.ktor.locations.*
@caesaneer
caesaneer / gist:2810c9fbcfdc2c5bd6804c966f2d80db
Created August 14, 2019 22:14
Go Goroutines vs Node.js Cluster & Worker Threads - Part 1 - Go Code
package main
import (
"fmt"
"net/http"
"runtime"
)
func ok(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "OK")
@caesaneer
caesaneer / entry.go
Last active April 16, 2020 09:25
Go Goroutines vs Node.js Cluster & Worker Threads - Part 1 - Go Code
package main
import (
"fmt"
"net/http"
"runtime"
)
func ok(w http.ResponseWriter, req *http.Request) {
@caesaneer
caesaneer / index.js
Last active April 16, 2020 09:25
Go Goroutines vs Node.js Cluster & Worker Threads - Part 1 - Node.js Code - NO CLUSTER
const http = require('http')
const host = '192.168.0.14'
const port = 3000
const start = function startServer() {
// Simple request router
const router = function requestRouter(request, reply) {
reply.end('OK')
}
@caesaneer
caesaneer / gist:417cd88062d3bebcfaf8708ebc17862e
Last active September 21, 2023 20:47
Go Goroutines vs Node.js Cluster & Worker Threads - Part 1 - Node.js Code - CLUSTER
const cluster = require('cluster')
const http = require('http')
const numCPUs = require('os').cpus().length
const host = '192.168.0.14'
const port = 3000
const start = async function startServer() {
// Cluster
if (cluster.isMaster) {