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
const fs = require('fs'); | |
const lighthouse = require('lighthouse'); | |
const chromeLauncher = require('chrome-launcher'); | |
(async () => { | |
const chrome = await chromeLauncher.launch(); | |
const options = {logLevel: 'info', output: 'json', onlyCategories: ['performance'], port: chrome.port}; | |
const DEVTOOLS_RTT_ADJUSTMENT_FACTOR = 3.75; | |
const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR = 0.9; | |
const mobileRegular3g = { |
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
/*Need to change fetch different value from url array manually. | |
Because performance degrades with continous run. | |
*/ | |
//Tested for regular 3G | |
const fs = require('fs'); | |
const lighthouse = require('lighthouse'); | |
const chromeLauncher = require('chrome-launcher'); | |
const url = ["https://www.amazon.in/", "https://twitter.com/", "https://www.snapdeal.com/", "https://abc.com/", "https://www.ticket.at/de/home" ]; | |
const DEVTOOLS_RTT_ADJUSTMENT_FACTOR = 3.75; |
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
/*Need to change fetch different value from url array manually. | |
Because performance degrades with continous run. | |
*/ | |
const fs = require('fs'); | |
const lighthouse = require('lighthouse'); | |
const chromeLauncher = require('chrome-launcher'); | |
const url = ["https://www.amazon.in/", "https://twitter.com/", "https://www.snapdeal.com/", "https://abc.com/", "https://www.ticket.at/de/home" ]; | |
(async () => { | |
element = url[1] | |
const chrome = await chromeLauncher.launch(); |
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
const fs = require('fs'); | |
const lighthouse = require('lighthouse'); | |
const chromeLauncher = require('chrome-launcher'); | |
(async () => { | |
const chrome = await chromeLauncher.launch({chromePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"}); //Specify chrome binary path to run lighthouse. | |
const options = {logLevel: 'info', output: 'html', onlyCategories: ['performance'], port: chrome.port}; | |
const runnerResult = await lighthouse('https://example.com', options); | |
// `.report` is the HTML report as a string |
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
# To set available for CIU user | |
RedisUtils.ciu_live_set_availability_status(true) | |
#To disable ciu user | |
# RedisUtils.ciu_live_set_availability_status(false) | |
#To set desktop support | |
RedisUtils.ciu_live_set_platform_support("desktop", true) | |
#To disable desktop support |
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
let url = [ | |
"csdn.net", | |
"github.com", | |
"canva.com", | |
"yahoo.co.jp", | |
"naver.com", | |
"bongacams.com", | |
"bing.com", | |
"ebay.com", | |
"yy.com", |
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
ServerSocket server = new ServerSocket(80); // Listen for connection on port 89 | |
System.out.println("Server started"); | |
Socket socket = server.accept(); //Wait for client | |
System.out.println("Client accepted"); |
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
socket = server.accept(); | |
System.out.println("Client accepted"); | |
DataInputStream in = new DataInputStream(new BufferedInputStream(socket.getInputStream())); | |
byte[] messageByte = new byte[1000]; | |
String dataString = ""; | |
while(true) | |
{ | |
int bytesRead = in.read(messageByte); |
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
// Get output stream | |
DataOutputStream out = new DataOutputStream(socket.getOutputStream()); | |
String message = "HTTP/1.1 200 OK\r\n" + | |
"Server: noob-server\r\n" + | |
"Date: 14 March, 1977\r\n" + | |
"\r\n" + | |
"Hello world - noob server"; | |
out.write(message.getBytes()); |
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
String dataString = ""; | |
String body = ""; | |
try | |
{ | |
while(true) | |
{ | |
int bytesRead = in.read(messageByte); | |
if (bytesRead == -1) | |
break; | |
dataString += new String(messageByte, 0, bytesRead); |
OlderNewer