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 umami = require('./umami.js'); | |
| const api = await umami({ | |
| url: 'https://app.umami.is', | |
| username: 'username', | |
| password: 'password', | |
| website: 1, // internal website-id | |
| }) | |
| const stats = await api.getStats() |
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
| Run here: https://developer.github.com/v4/explorer/ | |
| query GetUsers{ | |
| search(query:"location:india", first: 100, type: USER, ) { | |
| userCount | |
| pageInfo { | |
| endCursor | |
| hasNextPage | |
| } | |
| edges { |
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 url = 'http://www.pdf995.com/samples/pdf.pdf'; | |
| var fileName = 'pdf.pdf'; | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', url, true); | |
| xhr.responseType = 'blob'; | |
| xhr.onprogress = function(pe) { | |
| console.log('progress'); | |
| if (pe.lengthComputable) { | |
| console.log((pe.loaded / pe.total) * 100); |
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
| import os | |
| import sys | |
| import re | |
| import boto3 | |
| import zipfile | |
| def parse_s3_uri(url): | |
| match = re.search('^s3://([^/]+)/(.+)', url) | |
| if match: | |
| return match.group(1), match.group(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
| Secure sessions are easy, but not very well documented. | |
| Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
| The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
| and to put a hardened web server in front of your Node.js application, like: | |
| [NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT] | |
| Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now. |