Skip to content

Instantly share code, notes, and snippets.

@piouc
piouc / convert-all-png-to-webp.sh
Created August 28, 2023 02:17
convert-all-png-to-webp.sh
find . -type f -name '*.png' -print0 | xargs -0 -n 1 bash -c 'cwebp "$0" -o "${0%.png}.webp"'
@piouc
piouc / getPosision.js
Created August 24, 2023 06:31
getPosision.js
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
}
@piouc
piouc / remove-outlook-ads.user.js
Last active October 4, 2022 05:44
remove-outlook-ads.user.js
// ==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')
@piouc
piouc / illust-ac-download-all-search-result.js
Last active February 18, 2022 07:36
illust-ac-download-all-search-result.js
(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)
@piouc
piouc / mirakuruntv.m3u8
Created January 11, 2022 11:05
mirakuruntv.m3u8
#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,地上波 - テレビ朝日
// ==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]+?)(?:[?\/].*|$)/
@piouc
piouc / nicovideo-fake-premium.user.js
Last active August 11, 2022 14:11
nicovideo fake premium
// ==UserScript==
// @name nicovideo fake premium
// @namespace https://piou.dev
// @include https://www.nicovideo.jp/watch/*
// @version 1.2.0
// @grant none
// @run-at document-start
// ==/UserScript==
const observer = new MutationObserver((mutations) => {
@piouc
piouc / google-keyboard-controls.user.js
Last active April 13, 2022 09:16
Google keyboard controls
// ==UserScript==
// @name Google keyboard controls
// @namespace https://piouc.dev
// @version 1.3.1
// @author piouc
// @description keyboard controls for Google search
// @downloadURL https://gist.github.com/piouc/466218c4bb6bd020260f866cce52e280/raw
// @include /^https?:\/\/www\.google\.(com|co\.jp)\/search/
// @run-at document-end
// @grant GM.openInTab
@piouc
piouc / to_portrait.xmp
Created September 17, 2020 23:58
camera raw profile
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/"
crs:Version="12.4"
crs:ProcessVersion="11.0"
crs:Saturation="0"
crs:Sharpness="67"
crs:LuminanceSmoothing="0"
crs:ColorNoiseReduction="0"
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs