This file contains 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
server { | |
listen 80 default_server; | |
server_name _; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
} | |
location /health { |
This file contains 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' |
This file contains 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 fetchText = async (url) => { | |
return new Promise((resolve, reject) => { | |
fetch(url) | |
.then(response => { | |
if(response.status == 200) return response.text(); | |
throw new Error(response.statusText) | |
}) | |
.then(html => { | |
let parser = new DOMParser(); | |
let doc = parser.parseFromString(html, 'text/html'); |
This file contains 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
//scrapped from wikipedia: https://en.wikipedia.org/wiki/List_of_islands_of_the_Maldives | |
// var islands = []; | |
// document.querySelectorAll(".mw-headline").forEach(el => { | |
// if (el.textContent.match(/\(.+\)/)) { | |
// [...el.parentElement.nextElementSibling.nextElementSibling.children].forEach(li => { | |
// islands.push({ atoll: el.textContent, island: li.children[0].title }) | |
// }) | |
// } | |
// }) |
This file contains 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
/** | |
* Call this in console and pass YT video url as first argument | |
* e.g.: node yt-links.js https://www.youtube.com/watch?v=axBuiB55CfA | |
* Direct links can be extracted at line 24 | |
*/ | |
const https = require('https'); | |
var url = process.argv.slice(2)[0]; | |
var url = new URL(url); | |
var searchParams = new URLSearchParams(url.search); |
This file contains 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
//can be used as ArrayFunction in google sheets + appscript | |
function slugify(input) { | |
if (input.map) { // Test whether input is an array. | |
return input.map(slugify); // Recurse over array if so. | |
} else { | |
let slug = ''; | |
slug = input.toLowerCase(); | |
slug = slug.replace(/[^\w\s-]/g, ''); | |
slug = slug.replace(/\s+/g, '-'); | |
return slug; |