YUKI "Piro" Hiroshi piroor
-
ClearCode Inc. http://www.clear-code.com/
- Tokyo, Japan
- Sign in to view email
- https://piro.sakura.ne.jp/
View SelectionClipboard.ahk
; 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 |
View aes-gcm-encryption.js
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'] | |
); |
View array-uniq-benchmark.js
// License: MIT | |
// Original Author: YUKI "Piro" Hiroshi <yuki@clear-code.com> | |
// confirmed at Firefox 64 | |
async function test(times, length) { | |
function uniqByIndexOf(array) { | |
const uniquedArray = []; | |
for (const elem of array) { | |
if (uniquedArray.indexOf(elem) < 0) |
View prepare.js
/* | |
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; |
View enctyptor.js
/* | |
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 }); |
View peco-commands.sh
# 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" |
View autoconfig.cfg
// the first line is always ignored by Firefox. | |
const autoAcceptExceptionFor = (host, port = 443) => { | |
const { classes: Cc, interfaces: Ci, utils: Cu } = Components; | |
const exceptionURL = port == 443 ? `https://${host}` : `https://${host}:${port}`; | |
const { Services } = Cu.import('resource://gre/modules/Services.jsm', {}); | |
const observer = { | |
observe(aSubject, aTopic, aData) { | |
switch (aTopic) { |
View autoconfig.cfg
// the first line is always ignored by Firefox. | |
const autoAcceptExceptionFor = (host, port = 443) => { | |
const { classes: Cc, interfaces: Ci, utils: Cu } = Components; | |
const exceptionURL = port == 443 ? `https://${host}` : `https://${host}:${port}`; | |
const { Services } = Cu.import('resource://gre/modules/Services.jsm', {}); | |
const observer = { | |
observe(aSubject, aTopic, aData) { | |
switch (aTopic) { |
View toc.js
// How to use: | |
// 1. Go to a page of GitHub Wiki with Firefox. | |
// 2. Copy this script to the clipboard. | |
// 3. Hit Ctrl-Shift-K to open Web Console. | |
// 4. Hit Ctrl-Shift-V to paste this script. | |
// 5. Hit Enter to run script. | |
// 6. If you are not in edit mode, click the "Copy ToC" button shown in the page. | |
// Then ToC is copied to the clipboard, so paste the TOC from the clipboard. | |
var container = document.querySelector('.markdown-body'); |
View get-ie-path.go
package main | |
import ( | |
"fmt" | |
"golang.org/x/sys/windows/registry" | |
) | |
func main() { | |
fmt.Printf(GetIEPath()) | |
} |
NewerOlder