Skip to content

Instantly share code, notes, and snippets.

View steevehook's full-sized avatar
📖
redefining education

Steve Hook steevehook

📖
redefining education
View GitHub Profile
@steevehook
steevehook / nginx-websocket-proxy.conf
Created May 17, 2018 13:42 — forked from uorat/nginx-websocket-proxy.conf
Nginx Reverse Proxy for WebSocket
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
@steevehook
steevehook / nginx.conf
Created May 21, 2018 07:15 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
git tag -am "annotation goes here" tagname_goes_here # cut a tag
git tag -d tagname_goes_here # burn it
git tag -am "annotation goes here" tagname_goes_here # cut another tag
git push --tags # push tags to remote
git push origin :refs/tags/tagname_goes_here # delete tag from remote
@steevehook
steevehook / mason.js
Created June 6, 2018 08:01 — forked from smks/mason.js
This is a sample commander CLI application used in Medium Article - How I automated my Job with Node JS
#! /usr/bin/env node
const mason = require('commander');
const { version } = require('./package.json');
const console = require('console');
// commands
const create = require('./commands/create');
const setup = require('./commands/setup');

git-flow (AVH Edition)

A collection of Git extensions to provide high-level repository operations for Vincent Driessen's branching model. This fork adds functionality not added to the original branch.

Getting started

For the best introduction to get started with git flow, please read Jeff

@steevehook
steevehook / go-os-arch.md
Created June 12, 2018 18:21 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
const { parentPort } = require('worker_threads');
function random(min, max) {
return Math.random() * (max - min) + min
}
const sorter = require("./test2-worker");
const start = Date.now()
let bigList = Array(1000000).fill().map( (_) => random(1,10000))
const { Worker, isMainThread, parentPort, workerData } = require('worker_threads');
const request = require("request");
function startWorker(path, cb) {
let w = new Worker(path, {workerData: null});
w.on('message', (msg) => {
cb(null, msg)
})
w.on('error', cb);
w.on('exit', (code) => {
@steevehook
steevehook / worker-threads-sample2.js
Created June 29, 2018 08:11 — forked from deleteman/worker-threads-sample2.js
Example of using worker threads for heavy computation while performing async operation
const { Worker, isMainThread, parentPort, workerData } = require('worker_threads');
const request = require("request");
if(isMainThread) {
console.log("This is the main thread")
let w = new Worker(__filename, {workerData: null});
w.on('message', (msg) => { //A message from the worker!
console.log("First value is: ", msg.val);
const { Worker, isMainThread, workerData } = require('worker_threads');
let currentVal = 0;
let intervals = [100,1000, 500]
function counter(id, i){
console.log("[", id, "]", i)
return i;
}