2017年6月21日水曜日

python UnicodeEncodeError


 UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)
この手のエラー、
export PYTHONIOENCODING=utf-8
とやるとうまくいく場合がある模様。Python3で確認

2017年4月17日月曜日

vnc4server

linux のVNCサーバとしては標準的なvnc4server だとmacのOS組み込みのVNCビューアとなにか相性が悪いらしく、文字をタイプするとフリーズする。

tightvncserverをインストールしたら正常に動作するようになった。めでたい。

2017年4月3日月曜日

HammerSpoon

Officeの類でemacsバインドじゃないと編集がくるしい、ということで、これまでkarabiner にお世話になっていたのだが、Sierraでは使えない。Karabiner Elementという後継プロジェクトがあるのだが、こちらはまだマチュアではなく、単体キーの入換えしかできない。

ということで、こちらを参考に HammerSpoolなるものを入れてみた。luaで設定ファイルを書くというのがなんともアレだが。。とりあえず、カーソル移動と行頭行末、バックスペースだけなんとかした。これだけできれば発狂しないですむだろう。

local function keyCode(key, modifiers)
   modifiers = modifiers or {}
   return function()
      hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), true):post()
      hs.timer.usleep(1000)
      hs.eventtap.event.newKeyEvent(modifiers, string.lower(key), false):post()
   end
end

local function remapKey(modifiers, key, keyCode)
   hs.hotkey.bind(modifiers, key, keyCode, nil, keyCode)
end

remapKey({'ctrl'}, 'b', keyCode('left'))
remapKey({'ctrl'}, 'n', keyCode('down'))
remapKey({'ctrl'}, 'p', keyCode('up'))
remapKey({'ctrl'}, 'f', keyCode('right'))
remapKey({'ctrl'}, 'e', keyCode('end'))
remapKey({'ctrl'}, 'a', keyCode('home'))
remapKey({'ctrl'}, 'h', keyCode('delete'))

2017年2月28日火曜日

Ubuntuセットアップもろもろ

Ubuntu でCaps/ctrl 入れ替え
dconf reset /org/gnome/settings-daemon/plugins/keyboard/active
dconf write /org/gnome/desktop/input-sources/xkb-options "['ctrl:swapcaps']"
英語フォルダを置き換える。
LANG=C xdg-user-dirs-gtk-update
keybindをemacsに
sudo apt install gnome-tweak-tool
でgnome-tweak-toolをいれて設定

2017年2月23日木曜日

emacs epg

Gnupg 2がでてから毎度トラブっている。
前回は、gpg1 を入れて
 (custom-set-variables '(epg-gpg-program  "/usr/local/bin/gpg1"))
とすればOKだったのだが、今回はだめ。。
homebrew で入るのは2.0なのだけど、これではだめ、とのことなので、

brew tap homebrew/versions
brew install gnupg21
としてgnupg 2.1 を入れて、
(custom-set-variables '(epg-gpg-program  "/usr/local/bin/gpg2"))
(setf epa-pinentry-mode 'loopback)
とすると、なぜか /usr/local/bin/gpg がない、とかいうエラーがでる。
ので、/usr/local/bin で ln -s gpg2 gpg としてリンクを作ったらうまく動いた。
なんなんだ。

2017年2月19日日曜日

mac emacs 25.1

このページのとおり。

- https://oku.edu.mie-u.ac.jp/~okumura/macosx/

wget http://ftp.jaist.ac.jp/pub/GNU/emacs/emacs-25.1.tar.xz
wget ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-25.1-mac-6.0.tar.gz
tar xvzf emacs-25.1.tar.xz
tar xvzf emacs-25.1-mac-6.0.tar.gz
cd emacs-25.1
patch -p1 < ../emacs-25.1-mac-6.0/patch-mac
cp -R ../emacs-25.1-mac-6.0/mac .
cp ../emacs-25.1-mac-6.0/src/* src/
cp ../emacs-25.1-mac-6.0/lisp/term/mac-win.el lisp/term/
cp nextstep/Cocoa/Emacs.base/Contents/Resources/*.icns mac/Emacs.app/Contents/Resources/
./configure --without-x
make 
make install


cp -r mac/Emacs.apps /Applications

init.el で
(mac-auto-ascii-mode 1) 



2016年9月2日金曜日

windows10 safeboot 解除

メインメニュー(左下のウィンドウズマーク)→ 設定 → 更新とセキュリティ→回復 →PCの起動をカスタマイズ → トラブルシューティング → 詳細オプション → UEFIファームウェアの設定 → 再移動 → BOOT → Secure boot を disable