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
// socks | |
// const axios_ = require("axios"); | |
// const SocksProxyAgent = require("socks-proxy-agent"); | |
import { default as axios_ } from "axios"; | |
import SocksProxyAgent from "socks-proxy-agent"; | |
const httpsAgent = new SocksProxyAgent("socks://127.0.0.1:1080"); | |
const httpAgent = httpsAgent; | |
const axios = axios_.create({ httpsAgent, httpAgent }); |
Replacement for __dirname and __filename when using Modules
over CommonJS
import {fileURLToPath} from 'url';
import path from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(fileURLToPath(import.meta.url));
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
# Installing cert on ubuntu: | |
# Save .pem file from chares, convert it to .crt with | |
openssl x509 -in cert.pem -inform PEM -out cert.crt | |
# Move to /usr/local/share/ca-certificates/extra | |
sudo mv cert.crt /usr/local/share/ca-certificates/extra | |
# Run | |
sudo update-ca-certificates | |
# | |
# Import .pem to Firefox or anywhere |
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
"use strict"; | |
const Promise = require('bluebird'); | |
const Page = require('puppeteer/node6/lib/Page'); | |
function newPageWithNewContext(browser) { | |
let browserContextId; | |
let targetId; | |
let target; | |
return Promise.resolve() |
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
ORIGIN: https://android.googlesource.com/platform/system/core/+/android-2.3.4_r1/adb/SERVICES.TXT | |
This file tries to document all requests a client can make | |
to the ADB server of an adbd daemon. See the OVERVIEW.TXT document | |
to understand what's going on here. | |
HOST SERVICES: | |
host:version | |
Ask the ADB server for its internal version number. | |
As a special exception, the server will respond with a 4-byte | |
hex string corresponding to its internal version number, without |
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
ORIGIN: https://android.googlesource.com/platform/system/core/+/android-2.3.4_r1/adb/OVERVIEW.TXT | |
Implementation notes regarding ADB. | |
I. General Overview: | |
The Android Debug Bridge (ADB) is used to: | |
- keep track of all Android devices and emulators instances | |
connected to or running on a given host developer machine | |
- implement various control commands (e.g. "adb shell", "adb pull", etc..) | |
for the benefit of clients (command-line users, or helper programs like | |
DDMS). These commands are what is called a 'service' in ADB. |
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
console.reset = function () { | |
return process.stdout.write('\033c'); | |
} |
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 + Client | |
// Server | |
require('net').createServer((socket) => { | |
console.log("connected"); | |
socket.on('data', (data) => { | |
console.log(data.toString()); | |
}); |
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
// by https://stackoverflow.com/a/50101022/15516769 | |
// more info https://developers.google.com/web/updates/2017/09/abortable-fetch | |
const controller = new AbortController(); | |
const timeoutId = setTimeout(() => controller.abort(), 30 * 1000); | |
fetch(url, { signal: controller.signal }) | |
.then((response) => { | |
// completed request before timeout fired |