This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _log(blob){ | |
console.log(blob) | |
} | |
function _jlog(blob){ | |
console.log(JSON.stringify(blob,null,4)) | |
} | |
/* | |
* Example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'), | |
readline = require('readline'), | |
stream = require('stream'); | |
var instream = fs.createReadStream('./FILE.csv'); | |
var outstream = new stream; | |
outstream.readable = true; | |
var isHeaders = true; // default - there exists a header, or swap true/false | |
var headers = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in *; do mv "$i" "`echo $i | sed -e 's, ,-,g'`"; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date +%s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fuck modals! | |
await page.evaluate(() => { | |
Array.from(document.getElementsByClassName('close')).filter((c) => { c.click()}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var d = new Date(); | |
alert( | |
("00" + (d.getMonth() + 1)).slice(-2) + "/" + | |
("00" + d.getDate()).slice(-2) + "/" + | |
d.getFullYear() + " " + | |
("00" + d.getHours()).slice(-2) + ":" + | |
("00" + d.getMinutes()).slice(-2) + ":" + | |
("00" + d.getSeconds()).slice(-2) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var utcSeconds = 1234567890; | |
var d = new Date(0); // The 0 there is the key, which sets the date to the epoch | |
d.setUTCSeconds(utcSeconds); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getHostName(url) { | |
var match = url.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i); | |
if (match != null && match.length > 2 && typeof match[2] === 'string' && match[2].length > 0) { | |
return match[2]; | |
} | |
else { | |
return null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const h1s = await page.evaluate( | |
() => [...document.querySelectorAll('h1')].map(elem => elem.innerText.trim())) | |
const h2s = await page.evaluate( | |
() => [...document.querySelectorAll('h2')].map(elem => elem.innerText.trim())) | |
const h3s = await page.evaluate( | |
() => [...document.querySelectorAll('h3')].map(elem => elem.innerText.trim())) | |
const h4s = await page.evaluate( | |
() => [...document.querySelectorAll('h4')].map(elem => elem.innerText.trim())) | |
const h5s = await page.evaluate( | |
() => [...document.querySelectorAll('h5')].map(elem => elem.innerText.trim())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(console){ | |
console.save = function(data, filename){ | |
if(!data) { | |
console.error('Console.save: No data') | |
return; | |
} | |
if(!filename) filename = 'console.json' |