Skip to content

Instantly share code, notes, and snippets.

View adamwreuben's full-sized avatar
:atom:
Ging** Bi**

Adam Reuben adamwreuben

:atom:
Ging** Bi**
View GitHub Profile
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active August 13, 2025 14:06
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

@droganaida
droganaida / childProcess.js
Last active September 27, 2022 12:32
Node.js child_process demo. Test for exec(), execFile() and spawn().
const childProcess = require('child_process');
function execProcess(command) {
childProcess.exec(command, function(error, stdout, stderr) {
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
@bradtraversy
bradtraversy / ssh.md
Last active July 17, 2025 20:19
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

@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
var spawn = require("child_process").spawn;
exports.cURL = function (url, method) {
this.url = url;
this.method = method;
this.query = new Object();
this.param = new Array();
this.access = function (callback) {