This file contains hidden or 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
if (chrome.tabs) { | |
console.log("[XXXCUT] Background Script Loaded"); | |
const screen = async () => { | |
console.log("here", chrome.tabs); | |
const capture = chrome.tabs.captureVisibleTab({ format: "png" }, (data) => { | |
console.log(data); | |
}); | |
console.log(1, capture); | |
}; | |
chrome.runtime.onMessage.addListener(screen); |
This file contains hidden or 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
import asyncio | |
import http.server | |
import http.client | |
class LogHTTPHandler(http.server.SimpleHTTPRequestHandler): | |
log_file = open('access.log', 'w', 1) | |
def log_message(self, format, *args): | |
self.log_file.write( | |
f"{self.client_address[0]} - - [{self.log_date_time_string()}] {format % args}\n" |
This file contains hidden or 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
var slogans = [ | |
'Don\'t worry, if you can\'t cop.. nobody can.', | |
'Don\'t worry, the fire ain\'t going anywhere.', | |
'Someone uploaded something too fire.', | |
'Rick Owens sent us a care package.', | |
'Yeezy stopped by the office.', | |
'Pray you don\'t brick your next fit.', | |
'Not that your most swagless homie cares or anything.', | |
'Please don\'t screenshot this and tag us.', | |
'No, you can\'t come hang out at the office.', |
This file contains hidden or 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 fetchBuffer = (url) => fetch(url).then((r) => r.arrayBuffer()); | |
export default async (ctx, obj) => { | |
const db = await new Promise((r) => { | |
const req = indexedDB.open("assets", 1); | |
req.addEventListener("upgradeneeded", (e) => { | |
const db = e.target.result; | |
db.createObjectStore("audiobuffers"); | |
r(db); | |
}); |
This file contains hidden or 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 createScheduler = (ctx, state) => { | |
const callbacks = new Set(); | |
const id = setInterval(() => { | |
const scheduleAheadTime = 0.1; | |
while (state.time < ctx.currentTime + scheduleAheadTime) { | |
callbacks.forEach((callback) => callback(state.beat, state.time)); | |
state.beat += 1; | |
state.time += 60.0 / state.bpm; | |
} | |
}, 25); |
This file contains hidden or 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
# https://aaron.cc/ffmpeg-hevc-apple-devices/ | |
ffmpeg -i input.avi -c:v libx265 -crf 28 -c:a aac -b:a 128k -tag:v hvc1 output.mp4 |
This file contains hidden or 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
export const TextSequence = ({ | |
texts = ["ceci", 1000, "est", 1000, "une", 1000, "demo", 1000], | |
}) => { | |
const [text, setText] = useState(); | |
useEffect(() => { | |
setTimeout(function update(i = 0) { | |
const data = texts[i % texts.length]; | |
if (typeof data === "string") setText(data); | |
setTimeout(() => update(i + 1), typeof data === "number" ? data : 0); | |
}); |
This file contains hidden or 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
<link rel="stylesheet" href="https://unpkg.com/latex.css/style.min.css" /> | |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> | |
<style> | |
body > * { | |
height: 100%; | |
outline: none; | |
border: none; | |
} | |
.hidden { | |
visibility: hidden; /* display: none; remove history of textarea */ |
This file contains hidden or 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
import React, { useEffect } from "react"; | |
import { useGunState, useGunSetState } from "./utils/gun-hooks.js"; | |
const session = new Date().toISOString(); | |
const gun = window.Gun({ peers: ["http://127.0.0.1:8765/gun"] }).get(100 * 1); | |
export default () => { | |
const [set, setSet] = useGunSetState(gun); | |
const [lock, setLock] = useGunState(gun.get("locked")); | |
const add = () => setSet("hello" + Math.random()); |
This file contains hidden or 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
export const setCaretNode = (node, index) => { | |
if (node.lastChild) | |
window | |
.getSelection() | |
.collapse( | |
node.lastChild, | |
index > 0 ? index : node.lastChild.textContent.length + index + 1 | |
); | |
}; |