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
| # Usage: | |
| # 1. Download latest binary of peco from: https://github.com/peco/peco/releases | |
| # 2. Extract "peco" from the downloaded archive and put it to somewhere listed in $PATH. | |
| # 3. Put this file as "~/peco-commands.sh". | |
| # 4. Add a line "source ~/peco-commands.sh". | |
| # 5. Exit and login again. | |
| # from http://bio-eco-evo.hatenablog.com/entry/2017/04/30/044703 | |
| peco-cd() { | |
| local sw="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
| /* | |
| Simple String Encryptor with common key cryptosystem (example) | |
| Usage: | |
| // The first argument of the constructor is the algorithm. | |
| // If you don't specify any algorithm, AES-CTR 256bit is used. | |
| const encryptor = new Encryptor({ name: 'AES-CTR', length: 256 }); | |
| const counter = crypto.getRandomValues(new Uint8Array(16)); | |
| const encrypted = await encryptor.encryptString('Hello world!', { counter }); |
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
| /* | |
| Usage: | |
| 1. Install something addon with "tabs" permission. | |
| 2. Go to "about:debugging" and open a debugger for the addon. | |
| 3. Go to the console. | |
| 4. Run. | |
| */ | |
| (async (global) => { | |
| const windowId = (await browser.windows.create({})).id; |
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
| // License: MIT | |
| // Original Author: YUKI "Piro" Hiroshi <[email protected]> | |
| // confirmed at Firefox 64 | |
| async function test(times, length) { | |
| function uniqByIndexOf(array) { | |
| const uniquedArray = []; | |
| for (const elem of array) { | |
| if (uniquedArray.indexOf(elem) < 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
| async function getKey(passphrase, salt = null) { | |
| passphrase = (new TextEncoder()).encode(passphrase); | |
| let digest = await crypto.subtle.digest({ name: 'SHA-256' }, passphrase); | |
| let keyMaterial = await crypto.subtle.importKey( | |
| 'raw', | |
| digest, | |
| { name: 'PBKDF2' }, | |
| false, | |
| ['deriveKey'] | |
| ); |
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
| ; Simulate "Selection Cipboard" of Linux desktop environments | |
| ; Based on: | |
| ; https://softwarerecs.stackexchange.com/questions/9791/copy-selection-to-clipboard-automatically | |
| ; Usage: | |
| ; 1. Install AutoHotKey: https://www.autohotkey.com/ | |
| ; 2. Save this file as "SelectionClipboard.ahk". | |
| ; 3. Put it into the startup folder. | |
| ; Note: | |
| ; * Ctrl-C will be sent when you do drag and drop with the left button always, including | |
| ; window moving and resizing. This means that SIGINT is sent to appls when you try to |
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
| // Run this script with the web console for contributors list pages on your Web browser, for example: | |
| // https://github.com/antirez/redis/graphs/contributors | |
| // https://github.com/mongodb/mongo/graphs/contributors | |
| // https://github.com/apache/kafka/graphs/contributors | |
| (async () => { | |
| let promises = []; | |
| for (const url of Array.from(new Set(Array.from(document.querySelectorAll('a[href][data-hovercard-type="user"]'), link => link.href)))) { | |
| const win = window.open(url); | |
| promises.push(new Promise(resolve => { | |
| win.addEventListener('DOMContentLoaded', () => { |
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
| // To view the default settings, hold "alt" while clicking on the "Settings" button. | |
| // For documentation on these settings, see: https://aka.ms/terminal-documentation | |
| { | |
| "$schema": "https://aka.ms/terminal-profiles-schema", | |
| "defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}", | |
| //"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", |
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
| // Run this in the console of the web browser | |
| (function generateToC() { | |
| const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6'); | |
| if (headings.length == 0) | |
| return; | |
| let minLevel = 6; | |
| for (let heading of headings) { | |
| let headingLevel = parseInt(heading.localName.charAt(1)); | |
| if (headingLevel < minLevel) | |
| minLevel = headingLevel; |
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
| <html> | |
| <head> | |
| <title></title> | |
| <style type="text/css"> | |
| :root, body { | |
| color-scheme: light dark; | |
| font: message-box; /* this is same to Firefox's UI. */ | |
| line-height: 1; | |
| } | |
| ul, li { |