Skip to content

Instantly share code, notes, and snippets.

<html>
<body>
<h1>cors test</h1>
<script>
const tester = async () => {
const out = await fetch("http://localhost:7777/");
const text = await out.text()
console.log(text);
const serialport = require('serialport');
const SerialPort = serialport.SerialPort;
const PORT = "/dev/ttyUSB0";
serialPort = new SerialPort({
path: PORT,
baudRate: 115200,
});
serialPort.on("open", () => {
const reader = (blob) => {
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => resolve(reader.result)
reader.onerror = reject
reader.readAsDataURL(blob)
})
}
const toDataURL = async (url) => {
<html>
<body>
<input type="file" class="choose" value=""><br/>
<img id="original-image" width="300px"><br/><br>
<div id="images">
</div>
Sleep, 1000
WinActivate, ahk_exe chrome.exe
Loop {
Sleep, 30000
WinActivate, ahk_exe chrome.exe
}
import puppeteer from 'puppeteer';
let page, context;
const browser = await puppeteer.launch({
headless: false
});
const sleep = (time) => {
return new Promise((resolve) => {
setTimeout(resolve, time);
import browser from "webextension-polyfill";
const entries = async (key) => {
const values = await browser.storage.local.get(key);
if (Array.isArray(values[key])) {
return values[key];
} else {
return [];
}
}
const API_KEY = `UsEYourOwnApIK3Yp|ea5e`; // https://console.developers.google.com/apis/credentials?project=phot-256520
const MAX_PAGES = 10 // * 50
const VIDEO_ID = new URLSearchParams((new URL(window.location.href)).search).get('v');
const API_URL = `https://www.googleapis.com/youtube/v3/commentThreads?key=${API_KEY}&textFormat=plainText&part=snippet&videoId=${VIDEO_ID}&maxResults=50`;
const API_NEXT_URL = `https://www.googleapis.com/youtube/v3/commentThreads?key=${API_KEY}&textFormat=plainText&part=snippet&maxResults=50&pageToken=`;
const getComments = async (nextToken) => {
const resp = await fetch(nextToken ? `${API_NEXT_URL}${nextToken}` : API_URL)
const json = await resp.json();
@zoutepopcorn
zoutepopcorn / index.js
Created October 20, 2020 14:29
babel-node index.js jspdf
import {jsPDF} from "jspdf";
import {encode, decode} from 'node-base64-image';
const B64 = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAAAklEQVR4AewaftIAAAJMSURBVO3BMWocVhiF0e9dpkjh0gtI50UYLcYgrcqN9zK4ygoGFdEG0qmY7qUNGFTkMn788J2z/oKN9D8FqRCkQpAKQSoEqRCkQpAKQSoEqRCkQpAKQSoEqRCkQpAKQSoEqRCkQpAKQSoEqRCkQpAKFx7sjy9f+PT0hH6/9+uV++3GI114sE9PT/z5/Tv6/d5eXrjfbjxSkApBKgSpEKRCkApBKgSpEKRCkApBKgSpEKRCkApBKgSpEKRCkApBKgSpEKRCkApBKlzQh/7+9o3/WsDmYwvYfGwBn75+5fPzM5Nd0If++fGDR9nA5+dnJgs6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzBd0zGa+IBWCVAg6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzBd0zGa+IBWCVAg6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzBd0zGa+IBWCVAg6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzBd0zGa+IBWCVAg6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzBd0zGa+IBWCVAg6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzBd0zGa+IBWCVAg6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzBd0zGa+IBWCVAg6ZjFf0DGb+YKOWcwXdMxmviAVgo5ZzHfhwd6vV95eXtCv3n/+5O3lhUd5v155tAsPdr/duN9u6Ff311fur69MFqRCkApBKgSpEKRCkApBKgSpEKRCkApBKgSpEKRCkApBKgSpEKRCkApBKgSpEKRCkApBKvwLKw1EpVhhTq4AAAAASUVORK5CYII=`
const doc = new jsPDF("p",
# Log Oe Line command
alias.lol log --one-line
# log history
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
# get all alias
git config --global --get-regexp alias