Linux Administration for Nerds

Copyright 2018 Brian Davis - CC-BY-NC-SA

Apps

My work is mainly coding, spreadsheets and writing. Since most of my work is very keyboard intensive I try to minimize the times when I need to use the mouse. Vim is a old (some might say ancient) text editor that is surprisingly popular among developers. Often compared to emacs, I chose vim mainly because it's what I learned first back when I was managing solaris servers and working in automated test.

Because I prefer the keyboard much of work ends up being done in a terminal.
One light weight and highly configurable terminal program is urxvt. You configure it with a file called ~/.Xresources.

! terminal settings
URxvt*.font:    xft:Monospace:pixelsize=16
URxvt*.boldFont: xft:Monospace:pixelsize=16
URxvt*.letterSpace: -1

URxvt*.transparent: true
URxvt*shading: 95

URxvt*.scrollstyle: plain


#define grey00 #151515
#define grey01 #202020
#define grey02 #303030
#define grey03 #505050
#define grey04 #b0b0b0
#define grey05 #d0d0d0
#define grey06 #e0e0e0
#define grey07 #f5f5f5

#define Red     #cc0000
#define lRed    #ff4444
#define Yellow  #cc9900
#define lYellow #ffffcc
#define Green   #009900
#define lGreen  #ccffcc
#define Cyan    #00aa88
#define lCyan   #ccffff
#define Blue    #1133ff
#define lBlue   #99ccff
#define Magenta #6316af
#define lMagenta #cc99ff

*.foreground:   grey01
*.background:   grey05
*.cursorColor:  grey06

! black
*.color0:       grey00
! red
*.color1:       Red
! green
*.color2:       Green
! yellow
*.color3:       Yellow
! blue
*.color4:       Blue
! magenta
*.color5:       Magenta
! cyan
*.color6:       Cyan
! light grey
*.color7:       grey04
! dark grey
*.color8:       grey01
! bright red
*.color9:       lRed
! bright green
*.color10:      lGreen
! bright yellow
*.color11:      lYellow
! bright blue
*.color12:      lBlue
! bright magenta
*.color13:      lMagenta
! bright cyan
*.color14:      lCyan
! white
*.color15:      grey07

I have used a couple variations on that to change the color scheme but the overall format makes it very easy to change stuff.

.dircolors is a file that changes the colors used for ls --color. Create it with

dircolors -p > ~/.dircolors

Vim

I can't offer a lot of guidance with configuring vim. I've found it's documentation to be somewhat opaque. :-( But here is my config. I tend to steer clear of plugins because they don't seem to always play nice together.

" window title
set title
" misc settings
set showmode
set wrap
set linebreak
" make hidden buffers visible
set hidden

" indentation
set tabstop=4
set shiftwidth=4
set expandtab

" fix up/down
:map <Up> gk
:map <Down> gj

" for switching buffers
map <f3> :bp<cr>
map <f4> :bn<cr>

" highlighting
filetype indent on
filetype plugin on
syntax enable

" Color scheme
set t_Co=256
color simple_light
"set cursorline

set textwidth=80

func! CodeMode()
    " Line numbers
    set number
    " PLUGINS
    set formatoptions=cql
    set ruler
    set foldcolumn=0
    setlocal nospell
endfu


func! ProseMode()
    set formatoptions=aw2tq
    set foldcolumn=12
    set nonumber
    setlocal spell spelllang=en_us
    nnoremap \s eas<C-X><C-S>
endfu

com! Prose call ProseMode()
com! Code call CodeMode()

call CodeMode() " default mode

" automagically remove trailing whitespace
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
" add yaml file types
au BufNewFile,BufRead *.yaml,*.yml    setf yaml

let python_version_2=1
let python_highlight_all = 1
let python_highlight_indent_errors=0
let python_highlight_space_errors=0
let python_slow_sync=1

" setup cursor
if &term =~ "xterm\\|rxvt"
  " use an cursor in insert mode
  let &t_SI = "\<Esc>]12;black\x7"
  " use a cursor otherwise
  let &t_EI = "\<Esc>]12;darkgray\x7"
  silent !echo -ne "\033]12;darkgray\007"
  " reset cursor when vim exits
  autocmd VimLeave * silent !echo -ne "\033]112\007"
  " use \003]12;gray\007 for gnome-terminal
  "
  " solid underscore
  let &t_SI .= "\<Esc>[4 q"
  " solid block
  let &t_EI .= "\<Esc>[2 q"
  " 1 or 0 -> blinking block
  " 3 -> blinking underscore
  " Recent versions of xterm (282 or above) also support
  " 5 -> blinking vertical bar
  " 6 -> solid vertical bar
endif

VIM Cheat Sheet

Chrome

I used to use Chrome quite a bit. Probably the biggest reason it that it just works. Other browsers are lighter weight, more free as in liberty, or what have you. But comes with support for flash and HTML 5 all built into one neat .deb package you download from google's website. Ever after automagically updating itself. Syncs you bookmarks and plugins without any setup. That's hard to beat.

I did run an aptitude upgrade the other day and after that flash was turned off in Chrome. I don't know why. go to chrome://plugins to re-enable it.

I use a couple extensions in Chrome. Lastpass for password management. Ad-block plus is kind of a default for blocking advertisements these days, sadly. And finally Vrome gives me keyboard control.

Firefox

As of firefox 60 or so I've found it to be as reliable and fast as Chrome for most of what I like to do and since I prefer an open source tool to Google backed Chrome I've been using it for my daily browser on my home computers. The only downside I've found so far is gmail is much slower than in Chrome. Coincidence? I think not.

Qutebrowser

Qutebrowser is my recent find. It's written in python, uses Qt5, is released under the GPL and is designed around a VIM-like modal interface. Neato! I haven't dug into plugins for getting flash or HTML5 to work with it but for simple sites, it's been great.