Skip to content

Instantly share code, notes, and snippets.

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import pyax
import time
import psutil
URL = "https://en.wikipedia.org/wiki/World_War_I"
# URL = "https://html.spec.whatwg.org/"
FIREFOX_BINARY = "/Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin"
@eeejay
eeejay / .gitignore
Last active September 7, 2022 16:53
SVG source for Mozilla's accessibility team sticker
*.png
'use strict';
let userAgentString = navigator.userAgent;
// Detect Chrome
let chromeAgent = userAgentString.indexOf("Chrome") > -1;
let safariAgent = userAgentString.indexOf("Safari") > -1 && !chromeAgent ? true : false;
Element.prototype.isInvisible = function() {
if (this.style.display == 'none') return true;
if (getComputedStyle(this).display === 'none') return true;
if (this.parentNode.isInvisible) return this.parentNode.isInvisible();
@eeejay
eeejay / install_addon.js
Created November 16, 2020 17:31
Sideload addon in Firefox for Android
// In main process JS console:
const { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm")
AddonManager.getInstallForURL(XPI_URL).then(r => r.install())
@eeejay
eeejay / blah.sh
Created December 11, 2019 22:28
Re-add Fedora in EFI boot
mount /dev/dm-5 /mnt
mount /dev/nvme0n1p5 /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot/efi
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
chroot /mnt
# in chroot:
# grep efibootmgr /var/log/anaconda/program.log
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eeejay
eeejay / index.html
Last active December 15, 2018 19:11
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no" />
<style>
html {
height: 100%;
width: 100%;
}
function showClientCoords(win, x, y, timeout=1000) {
let d = win.document.createElement("div");
d.style.width = "10px";
d.style.height = "10px";
d.style.borderRadius = "5px";
d.style.backgroundColor = "red";
d.style.position = "fixed";
d.style.top = (y + 5) + "px";
d.style.left = (x + 5) + "px";
win.document.documentElement.appendChild(d);
@eeejay
eeejay / hosting_good.html
Last active June 21, 2019 01:46
Good Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Good Example</title>
<style>
body {
margin: 50px;
// DOMContentLoaded is fired once the document has been loaded and parsed,
// but without waiting for other external resources to load (css/images/etc)
// That makes the app more responsive and perceived as faster.
// https://developer.mozilla.org/Web/Reference/Events/DOMContentLoaded
function getMessages() {
return new Promise((resolve, reject) => {
var x = new XMLHttpRequest();
var params = "m5_csrf_tkn=" + document.querySelector("meta[name=csrf_id]").content;
console.log(params);