openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar
openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar
| const log = new Proxy({}, { | |
| get: (_, colour) => function() { | |
| console.log(`%c ${[].slice.call(arguments).join(' ')}`, `color: ${colour}`) | |
| } | |
| }) | |
| // example | |
| log.tomato('I am tomato') | |
| log.chocolate('I am chocolate') | |
| log.cornflowerblue('I am cornflowerblue') |
| # https://stackoverflow.com/a/44672195/3013522 | |
| git reset --soft HEAD~1 |
| #!/bin/bash | |
| # store the current dir | |
| CUR_DIR=$(pwd) | |
| # Let the person running the script know what's going on. | |
| echo -e "\n[Pulling in latest changes for all repositories...]" | |
| # Find all git repositories and update it to the master latest revision | |
| for i in $(find ./* -maxdepth 1 -name ".git" | cut -c 3-); do |
| var Client = require('ssh2').Client; | |
| var readline = require('readline') | |
| var conn = new Client(); | |
| conn.on('ready', function() { | |
| console.log('Client :: ready'); | |
| conn.shell(function(err, stream) { | |
| if (err) throw err; | |
| // create readline interface | |
| var rl = readline.createInterface(process.stdin, process.stdout) |
| const express = require('express'); | |
| const cors = require('cors'); | |
| const bodyParser = require('body-parser'); | |
| const app = express(); | |
| const PORT = process.env.PORT || 3000; | |
| app.use(cors()); | |
| app.use(bodyParser.urlencoded({extended: false})); | |
| app.use(bodyParser.json()); |
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>ESNextbin Sketch</title> | |
| <!-- put additional styles and scripts here --> | |
| <style> | |
| body{ | |
| background-color: #7f7a7a; | |
| }; |
openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar
openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar
| var net = require('net') | |
| var readline = require('readline') | |
| /** | |
| * @class Client | |
| * @param host {String} the host | |
| * @param post {Integer} the port | |
| */ | |
| function Client (host, port) { | |
| this.host = host |
| #!/usr/bin/env node | |
| /* | |
| Don't forget to: | |
| $ chmod 755 log-rotation.js | |
| $ mkdir logs | |
| Then you can save any generic stdout on logs piping it with log-roation.js: | |
| $ node whatever.js | ./log-rotation.js | |
| */ |