Wednesday, November 2, 2011

Writing in Korean

Install ibus, ibus-m17n, ibus-hangul

Restart - I couldn't use ibus in Chrome or choose the Romaji keyboard option until restarting

Ctrl-Space to activate language. Change keyboard to Romaji for English keyboard.

Scim also has a Korean package but I couldn't get it to activate reliably.

Friday, August 19, 2011

Set linux date

Use this graphical tool to set the timezone:
sudo dpkg-reconfigure tzdata

Or set the time directly with:
sudo date MMDDhhmmYYYY

Sunday, July 31, 2011

Left hand mouse

One of the buttons on my laptop broke so to avoid that key I switched to using a left hand mouse:

xmodmap -pp
There are 12 pointer buttons defined:
    Physical        Button
     Button          Code
        1              1
        2              2
        3              3
        4              4
        5              5
        6              6
        7              7
        8              8
        9              9
       10             10
       11             11
       12             12
 xmodmap -e "pointer = 3 2 1 4 5 6 7 8 9 11 12 13"

Thursday, May 19, 2011

chrome user agent

Chrome doesn't seem to currently have a setting or extension to set the user-agent.

You can however define it with a command line argument:

  chromium-browser --user-agent="richard"

Sunday, May 1, 2011

Working with large CSV files

When working with large CSV files I sometimes get this:
Traceback (most recent call last):
  File "stats.py", line 12, in
    for i, row in enumerate(csv.reader(open(filename))):
_csv.Error: field larger than field limit (131072)

This means the CSV file contains more content between delimiters that allowed by default. To raise this limit use:

import sys
import csv
csv.field_size_limit(sys.maxint)

Thursday, March 17, 2011

Change keyboards

Change keyboard to DVORAK:
setxkbmap dvorak

And back to QWERTY again:
setxkbmap us

Friday, February 11, 2011

My vimrc

set encoding=utf8

set textwidth=0
set tabstop=4       " Number of spaces to expand tab (messy)
set softtabstop=4   " Number of spaces for insert for tab
set shiftwidth=4    " Number of spaces for << or >>
set expandtab

set ruler
set autoindent
set nocompatible        " use Vim defaults (much better!)
set bs=2                " allow backspacing over everything in insert mode
set ai                  " always set autoindenting on
set vb          " turn off bell
set guifont=Monospace\ 12   " determined with 'set gfn'
syntax on               " switch syntax highlighting on

" searching options
set nowrapscan
set ignorecase

" use ALT key to treat wrapped text as new line when traversing
map gj
map gk
imap gki
imap gji

" disable indentation for pasting with f2
nnoremap :set invpaste paste?
set pastetoggle=
set showmode

" for working with Windows line endings
autocmd BufReadPost * nested
      \ if !exists('b:reload_dos') && !&binary && &ff=='unix' && (0 < search('\r$', 'nc')) |
      \   let b:reload_dos = 1 |
      \   e ++ff=dos |
      \ endif



" Protect large files from sourcing and other overhead.
if !exists("my_auto_commands_loaded")
  let my_auto_commands_loaded = 1
  " Large files are > 10M
  " Set options:
  " eventignore+=FileType (no syntax highlighting etc
  " assumes FileType always on)
  " noswapfile (save copy of file)
  " bufhidden=unload (save memory when other file is viewed)
  " undolevels=-1 (no undo possible)
  let g:LargeFile = 1024 * 1024 * 10
  augroup LargeFile
    autocmd BufReadPre * let f=expand("") | if getfsize(f) > g:LargeFile | set eventignore+=FileType | setlocal noswapfile bufhidden=unload undolevels=-1 | else | set eventignore-=FileType | endif
    augroup END
  endif