This way we can send HTTP requests from the Node.js instead of UI interactions.
const cookies = await page.cookies()
cookies.forEach(
async cookie => {
await setCookie(
-- Haversine Formula based geodistance in miles (constant is diameter of Earth in miles) | |
-- Based on a similar PostgreSQL function found here: https://gist.github.com/831833 | |
-- Updated to use distance formulas found here: http://www.codecodex.com/wiki/Calculate_distance_between_two_points_on_a_globe | |
CREATE OR REPLACE FUNCTION public.geodistance(alat double precision, alng double precision, blat double precision, blng double precision) | |
RETURNS double precision AS | |
$BODY$ | |
SELECT asin( | |
sqrt( | |
sin(radians($3-$1)/2)^2 + | |
sin(radians($4-$2)/2)^2 * |
# Reliable persistent SSH-Tunnel via systemd (not autossh) | |
# https://gist.github.com/guettli/31242c61f00e365bbf5ed08d09cdc006#file-ssh-tunnel-service | |
[Unit] | |
Description=Tunnel for %i | |
After=network.target | |
[Service] | |
User=tunnel | |
ExecStart=/usr/bin/ssh -o "ExitOnForwardFailure yes" -o "ServerAliveInterval 60" -N tunnel@%i |
let fnGetFileNameFromContentDispostionHeader = function (header) { | |
let contentDispostion = header.split(';'); | |
const fileNameToken = `filename*=UTF-8''`; | |
let fileName = 'downloaded.pdf'; | |
for (let thisValue of contentDispostion) { | |
if (thisValue.trim().indexOf(fileNameToken) === 0) { | |
fileName = decodeURIComponent(thisValue.trim().replace(fileNameToken, '')); | |
break; | |
} |
# | |
# This is the ultimate HAProxy 2.0 "Getting Started" config | |
# It demonstrates many of the features available which are now available | |
# While you may not need all of these things, this can serve | |
# as a reference for your own configurations. | |
# | |
# Have questions? Check out our community Slack: | |
# https://slack.haproxy.org/ | |
# |
// JSON to Uint8Array parsing and visa versa | |
// (Intended Bluetooth communication on Cordova) | |
var JsonToArray = function(json) | |
{ | |
var str = JSON.stringify(json, null, 0); | |
var ret = new Uint8Array(str.length); | |
for (var i = 0; i < str.length; i++) { | |
ret[i] = str.charCodeAt(i); | |
} |
Doxbee sequential | |
benchmarking ./doxbee-sequential/async-bluebird.js | |
{"time":428,"mem":60.38671875,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/async-es2017-native.js | |
{"time":591,"mem":98.82421875,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/async-es2017-util.promisify.js | |
{"time":479,"mem":69.7734375,"errors":0,"lastErr":null} | |
benchmarking ./doxbee-sequential/callbacks-baseline.js | |
{"time":149,"mem":29.99609375,"errors":0,"lastErr":null} |
Sometimes a programming language has a "strict mode" to restrict unsafe constructs. E.g., Perl has use strict
, Javascript has "use strict"
, and Visual Basic has Option Strict
. But what about bash? Well, bash doesn't have a strict mode as such, but it does have an unofficial strict mode:
set -euo pipefail
set -e
brew install caddy mkcert nss dnsmasq | |
mkcert -install | |
mkcert '*.app.test' '*.cdn.test' | |
# rename the certs and move them under /usr/local/etc/caddy/certs | |
cat <<EOF > /usr/local/etc/caddy/Caddyfile | |
*.app.test:443, *.cdn.test:443 { |
This document describes how to use Android Studio with downloads of offline Android Gradle plugin and Google Maven repository dependencies.
If you haven’t already done so, download the offline components from the official Android Studio website: https://d.android.com/r/studio-offline/downloads .