graph TD;
subgraph 結果
R0[何もなし]
R1[強化値ダウン]
R2[銀剥がし]
R3[メッキ印消し]
R4[印消し]
end
This file contains 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 toCodeUnit = s => s.split("").map(u => `\\u${u.charCodeAt(0).toString(16).toUpperCase().padStart(4, 0)}`).join("") | |
const toCodePoint = s => [...s].map(p => `\\u{${p.codePointAt(0).toString(16).toUpperCase()}}`).join("") | |
const splitToVisualChars = s => [...s].reduce((c, p, i, a) => { | |
let description = p | |
if (p == "\u200D") { | |
// ZERO WITH JOINER | |
description = "ZWJ" | |
} else if ("\u{180B}" <= p && p <= "\u{180D}") { | |
// モンゴル文字専用のモンゴル自由字形選択子(3個) | |
description = `FVS${p.codePointAt(0) - 0x180B + 1}` |
This file contains 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
#!/usr/bin/env bash | |
sudo yum groups install -y Development\ tools | |
sudo yum install -y cmake | |
sudo yum install -y python34-{devel,pip} | |
sudo pip-3.4 install neovim --upgrade | |
( | |
cd "$(mktemp -d)" | |
git clone https://github.com/neovim/neovim.git | |
cd neovim | |
make CMAKE_BUILD_TYPE=Release |
This file contains 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 binconv = (()=>{ | |
// base64 <-> binary | |
const atob = window.atob | |
const btoa = window.btoa | |
// binary <-> Uint8Array | |
const btou8 = b => new Uint8Array([].map.call(b,c=>c.charCodeAt(0))) //new Uint8Array([...b].map(c=>c.charCodeAt(0))) | |
const u8tob = u8 => String.fromCharCode.apply(null,u8) //String.fromCharCode(...u8) | |
// string <-> Uint8Array |
This file contains 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
# ローカルで発生したメールを全部SESにリレーして送信する | |
sender_canonical_maps=regexp:/etc/postfix/sender_canonical_maps.regexp | |
sender_dependent_relayhost_maps=hash:/etc/postfix/sender_dependent_relayhost_maps regexp:/etc/postfix/sender_dependent_relayhost_maps.regexp | |
smtp_sasl_auth_enable=yes | |
smtp_sasl_password_maps=hash:/etc/postfix/smtp_sasl_password_maps regexp:/etc/postfix/smtp_sasl_password_maps.regexp | |
smtp_sasl_security_options=noanonymous | |
smtp_sender_dependent_authentication=yes |
This file contains 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
#!/bin/bash | |
# Qiita記事 https://qiita.com/kawaz/items/0593163c1c5538a34f6f | |
set -e | |
set -o pipefail | |
# pam_tidの存在チェック(間違えてLinux環境などで実行されたら中断する) | |
[[ -f /usr/lib/pam/pam_tid.so.2 ]] || exit 1 | |
[[ "${OSTYPE:0:6}" == "darwin" ]] || exit 1 | |
# /etc/pam.d/sudo の修正 |
This file contains 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 movingAverageFilter = (ws=3) => { | |
if(!Number.isInteger(ws) || ws < 1) { | |
throw new Error(`Invalid window size. ws must be >=1. You entered: ws=${ws}.`) | |
} | |
let win = [] | |
let sum = 0 | |
let pos = 0 | |
let tail = 0 | |
return (head) => { | |
sum = sum + head - tail |
This file contains 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
// React等が利用されているサイトでは value プロパティに値をセットしてもWEBアプリに変更が伝わらないことがあるが、それを上手くやる。 | |
const setValue = (target, value, immediate=false) => { | |
const f = ()=>{ | |
// valueプロパティがフレームワーク側で差し替えられてるケースの対応として、ネイティブパーツのsetterを直接使って値を書き換えるのが確実 | |
const valueDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(target), "value") | |
if(valueDescriptor && valueDescriptor.set) { | |
valueDescriptor.set.call(target, value) | |
} else { | |
target.value = value | |
} |
This file contains 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 superInterval = (cb, interval=1000, ...args) => { | |
try { | |
const code = `self.addEventListener('message', msg=>{setInterval(()=>self.postMessage(null), msg.data)})` | |
const w = new Worker(`data:text/javascript;base64,${btoa(code)}`) | |
w.onmessage = () => cb(...args) | |
w.postMessage(interval) | |
return {stop:()=>w.terminate()} | |
} catch(_){ | |
// 実装の問題またはCSPによる拒否などで Worker が使えなければ普通の setInterval を使う | |
const id = setInterval(cb, interval, ...args) |
This file contains 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
#!/bin/bash | |
# コピペで使えてシンプルなやつ (動的なファイルディスクリプタ) | |
# 2重起動防止 | |
exec {lock}<"$0"; flock -n "$lock" || { | |
echo "this script is already running" >&2 | |
exit 1 | |
} | |
echo "なにかの処理" |
NewerOlder