2012
08.02

my zshrc

so after many years of using sh & bash i have decided to give zsh a try and after using it for a couple of weeks i cant go back.

so here is my zshrc @ github for people to use.

in detail (at time of writing this was my current zshrc):

#### interactive shell check #### {                                                                                                                                                                                                                                                                                                           
if [[ $- != *i* ]] ; then                                                                                                                                                                                                                                                                                                                     
    return                                                                                                                                                                                                                                                                                                                                    
fi                                                                                                                                                                                                                                                                                                                                            
#### end interactive check #### }                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                              
#### exports #### {                                                                                                                                                                                                                                                                                                                           
export LANG=en_US.UTF-8                                                                                                                                                                                                                                                                                                                       
export LC_ALL=en_US.UTF-8                                                                                                                                                                                                                                                                                                                     
export TERM=screen-256color                                                                                                                                                                                                                                                                                                                   
#### end exports #### }                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                              
#### zsh key bindings #### {                                                                                                                                                                                                                                                                                                                  
bindkey '^A' beginning-of-line          # ctrl-a beginning of line binding                                                                                                                                                                                                                                                                    
bindkey '^E' end-of-line                # ctrl-e end of line binding                                                                                                                                                                                                                                                                          
bindkey '^R' history-incremental-search-backward        # ctrl-r history incremental search backwards                                                                                                                                                                                                                                         
bindkey '^[[2~' overwrite-mode          # insert key overwrite mode                                                                                                                                                                                                                                                                           
bindkey '^[[3~' delete-char             # delete key fix                                                                                                                                                                                                                                                                                      
bindkey '^[[7~' beginning-of-line       # home key                                                                                                                                                                                                                                                                                            
bindkey '^[[8~' end-of-line             # end key                                                                                                                                                                                                                                                                                             
bindkey -v                                                                                                                                                                                                                                                                                                                                    
#### end zsh key bindings #### }                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                              
#### zsh history #### {                                                                                                                                                                                                                                                                                                                       
HISTFILE=$HOME/.zsh_history                                                                                                                                                                                                                                                                                                                   
HISTSIZE=10000                                                                                                                                                                                                                                                                                                                                
SAVEHIST=10000                                                                                                                                                                                                                                                                                                                                
setopt APPEND_HISTORY           # append rather than overwrite history file.                                                                                                                                                                                                                                                                  
setopt EXTENDED_HISTORY         # save timestamp and runtime information                                                                                                                                                                                                                                                                      
setopt HIST_EXPIRE_DUPS_FIRST   # allow dups, but expire old ones when I hit HISTSIZE                                                                                                                                                                                                                                                         
setopt HIST_FIND_NO_DUPS        # don't find duplicates in history                                                                                                                                                                                                                                                                            
setopt HIST_IGNORE_ALL_DUPS     # ignore duplicate commands regardless of commands in between                                                                                                                                                                                                                                                 
setopt HIST_IGNORE_DUPS         # ignore duplicate commands                                                                                                                                                                                                                                                                                   
setopt HIST_REDUCE_BLANKS       # leave blanks out                                                                                                                                                                                                                                                                                            
setopt HIST_SAVE_NO_DUPS        # don't save duplicates                                                                                                                                                                                                                                                                                       
setopt INC_APPEND_HISTORY       # write after each command                                                                                                                                                                                                                                                                                    
setopt SHARE_HISTORY            # share history between sessions                                                                                                                                                                                                                                                                              
#### end zsh history #### }                                                                                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                                                                              
#### ls colors zsh #### {                                                                                                                                                                                                                                                                                                                     
if [[ -x "`whence -p dircolors`" ]]; then                                                                                                                                                                                                                                                                                                     
      eval `dircolors`                                                                                                                                                                                                                                                                                                                        
        alias ls='ls -F --color=auto'                                                                                                                                                                                                                                                                                                         
    else                                                                                                                                                                                                                                                                                                                                      
          alias ls='ls -F'                                                                                                                                                                                                                                                                                                                    
      fi                                                                                                                                                                                                                                                                                                                                      
#### end ls colors #### }                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                              
#### zsh super globs #### {                                                                                                                                                                                                                                                                                                                   
setopt NO_CASE_GLOB             # case insensitive globbing                                                                                                                                                                                                                                                                                   
setopt NUMERIC_GLOB_SORT        # numeric glob sort                                                                                                                                                                                                                                                                                           
setopt extendedglob                                                                                                                                                                                                                                                                                                                           
unsetopt caseglob                                                                                                                                                                                                                                                                                                                             
#### end super globs #### }                                                                                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                                                                              
#### misc zsh options #### {                                                                                                                                                                                                                                                                                                                  
setopt NO_BEEP                  # no more beeps                                                                                                                                                                                                                                                                                               
#### end misc zsh options #### }                                                                                                                                                                                                                                                                                                              
                            
#### aliases and functions #### {                                                                                                                                                                                                                                                                                                             
# alias speak_date='espeak “Today is `/bin/date \”+%A, %d %B 20%y\”`”‘                                                                                                                                                                                                                                                                        
# alias speak_time='espeak "Time is `/bin/date` \"+%H hours %M minutes %S seconds\""'                                                                                                                                                                                                                                                         
alias add='git add .'                                                                                                                                                                                                                                                                                                                         
alias commit='git commit .'                                                                                                                                                                                                                                                                                                                   
alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --"                                                                                                                                                                                                                                                                   
alias dud100='du -a --max-depth=1 | sort -n | awk '\''{if($1 > 102400) print $1/1024 "MB" " " $2 }'\'''                                                                                                                                                                                                                                       
alias dud='du --max-depth=1 -h'                                                                                                                                                                                                                                                                                                               
alias duf='du -sk * | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done'                                                                                                                                         
alias irc='if [[ $USER == root || `ps -ef | egrep tmux | egrep -v egrep | wc -l` -eq 0  ]] ; then irssi ; else  tmux rename-window "irc" && irssi ; fi'                                                                                                                                                                                       
alias mail='if [[ $USER == root || `ps -ef | egrep tmux | egrep -v egrep | wc -l` -eq 0  ]] ; then mutt ; else tmux rename-window "emails" && mutt ; fi'                                                                                                                                                                                      
alias o='popd'                                                                                                                                                                                                                                                                                                                                
alias p='pushd'                                                                                                                                                                                                                                                                                                                               
alias push='git push origin master'                                                                                                                                                                                                                                                                                                           
alias same="find . -type f -print0 | xargs -0 -n1 md5sum | sort -k 1,32 | uniq -w 32 -d --all-repeated=separate | sed -e 's/^[0-9a-f]*\ *//;'"                                                                                                                                                                                                
alias testunicode='perl -Mcharnames=:full -CS -wle '\''print "\N{EURO SIGN}"'\'''                                                                                                                                                                                                                                                             
alias x='exit'                                                                                                                                                                                                                                                                                                                                
function _force_rehash() { (( CURRENT == 1 )) && rehash ; return 1 }                                                                                                                                                                                                                                                                          
function goog; { /usr/bin/links 'http://www.google.com/search?q='${(j:+:)*} }                                                                                                                                                                                                                                                                 
function google; { /usr/bin/chromium 'http://www.google.com/search?q='${(j:+:)*} }                                                                                                                                                                                                                                                            
function h() { if [ -z "$*" ]; then history 1; else history 1 | egrep "$@"; fi; }                                                                                                                                                                                                                                                             
#### end aliases and functions #### }                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                              
#### tmux shell init #### {                                                                                                                                                                                                                                                                                                                   
if [[ $USER != root ]]; then                                                                                                                                                                                                                                                                                                                  
    tmux_count=`tmux ls | wc -l`                                                                                                                                                                                                                                                                                                              
    if [[ "$tmux_count" == "0" ]]; then                                                                                                                                                                                                                                                                                                       
        tmux -2                                                                                                                                                                                                                                                                                                                               
    else                                                                                                                                                                                                                                                                                                                                      
        if [[ -z "$TMUX" ]]; then                                                                                                                                                                                                                                                                                                             
            if [[ "$tmux_count" == "1" ]]; then                                                                                                                                                                                                                                                                                               
                session_id=1                                                                                                                                                                                                                                                                                                                  
            else                                                                                                                                                                                                                                                                                                                              
                session_id=`echo $tmux_count`                                                                                                                                                                                                                                                                                                 
            fi                                                                                                                                                                                                                                                                                                                                
        tmux -2 new-session -d -s $session_id                                                                                                                                                                                                                                                                                                 
        tmux -2 attach-session -t $session_id                                                                                                                                                                                                                                                                                                 
        fi                                                                                                                                                                                                                                                                                                                                    
    fi                                                                                                                                                                                                                                                                                                                                        
else                                                                                                                                                                                                                                                                                                                                          
fi                                                                                                                                                                                                                                                                                                                                            
#### tmux init end #### }                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                              
#### motd / fortune #### {                                                                                                                                                                                                                                                                                                                    
fortune futurama                                                                                                                                                                                                                                                                                                                              
#### end motd / fortune #### }                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                              
#### prompt #### {                                                                                                                                                                                                                                                                                                                            
PS1='%(!.%B%F{red}%n %B%F{blue}[%d] %B%F{red}%{☿%} %b%f%k.%B%F{green}%n@%m%k %B%F{blue}%1~ %# %b%f%k)'                                                                                                                                                                                                                                        
#### end prompt #### }                                                       

all the brackets in the comments are for vim folding to make life easier.

on of the cool parts about zsh is the globbing features:

% ls *(
%  -- device files
)  -- end of qualifiers
*  -- executable plain files
+  -- + command name
-  -- follow symlinks toggle
.  -- plain files
/  -- directories
:  -- modifier
=  -- sockets
@  -- symbolic links
A  -- group-readable
D  -- glob dots
E  -- group-executable
F  -- non-empty directories
G  -- owned by EGID
I  -- group-writeable
L  -- + size
M  -- mark directories
N  -- use NULL_GLOB
O  -- + sort order, down
P  -- prepend word
R  -- world-readable
S  -- setgid
T  -- mark types
U  -- owned by EUID
W  -- world-writeable
X  -- world-executable
[  -- + range of files
^  -- negate qualifiers
a  -- + access time
c  -- + inode change time
d  -- + device
e  -- execute code
f  -- + access rights
g  -- + owning group
l  -- + link count
m  -- + modification time
n  -- numeric glob sort
o  -- + sort order, up
p  -- name pipes (FIFOS)
r  -- owner-readable
s  -- setuid
t  -- sticky bit set
u  -- + owning user
w  -- owner-writeable
x  -- owner-executable
2012
06.29

the problem with buying machines second hand is that you never know what the hell is on them. take for example this error that i got as i was trying to migrate from Grub to Grub 2:

/usr/sbin/grub2-bios-setup: warning: Sector 32 is already in use by the program `FlexNet'; avoiding it.  This software may cause boot or other problems in future.  Please ask its authors not to store data in the boot track.

what the fuck is FlexNet and why is it embedded into sector 32 ???

after some googling, this is the link i got as to what FlexNet is.

Due to the inappropriate way the Digital rights management (DRM) works in FlexNet Publisher, it damages bootloaders; this makes FlexNet Publisher incompatible with drives encrypted with TrueCrypt[4] and renders Linux-based systems unable to boot.

great…

now lets remove it.

the next couple of commands may cause a lot of damage to your partition table so be cautious.

lets first make a backup of the mbr and 62 sectors:

sudo dd if=/dev/sda of=/tmp/mbr.img bs=512 count=63

now lets blank it out:

dd if=/dev/zero of=/dev/sda bs=512 count=62 seek=1

at this point we re-install grub or grub 2 without any of that FlexNet crap installed.

2012
06.19

so after doing some more tuning i realized that i hit a weird mark. i cant seem to get bootchart2 to stop at slim. what that means is that the bootchart-collector will always show a time of 25.65 seconds even though i was already logging in by the 21st second.

so here is the new bootchart run:

click to enlarge. warning: its large

i am going to keep working on this until the numbers make more sense.

2012
06.01

so now that i have he adamo up and running i decided to sart tweaking boot times and running process’es, so i installed bootchart2 since bootchart is masked:

!!! All ebuilds that could satisfy "bootchart" have been masked.
!!! One of the following masked packages is required to complete your request:
- app-benchmarks/bootchart-0.9-r4::gentoo (masked by: package.mask)
/usr/portage/profiles/package.mask:
# Pacho Ramos  (11 May 2012)
# No GPL releases for a long time, bundles external classes (#162788)
# Use app-benchmarks/bootchart2 instead. Removal in a month.

so here is the first run of bootchart:

click to enlarge. warning: its large

it took forever due to the dhcp daemon starting for no reason. it was not added to the rc list.

after some work, here is the second result:

click to enlarge.

so with a couple of minutes of work, i was able to take it from 1:07.23 to 00:27.66.

now lets shave some more time off this startup sequence. more updates coming soon.

2012
05.30

more mutt goodness

here is my .muttrc which i will be explaining a little bit.

my needs with mutt were a little bit of a pain in the ass and here is why;
-i needed to be able to check 5 different accounts
–4 google apps domains, 1 gmail account
-one of the accounts needed to allow my pgp key for signing and encryption
-spell checking (achieved in vim using “set spell”)
-must be able to open images, doc files, and pdfs

so for the first part of the .muttrc file , most of the “sets” are commented:

set header_cache=~/.mutt/cache/headers                  # path for cached headers for single download
set message_cachedir=~/.mutt/cache/bodies               # path for cached messages for single download
set certificate_file=~/.mutt/mutt.crt                   # path for stored server certs
set move = no                                           # this tells mutt not to move messages off the mail server
set imap_check_subscribed                               # When set, mutt will fetch the set of subscribed folders from your server on connection, and add them to the set of mailboxes it polls for new mail
set sort=threads                                        # sort messages by thread
set sort_browser=reverse-date                           # sort by newest first
set sort_aux=reverse-last-date-received                 # show threads with youngest message list
alternative_order text/plain text/html application/vnd.msword application/msword    # Prefer Plain text to html, html to word etc ...
set index_format="%4C %Z %[!%b %d %Y %H:%M] %-17.17F (%3l) %s"                      # Simple modification to index format to display year in date column

# Header settings
ignore *                                                # Don't display all headers
unignore From To Cc Subject Date Organization X-Mailer User-Agent                   # header unignores
set editor="vim -c 'set syntax=mail ft=mail enc=utf-8'" # setting editor defaults
set markers=no                                          # Fix multiline url wrapping to not break in gnome terminal
set smart_wrap                                          # dont wrap mid word
set pager_context=5                                     # Retain 5 lines of previous page when scrolling.
set delete=yes                                          # Automatically delete messages marked for deletion on exit
set ssl_starttls=yes                                    # Start TLS if available on server
auto_view text/html                                     # autoview html
set strict_threads                                      # Don't thread messages by subject
set fast_reply=yes                                      # Skip prompt for subject and recipients when replying
set beep_new=yes                                        # Beep when new messages arrive in mailbox
set beep=no                                             # Don't beep on errors
set pager_index_lines=15                                # lines to leave in pager view
set pager_stop=yes                                      # while in pager prevent going to next message

# Printing
set print=yes                                           # Don't ask before printing
set print_command="muttprint"                           # Use muttprint for pretty printing
set print_split                                         # Split each msg selected for printing

the second part of my config file is just color definitions:

# Color definitions
# colors: white black green magenta blue cyan yellow red default colorx

color normal            color245        color233
color error             color124        color233
color tilde             color245        color233
color message           yellow          color233
color markers           yellow          color233
color attachment        color221        color233
color search            color48         color240        # how to hilite search patterns in the pager
color status            color42         color237
color indicator         color220        color88

color hdrdefault        color238        color233
color body              color128        color233        '[-.+\w]+@[-.\w]+[^.]' # e-mail addresses
color underline         brightgreen     color233

and the last section is where all my account definitions are, here is the breakdown:

DOMAIN_ONE is a google apps domain that needed to use my pgp key
DOMAIN_TWO, DOMAIN_THREE, & DOMAIN_FOUR are more google apps domains but did not need pgp keys
GMAIL is a gmail account

#########################
#### account configs ####
#########################

account-hook . 'unset preconnect imap_user imap_authenticators'

#### DOMAIN_ONE ####
account-hook 'imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_ONE.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_ONE.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_ONE.COM@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@DOMAIN_ONE.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 \
pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f" \
pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f" \
pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f" \
pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" \
pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" \
pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xXXXXXXXX -- -r %r -- %f" \
pgp_encrypt_sign_command="pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xXXXXXXXX -- -r %r -- %f" \
pgp_import_command="gpg --no-verbose --import -v %f" \
pgp_export_command="gpg --no-verbose --export --armor %r" \
pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r" \
pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r" \
pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r" \
pgp_autosign=yes \
pgp_sign_as=0xXXXXXXXX \
pgp_replyencrypt=yes \
pgp_timeout=1800 \
pgp_good_sign="^gpg: Good signature from" '
#### end DOMAIN_ONE ####

#### DOMAIN_TWO ####
account-hook 'imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_TWO.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_TWO.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_TWO.COM@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@DOMAIN_TWO.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end DOMAIN_TWO ####

#### DOMAIN_THREE ####
account-hook 'imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_THREE.COM" \
imap_pass = "\PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_THREE.COM" \
imap_pass = "\PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_THREE.COM@smtp.gmail.com:587/" \
smtp_pass = "\PASSWORD" \
from = "USER@DOMAIN_THREE.COM" \
realname = "ebay" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end DOMAIN_THREE ####

#### GMAIL ####
account-hook 'imaps://USER@imap.gmail.com:993/' \
' set imap_user = "USER@GMAIL.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@GMAIL.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@GMAIL.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end GMAIL ####

#### DOMAIN_FOUR ####
account-hook 'imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/' \
' set imap_user = "USER@DOMAIN_FOUR.COM" \
imap_pass = "PASSWORD" '

folder-hook 'imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/INBOX' \
' set imap_user = "USER@DOMAIN_FOUR.COM" \
imap_pass = "PASSWORD" \
smtp_url = "smtp://USER@DOMAIN_FOUR.COM@smtp.gmail.com:587/" \
smtp_pass = "PASSWORD" \
from = "USER@DOMAIN_FOUR.COM" \
realname = "USER" \
folder = "imaps://imap.gmail.com:993" \
spoolfile = "+INBOX" \
postponed="+[Gmail]/Drafts" \
mail_check=60 \
imap_keepalive=300 '
#### end DOMAIN_FOUR ####

for the mailbox names section, those are labeled to be able to switch using “c”:

#### mailbox names ####
mailboxes 'imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/INBOX' \
'imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/INBOX' \
'imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/INBOX' \
'imaps://USER@imap.gmail.com:993/INBOX' \
'imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/INBOX'

the f key macros allow me to switch between accounts by just pressing F5-F9. i would have used F1-F5 but F1-F4 did not work.:

#### f key macros for direct mailbox access
macro generic,index,pager  "c imaps://USER@DOMAIN_ONE.COM@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@DOMAIN_TWO.COM@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@DOMAIN_THREE.COM@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@imap.gmail.com:993/INBOX/\n"
macro generic,index,pager  "c imaps://USER@DOMAIN_FOUR.COM@imap.gmail.com:993/INBOX/\n"

for the /etc/mailcap file, i added these lines:

application/msword; antiword %s | less ; copiousoutput
application/pdf; acroread -tempFile -openInNewWindow %s
image/*; feh %s; copiousoutput

for opening images i use feh, for docs i use antiword, and for pdf’s i use acroread.

for spell checking, i enabled “set spell” (here is my vimrc) which when used, will underline the incorrect words.
usage:

]s - move to the next misspelled word
[s - move to the previous misspelled word
zg - add a word to the dictionary
zug - undo the addition of a word to the dictionary
z= - view spelling suggestions for a misspelled word

a lot of the stuff on this page was done with a lot of searching all over google for various portions of stuff.
here are some of the links that i did bookmark that i used for reference:

http://codesorcery.net/old/mutt/mutt-gnupg-howto
http://www.cmdln.org/2008/11/07/how-i-tamed-my-mutt/
http://mig5.net/content/viewing-docx-attachments-mutt
http://www.spocom.com/users/gjohnson/mutt/

2012
05.09

so i recently got my hands on an adamo 13″ black and decided to put gentoo on it. pretty straight forward.

after everything was installed i wanted to play some music through the headphones, and no sound came out..

so after a little googling this is what resulted :
cat /proc/asound/card0/codec#0 | egrep Codec
which gave me :
Codec: IDT 92HD73C1X5

weird…. i would have figured that an intel hd would be straight forward.

so after getting the codec i referenced kernel.org’s HD audio documentation and did a grep for “92HD73” which lead me to this section:

STAC92HD73*
===========
  ref		Reference board
  no-jd		BIOS setup but without jack-detection
  intel		Intel DG45* mobos
  dell-m6-amic	Dell desktops/laptops with analog mics
  dell-m6-dmic	Dell desktops/laptops with digital mics
  dell-m6	Dell desktops/laptops with both type of mics
  dell-eq	Dell desktops/laptops
  alienware	Alienware M17x
  auto		BIOS setup (default)

so i added:
options snd-hda-intel model=dell-m6 to the end of /etc/modprobe.d/alsa.conf.

rebooted…and confirmed working….

kernel config for 3.3.4

2012
04.30

so this is one of those things that you forget about when you really need it.

ssh sessions dies, now to kill the session….

don’t remember how ???

neither do i most of the time.

type ~ and ? (thats a tilde then question mark)

which gives you this :

$ ~?
Supported escape sequences:
  ~.  - terminate connection (and any multiplexed sessions)
  ~B  - send a BREAK to the remote system
  ~C  - open a command line
  ~R  - Request rekey (SSH protocol 2 only)
  ~^Z - suspend ssh
  ~#  - list forwarded connections
  ~&  - background ssh (when waiting for connections to terminate)
  ~?  - this message
  ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

so the break would be ~.

2012
04.17

i like checking my email with mutt and pine, but for this article i am posting the section of my .muttrc that lets me use my google mail (@pissedoffadmins.com for this example) :

set imap_user = "USER@pissedoffadmins.com"
set imap_pass = "PASSWORD"
set smtp_url = "smtp://USER@smtp.gmail.com:587/"
set smtp_pass = "PASSWORD"
set from = "USER@pissedoffadmins.com"
set realname = "USER"
set folder = "imaps://imap.gmail.com:993"

just change all the uppercase parts to what you need it set to.

since i do not have profiles configured yet i set up aliases in my bashrc to open mutt using the -F flag.

my .muttrc in github
my .bashrc in github

2012
04.06

at time of writing, gentoo TuxOnIce is at sys-kernel/tuxonice-sources-3.0.26 and gentoo sources is at sys-kernel/gentoo-sources-3.3.1.

so after compiling tuxonice-sources (here is my .config for reference) and configuring all the hibernate / suspend scripts referenced here i realized that after resuming from either suspend to ram or hibernating to swap that my function keys were borked.

after doing some googling, it turns out that its a known bug with tuxonice and thinkpads for the function keys to no longer work on resume.

so i decided to just customize a gentoo-sources kernel to support suspending-to-ram and hibernating-to-swap using the thinkpad function keys.

here is my customized .config using a solid foundation from pappy from the gentoo forums. this kernel also has some modified acpi / power configs to help maximize the battery life.

if you decide to use my configurations, make sure that you have sys-power/acpid emerged and set to start on boot or default, and also have sys-power/hibernate-script emerged for all the hibernate and suspend functionality.

now i have a thinkpad that suspends and hibernates without the need of the TuxOnIce patches and works just the same.

here is the bug i found concerning thinkpads and tuxonice even though it says fixed, i have still had issues with it. it could just be use flag vanilla with TuxOnIce, but this was way easier to implement.

2012
04.06

so after using my thinkpad x60 for a while i realized that my battery (brand new) was dying to quickly, to start testing i installed powertop (Gentoo: sys-power/powertop, other : http://www.lesswatts.org/projects/powertop/) and started to notice that there were some changes at the kernel level and other minor tweaks that i could do to maximize on my battery.

Here is the kernel .config tweaked with a good foundation from pappy who is awesome on the Gentoo forums with tweaking out kernels. i recomend that you do a diff between my .config, pappy’s .config, and the .config that comes from portage to see the differences.

at the time of writing, current sys-kernel/gentoo-sources was 3.3.1.

some of the other tweaks that i did (after some googling and using powertop) were :
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
iwconfig wlan0 power timeout 500ms

which after said and done, when my battery is fully charged it went from about 1.75 hours to 3.5 hours (give or take a couple of minutes).