Skip to content

Instantly share code, notes, and snippets.

View noamr's full-sized avatar

Noam Rosenthal noamr

View GitHub Profile
addEventListener("fetch", e => {
if (e.request.destination !== "image" || // Only do this when requesting an image
request.mode === "no-cors") // We don't know the status of no-cors images
return;
e.respondWith((async () => {
try {
const response = await fetch(e.request);
if (response.ok)
return response;
export function supportsExifResolution() {
return new Promise((resolve, reject) => {
const image = new Image();
image.src = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAGAAkAAD/4QCwRXhpZgAATU0AKgAAAAgABQEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAITAAMAAAABAAEAAIdpAAQAAAABAAAAWgAAAAAAAAAYAAAAAQAAACQAAAABAAaQAAAHAAAABDAyMzKRAQAHAAAABAECAwCgAAAHAAAABDAxMDCgAQADAAAAAf//AACgAgADAAAAAQADAACgAwADAAAAAQACAAAAAAAA/9sAQwABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB/9sAQwEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB/8AAEQgAAQABAwERAAIRAQMRAf/EABQAAQAAAAAAAAAAAAAAAAAAAAr/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AH8A/9k="
image.onload = () => {
if (image.naturalWidth === 3 && image.naturalHeight === 2)
resolve()
else
reject("EXIF resolution is not supported")
}
This file has been truncated, but you can view the full file.
[
{"computedWidth":188,"computedHeight":50,"naturalWidth":188,"naturalHeight":50,"src":"http://ak2.imgaft.com/images/new_logo_GDTrans.png","htmlWidth":null,"htmlHeight":null,"styleWidth":"","styleHeight":"","website":"http://techbays.com/2008/03/10/why-is-redtube-popular/"},
{"computedWidth":240,"computedHeight":134,"naturalWidth":240,"naturalHeight":134,"src":"http://ak2.imgaft.com/images/feature-illu-dot-com-domain.png","htmlWidth":null,"htmlHeight":null,"styleWidth":"","styleHeight":"","website":"http://techbays.com/2008/03/10/why-is-redtube-popular/"},
{"computedWidth":244,"computedHeight":19,"naturalWidth":244,"naturalHeight":19,"src":"http://parked-content.godaddy.com/images/99C_code.png","htmlWidth":null,"htmlHeight":null,"styleWidth":"","styleHeight":"","website":"http://techbays.com/2008/03/10/why-is-redtube-popular/"},
{"computedWidth":1,"computedHeight":1,"naturalWidth":1,"naturalHeight":1,"src":"http://techbays.com/img.aspx?q=L3MkWGAkBQt0AGR5ZmHmZGL5ZmL1ZmR1AlHlAzpyZ3R1ZQNkWGV2MFHmpFHlAz4yZ3RjWGV2
This file has been truncated, but you can view the full file.
[{"computedWidth":88,"computedHeight":31,"naturalWidth":88,"naturalHeight":31,"src":"https://www.wikidata.org/static/images/poweredby_mediawiki_88x31.png","website":"https://www.wikidata.org/wiki/Q35127"},
{"computedWidth":88,"computedHeight":31,"naturalWidth":88,"naturalHeight":31,"src":"https://www.wikidata.org/static/images/wikimedia-button.png","website":"https://www.wikidata.org/wiki/Q35127"},
{"computedWidth":220,"computedHeight":260,"naturalWidth":220,"naturalHeight":260,"src":"https://upload.wikimedia.org/wikipedia/commons/thumb/d/de/Www.wikipedia.org_screenshot.png/220px-Www.wikipedia.org_screenshot.png","website":"https://www.wikidata.org/wiki/Q35127"},
{"computedWidth":110,"computedHeight":58,"naturalWidth":110,"naturalHeight":58,"src":"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Wiki_Loves_Women_South_Asia_Logo-pa.png/110px-Wiki_Loves_Women_South_Asia_Logo-pa.png","website":"https://pa.wikipedia.org/wiki/%E0%A8%AA%E0%A9%8D%E0%A8%B0%E0%A8%B8%E0%A8%BF%E0%A9%B1%E0%A8%A7_%E0%
#include <AxisJoystick.h>
// these constants won't change:
const int piezo1 = A0; // the piezo is connected to analog pin 0
const int piezo2 = A1; // the piezo is connected to analog pin 0
const int piezo3 = A2; // the piezo is connected to analog pin 0
const int piezo4 = A3; // the piezo is connected to analog pin 0
const int minValue = 384; // threshold value to decide when the detected sound is a knock or not
const int maxValue = 1024;
@noamr
noamr / eval.js
Last active December 26, 2017 20:14
await page.evaluate((x, y) => window.scrollBy(x, y), x, y)
javascript:(function() { var script = document.createElement("SCRIPT"); script.setAttribute('src', 'http://172.31.8.138:8080/target/target-script-min.js'); document.body.appendChild(script); })()
<!DOCTYPE html>
<html>
<body>
<svg style="stroke:black; stroke-width: 4; overflow: visible; height: 32px; width: 32px">
<g style="stroke-linecap: round">
<line x2="100%" />
<line y1="50%" y2="50%" x2="100%" />
<line y1="100%" y2="100%" x2="100%" />
</g>
FROM debian:jessie
RUN apt-get update && apt-get install -y zlib1g libssl1.0.0 libcurl3-gnutls nodejs libstdc++6
COPY ${DEB_FILE} /tmp/vobadk.deb
RUN dpkg -i --force-all /tmp/vobadk.deb; rm -rf /var/lib/apt/lists; rm /tmp/*; apt-get purge; apt-get autoremove -y
FROM ubuntu:14.04
COPY vobadk.deb /tmp/
RUN apt-get update
RUN dpkg -i --force-depends /tmp/vobadk.deb
RUN apt-get -f -y install
ENTRYPOINT /usr/local/vobadk/bin/adk-controller