Sunday, December 16, 2012

ZigBee does not have replay protection...

www.willhackforsushi.com/presentations/toorcon11-wright.pdf

Cisco router: default user name for ppp authentication

CHAP
By default, a cisco router uses its host name for username.
http://www.cisco.com/en/US/tech/tk713/tk507/technologies_tech_note09186a00800b4131.shtml#chapconfig

PAP
Have to specify user name for the authentication

Friday, December 14, 2012

Wireshark: key bindings for selecting packets


  • Ctrl-Up :  Selecting previous packet
  • Ctrl-Down :  Selecting next packet
  • Ctrl-, :  Selecting previous packet in conversation 
  • Ctrl-. :  Selecting next packet in conversation

Tuesday, December 11, 2012

Installing gcc on Mountain lion

Mountain lion does not include gcc, and the compiler comes with Xcode 4.3 is llvm, not gcc.

Installing HomeBrew
$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"


Installing gcc with c++ support (c and c++ supports are enough for me)
$ brew install --enable-cxx --use-llvm https://raw.github.com/Homebrew/homebrew-dupes/master/gcc.rb


Note: When installing HomeBrew, the installer changes permission for /usr/local/.
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/include /usr/local/lib

Reference:
https://github.com/mxcl/homebrew/wiki/FAQ#wiki-sudo
https://github.com/Homebrew/homebrew-dupes/blob/master/gcc.rb

Monday, December 10, 2012

Wireshark on Mac: Changing menu fonts

You can change a font for captured data from preferences, but it doesn't change the font for the application menu. To make the ugly unpleasant font acceptable, change "pre_gtkrc" file in "/Applications/Wireshark.app/Contents/Resources/themes/Clearlooks-Quicksilver-OSX/gtk-2.0/"

1. Change the font
#gtk-font-name="Lucida Grande 12"
gtk-font-name="Sans 10"

2. Change the menu sizes (buttons, etc.)
#gtk-icon-sizes = "gtk-menu=16,16:gtk-dialog=48,48:gtk-dnd=32,32:gtk-button=20,20:gtk-large-toolbar=24,24:gtk-small-toolbar=16,16:inkscape-decoration=12,12"
gtk-icon-sizes = "gtk-menu=14,14:gtk-dialog=24,24:gtk-dnd=32,32:gtk-button=14,14:gtk-large-toolbar=14,14:gtk-small-toolbar=10,10:inkscape-decoration=6,6"

3. Results


4. Notes
- Lucida Grande is the default system font for Mac, but it looks completely difference under X11.
- The environment is rMBP Mid 2012 running Mountain lion 10.8.2.
- The output is somewhat blurred since X11 cannot handle the retina display.

Sunday, December 9, 2012

Wireshark: Enabling capturing from a non-root user

Under Ubuntu 12.04
Unlike youtube video, logout was necessary to get interfaces to show up on the wireshark!

$ sudo apt-get update
$ sudo apt-get install wireshark

$ sudo groupadd wireshark
$ sudo usermod -a -G wireshark USER_NAME
$ sudo chgrp wireshark /usr/bin/dumpcap
$ sudo chmod 750 /usr/bin/dumpcap
$ sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap

Saturday, October 27, 2012

Tuesday, September 4, 2012

Arduino: the size of data types

int: -32,768 to 32,767(minimum value of -2^15 and a maximum value of (2^15) - 1)
unsigned int 0 to 65,535 ((2^16) - 1)
long: -2,147,483,648 to 2,147,483,647 (32bit)
float: 32bits
double: 32bits (The same as float)

Monday, August 27, 2012

Color scheme for vim (not for gvim)

I was always wondering why some color scheme does work on gvim (MacVim) but not on vim launched from terminal. That's the reason.

Using GUI color settings in a terminal
http://vim.wikia.com/wiki/Using_GUI_color_settings_in_a_terminal

Tuesday, August 21, 2012

Updated: After Installed Mountain Lion

  1. Changed trackpad settings to "NORMAL"
    1. Enabled tap and click
    2. Fixed scrolling direction
    3. Enabled click and drag
      1. System Preference -> Accessibility -> Mouse & Trackpad -> Trackpad Options
  2. Enabled key repeat 
    1. Issue "defaults write -g ApplePressAndHoldEnabled -bool false"
  3. Made user's library directory visible from finder
    1. Issue "chflags nohidden /Users/USERNAME/Library"
  4. Installed
    1. MacVim
      1. Installed "ocean deep" color scheme
      2. Syntax highlight for arduino
      3. Made .vimrc 
    2. TextWrangler
    3. Xcode
      1. Added "command line tools" component
        1. Preferences -> Downloads -> Components
    4. VMware Fusion
      1. Installed Ubuntu 12.04 Desktop 64bit
        1. Updated installed packages
          1. $ sudo apt-get update
          2. $ sudo apt-get upgrade
        2. Installed C compiler
          1. $ sudo apt-get install build-essential
        3. Installed Oracle JAVA 7
          1. $ sudp add-apt-repository ppa:webupd8team/java
          2. $ sudo apt-get update
          3. $ sudo apt-get install oracle-java7-installer
          4. $ java -version
            Ref: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
        4. Installed Netbeans
          1. Download package, and the run install script
            http://netbeans.org
        5. Installed Arduino programming environment
          1. $ sudo apt-get install arduino-core arduino 
      2. Installed Windows 7
        1. Windows Update - Required packages
        2. Windows Update - Recommended packages
          *CAUTION* VMware Fusion got freeze while patching
    5. Adobe Acrobat Pro 9.0
      1. Patched manually! There was no automatic update option on 9.0...
        After all the patches were done (Ver. 9.5.2) the Acrobat got "Check for update" option in "Help" menu.
    6. The unarchiver
    7. MplayerX
    8. Caffeine
    9. Reeder
    10. Microsoft Office
    11. iWorks
    12. ScanSnap Manager


Sunday, August 19, 2012

Vim: set path to working directory

Add the following to .vim


" Add the current file's directory to the path if not already present.
BufRead *
  \ let s:tempPath=escape(escape(expand("%:p:h"), ' '), '\ ') |
  \ exec "set path+=".s:tempPath

Ref: Set working directory to the current file

With previous make and javac binding, you can compile and execute Java code from vim with
  :mak
  :!java FILENAME

Saturday, August 18, 2012

Vim: Binding :make and javac

Add the following to your .vimrc

filetype on
autocmd FileType java set makeprg=javac\ %

You can make .java files with :make command.
To view errors, try ":cope", ":ccl", ":cc", ":cn", ":cp", etc.

Friday, August 17, 2012

Ubuntu 12.04: Font Install/Uninstall

Install with Terminal
1. Make .font directory in your home directory
    $ mkdir .font
2. Download and put font file or files in the .font directory (e.g. Monaco_Linux.ttff)
    $ mv Downloads/Monaco_Linux.ttf.font
3. Register the font
    $ sudo fc-cache -f -v
3. Confirm the install
    $ fc-list | grep Monaco

Install with GUI

Uninstall
1. Delete font file (e.g. Monaco.Linux.ttf)
    $ rm Monaco_Linux.ttf
2. Unregister the font
    $sudo fc-cache -f -v
3. Confirm the uninstall
    $ fc-list | grep Monaco

It's better not to install custom fonts to "/usr/share/fonts".

Thursday, August 16, 2012

Monday, August 13, 2012

Wednesday, July 11, 2012

VIM is able to edit a remote file.

$ vim ftp://SERVER_NAME//DIRECTORY_NAME/FILE/NAME

"//" is used between SERVER_NAME and DIRECTORY_NAME


Saturday, April 14, 2012

Arp cache aging time

Cisco routers
    4 hours
Cisco switches
    5 min
Windows Server 2003 and before
    2 min ( 10 min, if the address is reused )
Windows Vista and after
    Between 15 sec and 45 sec (random)
Linux box
    Various aging time

Switches are able to learn destination MAC addresses from client stations' arp request/query (because switches have longer aging time than client hosts). Those time differences keep them from flooding.

Refferences for Windows box
View the Address Resolution Protocol (ARP) cache
http://technet.microsoft.com/en-us/library/cc786759%28v=WS.10%29.aspx

Description of Address Resolution Protocol (ARP) caching behavior in Windows Vista TCP/IP implementations
http://support.microsoft.com/kb/949589



Tuesday, March 20, 2012

Change of .vimrc

Change log:
1) Added tab settings for html
2) Enabled filetype plugins
3) Enabled matchit

  1 "
  2 " This file (.vimrc) is modified on 2012/3/19
  3 "
  4
  5 " General
  6 set number " to display lines
  7 set title " display filename on the title bar
  8 set ignorecase " search not casesensitively
  9 set showmatch " hilight a pair of parenthesis and braces
 10 set matchtime=2 " limit the showmatch's hilight time, ms
 11 set wildmenu " compliment vim's commandline instructions
 12 set tabstop=4
 13 set shiftwidth=4
 14 set softtabstop=4
 15 set autoindent " Enable autoindent
 16 set ruler  " Ruler on
 17 set incsearch
 18 set hlsearch
 19 set backup
 20 set backupdir=~/.tmp_vim
 21 set dir=~/.tmp_vim
 22
 23 " Plugins
 24 filetype on           " Enable filetype detection
 25 filetype indent on    " Enable filetype-specific indenting
 26 filetype plugin on    " Enable filetype-specific plugins
 27 runtime macros/matchit.vim
 28
 29 " Ruby
 30 autocmd FileType ruby,eruby compiler ruby
 31 autocmd FileType ruby,eruby set tabstop=2
 32 autocmd FileType ruby,eruby set shiftwidth=2
 33 autocmd FileType ruby,eruby set softtabstop=2
 34 autocmd FileType ruby,eruby set expandtab
 35
 36 " HTML
 37 autocmd FileType html set tabstop=2
 38 autocmd FileType html set shiftwidth=2
 39 autocmd FileType html set softtabstop=2
 40
 41
 42 " For GUI
 43 if has("gui_running")
 44   colorscheme oceandeep
 45   set clipboard+=unnamed  " Yanks to clipboard
 46 endif
 47

Tuesday, February 28, 2012

Windows 7 Professional の 表示言語変更

手順:こちらの手順を参考 hinoji の Winodws 7 表示言語の変更の秘密

参考: Windows 7 SP1 Language Pack (English)
http://download.windowsupdate.com/msdownload/update/software/updt/2011/02/windows6.1-kb2483139-x64-en-us_9b9c8a867baff2920507fbf1e1b4a158572b9b87.exe

Saturday, January 21, 2012

Ruby 1.9.3 を Mac にインストール

ruby-1.9.3-p0 を Snow Leopard にインストールした際に、yaml.h が無いというエラーがでた。
yaml.h is missing. Please install libyaml. Failed to configure psych. It will not be installed.
LibYAML をインストールしてから ruby-1.9.3-p0 をインストールするとエラーを回避できる。
参考:http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/

LibYAML のインストール方法:
$ curl -O http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar xzvf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
 

Friday, January 20, 2012

Kindle for Mac がもっさり

Programming Language Ruby の Kindle 版が $10 以下と大変お値打ち価格だったので初めてKindle の本を購入してみた。Kindle for Mac で読んでいるのだけれど動きがもっさり。さらには、Kindle for Mac の検索がうまく動かないので、Kindle の本を PDF に変換してみた。

calibre
http://calibre-ebook.com/

設定を変えて何度かPDFに変換をしてみたが、ページレイアウトが崩れて残念な結果に。終わったとさ。

Wednesday, January 18, 2012

Key bind for Vim

In an insert mode,
  "C - [", "C - {" are bound to ESC
  "C - h" is bound to BS
  "C - m" is bound to Enter

.vimrc の見直し

今回の変更で set clipboard+=unnamed のオプションを追加

"
" This file (.vimrc) is modified on 2012/1/18
"
set number " to display lines
set title " display filename on the title bar
set ignorecase " search not casesensitively
set showmatch " hilight a pair of parenthesis and braces
set matchtime=2 " limit the showmatch's hilight time, ms
set wildmenu " compliment vim's commandline instructions
set softtabstop=4
set expandtab
set autoindent " Enable autoindent
set ruler  " Ruler on
if has("gui_running")
  colorscheme oceandeep
  set clipboard+=unnamed  " Yanks to clipboard
  autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
  autocmd FileType ruby,eruby set tabstop=2
  autocmd FileType ruby,eruby set shiftwidth=2
  autocmd FileType ruby,eruby set softtabstop=2
endif

Tuesday, January 3, 2012

黒豆の炊き方

  1. 沸騰したお湯に砂糖、塩、醤油(ごく少量)を入れる
    水は豆の3倍くらいの量
    調味料の量は汁が煮立つことを逆算して薄め
    味の強さは最後に調整できるので薄めに(とにかく薄め)
  2. 洗った黒豆をお鍋に入れ一晩寝かせる
  3. 弱火で豆を煮る
  4. 好みの固さになったところで調味料を足し、味の調整をする
  5. 好みの固さより心持ち柔らかくなったところで火から下ろす
    冷えると若干固くなる
  6. 常温に戻ったところで完成
火から下ろしたところで、細長く切った昆布を入れても美味しい

Monday, January 2, 2012

小豆の炊き方

  1. 小豆を洗い、水をはった鍋にあける
  2. 鍋を中火に掛け、沸騰させる
  3. お湯に小豆の色が出るまで煮続ける
    (10分くらい)
  4. 色の着いたお湯を捨て、鍋に再度水を入れる
    (水は豆の2〜3倍くらい)
  5. 鍋を中火に掛け、沸騰したところで ふつふつ いう程度に火を弱める
  6. 1時間〜1時間半程度火にかける
    (鍋からお湯が無くならないように注意、豆が水を吸う)
  7. お豆の表面が割れてきたところで砂糖、塩を加えて火から下ろす
    砂糖の分量はお豆の重量の半分が目安(薄味)
    3/4の砂糖を分量を入れてから徐々に調整
  8. 一晩置き、豆に味を含める
  9. お豆を再度火にかけ、煮立ったところで味の最終調整
注意:
小豆を炊いている途中、小豆の嵩が2倍以上になることに注意。
炊けば炊くほど豆が煮崩れ、量が少なくなっていく。

おいしく炊けたの図: