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 waitForLoad = fn => { | |
if(document.readyState === 'loading'){ | |
document.addEventListener('DOMContentLoaded', fn) | |
} else { | |
fn() | |
} | |
} |
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
(() => { | |
let points = [] | |
const handleClick = (event) => { | |
const section = event.target.closest('section') | |
if (!section) return | |
const rect = section.getBoundingClientRect() | |
const sectionWidth = rect.width | |
const x = (event.clientX - rect.left) / sectionWidth * 100 |
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
find . -type f \( -iname "*.jpg" -o -iname "*.png" \) -exec sh -c 'cwebp -q 75 "$0" -o "${0%.*}.webp"' {} \; |
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 { writeFile } = require('fs') | |
const fsp = require('fs/promises') | |
const { parse } = require('path') | |
;(async () => { | |
const files = await fsp.readdir('./', {recursive: true}) | |
for(const file of files){ | |
if(['.js', '.json', '.css', '.liquid', '.html'].includes(parse(file).ext)){ | |
const data = await fsp.readFile(file, 'utf8') | |
const replaced = data.replace(/(\d+(\.\d+)?|\.?\d+|0)rem/g, match => { |
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
find . -type f -name '*.png' -print0 | xargs -0 -n 1 bash -c 'cwebp "$0" -o "${0%.png}.webp"' |
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
let point = null | |
window.addEventListener('mousedown', e => { | |
if(point){ | |
console.log(`x="${point.x / window.innerWidth * 100}vw" y="${point.y / window.innerWidth * 100}vw" width="${(e.clientX + window.scrollX - point.x) / window.innerWidth * 100}vw" height="${(e.clientY + window.scrollY - point.y) / window.innerWidth * 100}vw"`) | |
point = null | |
} else { | |
point = { | |
x: e.clientX + window.scrollX, | |
y: e.clientY + window.scrollY | |
} |
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
// ==UserScript== | |
// @name Remove outlook ads | |
// @include https://outlook.live.com/mail/* | |
// @version 1.0.2 | |
// @updateURL https://gist.githubusercontent.com/piouc/053352df3e29357240d767a51b0e2e6b/raw/remove-outlook-ads.user.js | |
// @downloadURL https://gist.githubusercontent.com/piouc/053352df3e29357240d767a51b0e2e6b/raw/remove-outlook-ads.user.js | |
// @grant none | |
// ==/UserScript== | |
const style = document.createElement('style') |
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
(async (from) => { | |
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) | |
const modalLinks = Array.from(document.querySelectorAll('a.link-to-detail')) | |
const fromIndex = modalLinks.findIndex(a => a.dataset.id === from.toString()) ?? 0 | |
for(const a of modalLinks.slice(fromIndex)){ | |
const id = a.dataset.id | |
a.click() | |
let link | |
while(!link){ | |
await wait(250) |
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
#EXTM3U | |
#EXTVLCOPT:network-caching=1000 | |
#EXTINF:-1,地上波 - NHK総合 | |
http://ubuntu.lan:40772/api/channels/GR/27/services/1024/stream/ | |
#EXTINF:-1,地上波 - NHK Eテレ | |
http://ubuntu.lan:40772/api/channels/GR/26/services/1032/stream/ | |
#EXTINF:-1,地上波 - 日本テレビ | |
http://ubuntu.lan:40772/api/channels/GR/25/services/1040/stream/ | |
#EXTINF:-1,地上波 - テレビ朝日 |
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
// ==UserScript== | |
// @name Amazon URL normalizer | |
// @namespace https://piou.dev | |
// @include https://www.amazon.co.jp/* | |
// @version 1 | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
const regex = /^https:\/\/www.amazon.co.jp\/(?:.+\/)?(?:dp|gp\/product)\/([a-zA-Z0-9]+?)(?:[?\/].*|$)/ |
NewerOlder