Bookmarklet to fill forms matched to a regex
We can not use a regex in getElementsByXXX("/^like this*/").
So we have to get superset of what we need and then evaluate each element whether its name (or tagname or something) matches to the regex.
Example
<form> <input type="text" name="target0" value="target0" /> <input type="text" name="target1" value="target1" /> <input type="text" name="dummy0" value="dummy0" /> <input type="text" name="target2" value="target2" /> <input type="text" name="target3" value="target3" /> <input type="text" name="dummy1" value="dummy1" /> </form> <button id="changebtn">change</button> <script> document.getElementById("changebtn").onclick = function(){ var es = document.getElementsByTagName("input"); for( var i=0; i<es.length; i++ ){ var e = es[i]; if( e.name.match(/^target.*/) ) { e.value = "changed!"; /*somehow necessary for scriptlet on my environment*/ console.log(); } } } </script>
How to register the script as a bookmarklet
- Show bookmark-toolbar (Ctrl-Shift-b)
- Rclick -> Add page...
- URL : javascript:{ [PASTE THE SCRIPT IN A LINE] }
How to create .mobi after scanning images
Requirements
- convert # by imagemagic
- pdftk
- ebook-convert # by calibre
Convert each image into pdf
for file in `ls *.jpg`; do convert $file ${file%jpg}pdf; done;
Integrate the pdfs
pdftk *.pdf cat output integ.pdf
Convert pdf to mobi
ebook-convert integ.pdf .mobi
UbuntuでBluetoothオーディオレシーバのペアリングが成功するのにsound設定で認識されない事案の対処
環境
Ubuntuは13.10(64)。
オーディオレシーバはこいつ。
GREEN HOUSE Bluetoothオーディオレシーバー クリップ付 ブラック GH-BHARCK
- 出版社/メーカー: グリーンハウス
- 発売日: 2011/12/29
- メディア: エレクトロニクス
- この商品を含むブログを見る
対処
bluetooth - How can I get the A2DP output option and the input working again? - Ask Ubuntu によると、
Loading the bluetooth discovery module manually fixes the problem
らしい。ペアリングしたら自動でやってくんないのか...
pactl load-module module-bluetooth-discover
※要管理者権限
module-bluetooth-discoverをリ(?)ロードすると認識される。
pactlとは
PulseAudioサーバのコントローラらしい。
manいわく
load-module NAME [ARGUMENTS ...]
Load the specified module with the specified arguments into the running sound server. Prints the numeric index of the module just loaded to STDOUT. You can use it to unload the module later.
最後に
人間界からすべてのケーブルが消えますように。
トグる2
クリックでtdの表示をトグる
<div id="slide-toggle-sample1"> <table> <tr > <td> <div id="trigger">Click me to show msg</div> <div id="message" style="display:none" >Can you see me?</div> </td> </tr> </table> <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> <script> $(function(){ $("#trigger").click( function() { $("#trigger").hide(100); $("#message").show(200); }); }); $(function(){ $("#message").click( function() { $("#message").hide(100); $("#trigger").show(200); }); }); </script> </div>
Click me to show msg |
うにょってなる。
How to remap CapsLock to Ctrl or swap them.
(Tried and successful on Ubuntu 13.10)
[1/2] Edit option in a configuration file.
Edit XKBOPTIONS in the file /etc/default/keyboard.
SU permission will be required.
To remap CAPS to CTRL, add the following option.
ctrl:nocaps
e.g. XKBOPTIONS="ctrl:nocaps"
To swap CAPS and CTRL, add the following.
ctrl:swapcaps
e.g. XKBOPTIONS="ctrl:swapcaps"
[2/2] Apply the configuration.
Run this command with SU permission
dpkg-reconfigure keyboard-configuration
and follow the guidance.
Ubuntu 13.10にAnthy日本語入力を導入する
if( 英語版OS && 日本語入力がしたい )
参考文献どおりでOK。
- 全角スペース→半角スペース化しても、Shift-Space(insert_alternate_space)で全角スペースを入れれて便利。
- その他キーバインドを変更した方がいいかも。circle_inputって何だ。