Skip to content

Instantly share code, notes, and snippets.

@mrlannigan
mrlannigan / bootstrap-ubuntu.sh
Created September 17, 2022 19:30 — forked from tyzbit/bootstrap-ubuntu.sh
bootstrap-ubuntu-server
#!/bin/bash
## Edit sudoers (add "NOPASSWD:" to the sudo line before ALL)
## Add optional: true to netplan and apply
# Install Docker
sudo apt-get update
sudo apt-get -y install \
apt-transport-https \
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Cinematic Bars</title>
<style>
body {
margin: 0;
padding: 0;
const list = document.getElementsByTagName('img')
for (let i = 0; i < list.length; i += 1) {
const img = list.item(i);
if (arraytomakered.includes(img.src)) {
img.style.border = '5px solid red';
}
}
@mrlannigan
mrlannigan / README.md
Last active February 23, 2018 17:08
2018-02-23 [Brown Bag] Node.js Debugging and Profiling

Debugging in Node.js

Preparing the process

First step is to always use at least the latest LTS version of Node (8.x).

Next get acquainted with how to run your process without npm or yarn, for you will need to be able to run it with node process flags. For example, for looking-glass we start our server using an index.js file in the root of the project. So instead of running yarn start, we would run node index.js.

Now by default node doesn't have the "inspector" on in the process. You have to turn it on and there are a couple ways to do that. First, and the most common, is to pass a flag to the command; node --inspect index.js or node --inspect-brk index.js. Next, you can activate it by sending a SIGUSR1 to the running process; kill -s SIGUSR1 <pid>

0x5c033554fba443f04b40197b17d47c5279fce90f
//////////////////////////////////////////////////
// mapping example
var x = {
validate: {
type: 'joi',
key: 'somekey'
}
}
// sidebar: the mapping example
var BPromise = require('bluebird'),
Hoek = require('hoek');
(function (exports) {
exports.shortCodeRegex = /\{\{\s*(.+?)\}\}/g;
exports.hasWhitespaceRegex = /\s+/;
/**
* @param {string} input - Parsed string
{
"version": "1.0.0"
}
var BPromise = require('bluebird');
var prom = new BPromise(function (resolve, reject) {
console.log(1);
resolve(3);
console.log(2);
@mrlannigan
mrlannigan / gist:4fe572754027bcad3110
Created June 10, 2015 19:36
example passthrough stream for testing
var PassThrough = require('stream').PassThrough;
var stream = new PassThrough();
stream.pipe(process.stdout);
stream.write('hello\nworld\n');
stream.end();