Skip to content

Instantly share code, notes, and snippets.

@maxrks
maxrks / cdp.js
Created December 20, 2023 17:51 — forked from imaman/cdp.js
iframe inspection w/o getFlattenedDocument()
const CDP = require('chrome-remote-interface');
const chromeLauncher = require('chrome-launcher');
const util = require('util');
// cdp.js: a playground for using chrome-devtools-protocol.
// Plug-in your own code at the run() function, below.
//
// Usage:
// $ node scripts/cdp.js
//
@maxrks
maxrks / linux-dev-box.md
Created January 14, 2023 16:16 — forked from jstott/linux-dev-box.md
Linux Dev Machine Utils / Setup
@maxrks
maxrks / aws.upload-folder-to-s3.js
Created May 31, 2022 14:56 — forked from jlouros/aws.upload-folder-to-s3.js
Upload folder to S3 (Node.JS)
const AWS = require("aws-sdk"); // from AWS SDK
const fs = require("fs"); // from node.js
const path = require("path"); // from node.js
// configuration
const config = {
s3BucketName: 'your.s3.bucket.name',
folderPath: '../dist' // path relative script's location
};
@maxrks
maxrks / sample.js
Created April 3, 2022 09:59 — forked from tushuhei/sample.js
Getting Website Title with Headless Chrome
const CDP = require('chrome-remote-interface');
const chromeLauncher = require('lighthouse/chrome-launcher/chrome-launcher');
function onPageLoad(Runtime) {
const js = "document.querySelector('title').textContent";
return Runtime.evaluate({expression: js}).then(result => {
console.log('Title of page: ' + result.result.value);
});
}