Skip to content

Instantly share code, notes, and snippets.

View soulgalore's full-sized avatar

Peter Hedenskog soulgalore

View GitHub Profile
@soulgalore
soulgalore / install-sitespeed.io-and-dependencies-debian.sh
Last active January 26, 2024 07:19
Install sitespeed.io and dependencies on Debian
#!/bin/bash
# Make sure we have curl
sudo apt update
sudo apt install -y curl
# Install NodeJS
curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install -y nodejs
# Install Visual Metrics dependencies
sudo apt-get update -y && sudo apt-get install -y ffmpeg
@soulgalore
soulgalore / install-sitespeed.io-and-dependencies-ubuntu.sh
Last active January 26, 2024 07:34
Install sitespeed.io and dependencies on Ubuntu
#!/bin/bash
# Skip "dameons using outdated library"
sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
# Make sure we have curl
sudo apt update
sudo apt install -y curl
# Install NodeJS
curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install -y nodejs
@soulgalore
soulgalore / marionette.log
Created October 19, 2020 12:36
Marionette log whet Firefox isn't starting (adb -s ZY322HX8RC logcat | grep Marionette)
10-19 13:30:47.543 11024 11053 I Gecko : 1603110647543 Marionette TRACE Marionette enabled
10-19 13:30:47.752 11024 11053 I Gecko : 1603110647752 Marionette TRACE Received observer notification toplevel-window-ready
10-19 13:30:47.846 11024 11053 I Gecko : 1603110647846 Marionette TRACE Received observer notification marionette-startup-requested
10-19 13:30:47.847 11024 11053 I Gecko : 1603110647847 Marionette TRACE Waiting until startup recorder finished recording startup scripts...
10-19 13:30:49.457 11024 11053 I Gecko : 1603110649457 Marionette TRACE All scripts recorded.
10-19 13:30:49.458 11024 11053 I Gecko : 1603110649458 Marionette DEBUG Setting recommended pref apz.content_response_timeout to 60000
10-19 13:30:49.458 11024 11053 I Gecko : 1603110649458 Marionette DEBUG Setting recommended pref browser.contentblocking.introCount to 99
10-19 13:30:49.459 11024 11053 I Gecko : 1603110649459 Marionette DEBUG Setting recommended pref browser.download.panel.shown to true
10-19 13:30:49.459
@soulgalore
soulgalore / marionette-log
Last active October 16, 2020 13:45
Log running adb -s ZY322HX8RC logcat | grep Marionette
10-16 13:27:01.596 23241 23271 I Gecko : 1602851221596 Marionette TRACE Marionette enabled
10-16 13:27:01.785 23241 23271 I Gecko : 1602851221785 Marionette TRACE Received observer notification toplevel-window-ready
10-16 13:27:01.884 23241 23271 I Gecko : 1602851221884 Marionette TRACE Received observer notification marionette-startup-requested
10-16 13:27:01.886 23241 23271 I Gecko : 1602851221886 Marionette TRACE Waiting until startup recorder finished recording startup scripts...
10-16 13:33:10.924 23818 23851 I Gecko : 1602851590924 Marionette TRACE Marionette enabled
10-16 13:33:11.115 23818 23851 I Gecko : 1602851591115 Marionette TRACE Received observer notification toplevel-window-ready
10-16 13:33:11.210 23818 23851 I Gecko : 1602851591210 Marionette TRACE Received observer notification marionette-startup-requested
10-16 13:33:11.211 23818 23851 I Gecko : 1602851591211 Marionette TRACE Waiting until startup recorder finished recording startup scripts...
10-16 13:33:12.864 23818 2385
'use strict';
const Database = require('better-sqlite3');
// keep the name in package.json so its easy just to chanfe
const DATABASE_NAME= require('./package').database_name;
function getQ(domains) {
const q = [];
for(let domain of domains){
q.push('?')
@soulgalore
soulgalore / safari.js
Last active January 26, 2022 23:58
Run Safari on iOS using Selenium
const { Builder, Capabilities } = require('selenium-webdriver');
(async function example() {
const caps = Capabilities.safari();
caps.set('platformName', 'iOS');
const driver = await new Builder()
.forBrowser('safari')
.withCapabilities(caps)
.build();
try {
@soulgalore
soulgalore / chrome-trace.json
Created May 13, 2019 17:07
Chrome trace of testing a SPA with extra end event
This file has been truncated, but you can view the full file.
{"traceEvents":[{"args":{"data":{"documentLoaderURL":"https://dashboard.sitespeed.io/d/000000044/page-timing-metrics?orgId=1&from=now-30d&to=now","isLoadingMainFrame":true,"navigationId":"fake"},"frame":"E11D28646BE5FD8B1110733B42816E6D"},"cat":"blink.user_timing","name":"navigationStart","ph":"R","pid":4034,"tid":4034,"ts":17974008374090,"tts":121451},{"pid":4034,"tid":4034,"ts":17974008374090,"ph":"I","cat":"disabled-by-default-devtools.timeline","name":"TracingStartedInPage","args":{"data":{"page":"E11D28646BE5FD8B1110733B42816E6D"}},"s":"t"},{"pid":3611,"tid":3647,"ts":17974008372637,"ph":"X","cat":"devtools.timeline","name":"RunTask","args":{},"dur":16,"tdur":14,"tts":25844},{"pid":3611,"tid":3647,"ts":17974009405704,"ph":"X","cat":"devtools.timeline","name":"RunTask","args":{},"dur":11,"tdur":8,"tts":27592},{"pid":3611,"tid":3653,"ts":17974008377674,"ph":"X","cat":"devtools.timeline","name":"RunTask","args":{},"dur":29,"tdur":28,"tts":202030},{"pid":3611,"tid":3653,"ts":17974008382397,"ph":"X","cat":"de
@soulgalore
soulgalore / lite.txt
Created March 18, 2019 18:30
Force Lite pages in Chrome on Android
# What do you actually need to enable Lite pages on Android on with command line switches?
Been trying on Chrome Beta and Chrome Dev:
--data-reduction-proxy-lo-fi=always-on
--enable-data-reduction-proxy-lite-page
--force-effective-connection-type=2G
That doesn't work for me, what am I missing?
{
"working": {
"https://www.sitespeed.io": [
{
"metric": "firstPaint",
"type": "timings",
"value": 351,
"friendlyValue": "351 ms",
"limit": 1000,
"friendlyLimit": "1.000 s",
{
"har1": {
"url": "https://s3.amazonaws.com/results.sitespeed.io/en.wikipedia.org/2018-10-18-08-50-26/pages/en.wikipedia.org/wiki/Barack_Obama/data/browsertime.har.gz",
"label": "Before change"
},
"har2": {
"url": "https://s3.amazonaws.com/results.sitespeed.io/en.wikipedia.org/2018-10-17-15-55-57/pages/en.wikipedia.org/wiki/Barack_Obama/data/browsertime.har.gz",
"label": "After change"
},
"comment": "Look at the first request. Something is seriously wrong there :("