Skip to content

Instantly share code, notes, and snippets.

View 327jwolf's full-sized avatar

JJH 327jwolf

View GitHub Profile
@327jwolf
327jwolf / node_nginx_ssl.md
Created November 30, 2019 04:53 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@327jwolf
327jwolf / ssh.md
Created September 15, 2019 23:41 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh [email protected]

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@327jwolf
327jwolf / README.md
Created June 26, 2019 05:26 — forked from pcan/README.md
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Prepare certificates

Generate a Certificate Authority:

openssl req -new -x509 -days 9999 -keyout ca-key.pem -out ca-crt.pem
const Pusher = require('pusher')
const secrets = require('./secrets')
const Encryptor = require('simple-encryptor')
const R = require('ramda')
const encrypt = R.curry((secret, data) => Encryptor(secret).encrypt(data))
const encryptWithSecret = encrypt(secrets.e2eSecret)
const trigger = R.curry((secrets, channel, event, message) => {
const client = new Pusher({
appId: secrets.appId,
@327jwolf
327jwolf / obs.js
Created May 25, 2019 02:59 — forked from mpj/obs.js
const delay = require('delay')
async function* makeCountingObservable() {
let count = 0
while(true) {
if (count > 4) return
await delay(1000)
yield count++
}
}
const counter = makeCountingObservable()
@327jwolf
327jwolf / README.md
Created March 20, 2019 12:43 — forked from anhldbk/README.md
TLS client & server in NodeJS

1. Overview

This is an example of using module tls in NodeJS to create a client securely connecting to a TLS server.

It is a modified version from documentation about TLS, in which:

  • The server is a simple echo one. Clients connect to it, get the same thing back if they send anything to the server.
  • The server is a TLS-based server.
  • Clients somehow get the server's public key and use it to work securely with the server

2. Preparation

@327jwolf
327jwolf / pubsub.js
Created November 20, 2018 04:35 — forked from learncodeacademy/pubsub.js
Basic Javascript PubSub Pattern
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {
@327jwolf
327jwolf / filterTables.js
Last active February 21, 2018 19:14
Filters Table on multiple text columns
// let domIsReady = function(callback) {
// document.readyState === "interactive" || document.readyState === "complete"
// ? callback()
// : document.addEventListener("DOMContentLoaded", callback);
// };
domIsReady(function() {
//give tbody class rows of tblRows
//give inputs and body td id as first attribute.
// make sure input type='search' is second attribute.