tactical vim

nerdy bits & pieces

remapping the Courier font in Fedora

leave a comment »

It’s 2013, why are we still dealing with this? But I digress…

One of my recent updates caused the Courier font to get mapped to a Type1 font for “Nimbus Mono L” out of the urw-fonts package (required by gimp and friends), resulting in crappy skinny 12pt fonts in Firefox text editing windows using CSS font families for Courier.

Remapping it changed a bit in F18+, ~/.fonts.conf has moved to ~/.config/fontconfig/fonts.conf — I like using DejaVu Sans Mono as my Courier fontmap. Per my 2nd update below these new Google fonts are jacking up my Firefox on some sites, so blacklisting them completely now.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

 <match target="pattern">
  <test qual="any" name="family" compare="eq">
  <edit name="family" mode="prepend" binding="same">
   <string>DejaVu Sans Mono</string>

    <family>DejaVu Sans Mono</family>

     <patelt name="scalable"><bool>false</bool></patelt>

    <patelt name="family">
    <patelt name="family">


Update #1: was sitting here and upgraded another laptop and decided to check before and after – sure enough my Courier was remapped. Wonder if it’s those new Google fonts…

$ fc-match courier
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"
$ fc-match courier
n022003l.pfb: "Nimbus Mono L" "Regular"

  kernel.x86_64 0:3.11.4-201.fc19
  kernel-devel.x86_64 0:3.11.4-201.fc19
  kernel-modules-extra.x86_64 0:3.11.4-201.fc19

  kernel.x86_64 0:3.11.7-200.fc19
  kernel-devel.x86_64 0:3.11.7-200.fc19
  kernel-modules-extra.x86_64 0:3.11.7-200.fc19

Dependency Installed:
  google-crosextra-caladea-fonts.noarch 0:1.002-0.1.20130214.fc19
  google-crosextra-carlito-fonts.noarch 0:1.103-0.1.20130920.fc19

  autocorr-en.noarch 1:
  ghostscript-fonts.noarch 0:5.50-32.fc19
  gimp.x86_64 2:2.8.8-1.fc19
  gimp-libs.x86_64 2:2.8.8-1.fc19
  glibc.x86_64 0:2.17-19.fc19
  glibc-common.x86_64 0:2.17-19.fc19
  glibc-devel.x86_64 0:2.17-19.fc19
  glibc-headers.x86_64 0:2.17-19.fc19
  hwdata.noarch 0:0.257-1.fc19
  kernel-headers.x86_64 0:3.11.7-200.fc19
  libgcrypt.x86_64 0:1.5.3-2.fc19
  libmwaw.x86_64 0:0.2.0-1.fc19
  libodfgen.x86_64 0:0.0.3-1.fc19
  libreoffice-calc.x86_64 1:
  libreoffice-core.x86_64 1:
  libreoffice-draw.x86_64 1:
  libreoffice-graphicfilter.x86_64 1:
  libreoffice-impress.x86_64 1:
  libreoffice-langpack-en.x86_64 1:
  libreoffice-opensymbol-fonts.noarch 1:
  libreoffice-pdfimport.x86_64 1:
  libreoffice-ure.x86_64 1:
  libreoffice-writer.x86_64 1:
  mate-dialogs.x86_64 0:1.6.2-0.1.git59337c9.fc19
  openldap.x86_64 0:2.4.36-4.fc19
  tzdata.noarch 0:2013h-1.fc19
  tzdata-java.noarch 0:2013h-1.fc19
  wireshark.x86_64 0:1.10.3-2.fc19

Update #2: another website jacked by this upgrade, it was substituting one of these new Google fonts for Tahoma and Calibri on my, causing text to be teensy. The fonts.conf has my blacklist now included.

Written by troyengel

2013-11-08 at 11:08

tilde slash dot vimrc

leave a comment »

Kinda curious, after all this time I’ve never uploaded my ~/.vimrc — I was tweaking the gvim tab labels today, seems like a good time to share; like most people I started with someone else’s way, way back when. WordPress’s code highlighter doesn’t understand VimScript so y’all get it without pretty colours, sorry.

" This must be first  - it changes other options as a side effect
set nocompatible    " use Vim settings, rather then Vi settings

set shortmess+=I    " get rid of the intro screen on blank file
set background=dark " this works better for text mode white-on-black terms
set backspace=2     " allow backspacing over everything in insert mode
set esckeys         " allow cursor keys in insert mode
set noautoindent    " always set autoindenting off
set shiftwidth=4    " number of spaces used for autoindent insertions
set tabstop=4       " tabstop positions

set nobackup        " backups are for wimps
set history=50      " keep 50 lines of command line history

set noerrorbells    " damn that beep to hell
set visualbell      " enable terminal visual bell, but...
set t_vb=           " ...unset the code to do it. (MacVim needs this)
set magic           " use 'magic' patterns  (extended regexp) in search
set ignorecase      " ignore case during searches
set smartcase       " all lower/upper = case insensitive, \c \C overrides

set laststatus=2    " show status line, even if only one buffer
set report=0        " show report on all (0) changes
set lazyredraw      " do not update screen while executing macros
set ruler           " show the cursor position all the time
set showcmd         " show current uncompleted command
set showmode        " show current mode
set showmatch       " show matching brackets

" tone down that dang bold highlighting, folks
" highlight=8b,db,es,hs,mb,Mn,nu,rs,sr,tb,vr,ws
set highlight=8r,db,es,hs,mb,Mr,nu,rs,sr,tb,vr,ws

" do not jump to first character with page commands, ie keep the cursor
" in the current column.
set nostartofline

" what info to store from an editing session in the viminfo file
set viminfo=%,'50,\"100,:100,n~/.viminfo

" allow the last line to be a modeline - useful when
" the last line gives the preferred textwidth
set modeline
set modelines=1

" add the dash ('-'), the dot ('.'), and the '@' as "letters" to "words".
" this makes it possible to expand email addresses, eg: joe-www@foo.org
set iskeyword=@,48-57,_,192-255,-,.,@-@

" which chars/keys to allow eol wrapping (:help whichwrap)
set whichwrap=<,>,[,]

" enable wrapping but without linebreaks
set wrap
set linebreak
set nolist        " list disables linebreak
set textwidth=0
set wrapmargin=0
set formatoptions+=l

" When the backspace key sends a "delete" character
" then you simply map the "delete" to a "backspace" (CTRL-H):
map <Del> <C-H>

" Don't use Ex mode, use Q for formatting
map Q gq

" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch

" GVIM preferences
if has("gui_running")
  set showtabline=2             " always show the tab bar
  set guioptions-=t             " turn off the menu tearoffs
  colorscheme zellner           " mimics gedit/medit/etc.
  set t_Co=256                  " 256 colors

  let os=substitute(system('uname'), '\n', '', '')
  if os == 'Darwin' || os == 'Mac'
    set guifont=Menlo:h16
    set guicursor+=a:blinkon0
    set guioptions+=T
  elseif os == 'Linux'
    set guifont=Monospace\ 12

  function! GuiTabLabel()
    let label = ''
    let bufnrlist = tabpagebuflist(v:lnum)
    " Add '+' if one of the buffers in the tab page is modified
    for bufnr in bufnrlist
      if getbufvar(bufnr, "&modified")
        let label = '+'
    " Append the tab number
    let label .= v:lnum.': '
    " Append the buffer name
    let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
    if name == ''
      " give a name to no-name documents
      if &buftype=='quickfix'
        let name = '[Quickfix]'
        let name = '[No Name]'
      " get only the file name
      let name = fnamemodify(name,":t")
    let label .= name
    return label
  set guitablabel=%{GuiTabLabel()}


Written by troyengel

2013-04-14 at 19:22

Posted in Uncategorized

Tagged with , , , , , , ,

solution: racadm launches and fails to work

leave a comment »

From the “yes, I had to fight this battle” department – the Dell OMSA tool racadm – in at least 6.5 and 7.1 – seems to have an internal hard-coded limit of 65535 when checking it’s own previous PID number.


  • racadm in local mode will create/check a pidfile /var/run/local_racadm.pid
  • If the PID inside that file is larger than 65535 then racadm will crash
  • Delete /var/run/local_racadm.pid before launching the tool

When run locally the first time (meaning not using “racadm -r [IP]“, just “racadm” from the local OS using IPC sockets to the local iDRAC) the tool will create a pidfile /var/run/local_racadm.pid and drop it’s own PID into that file – standard UNIX-y stuff. However, it doesn’t delete that file when it’s done. Every subsequent time it’s run it will check for the existence of this pidfile; if found, it will read the value and presumably check the process stack to ensure it’s not already running – again, standard UNIX-y stuff.

Now take a peak at this RHEL6 kernel’s maximum PID possibility:

# cat /proc/sys/kernel/pid_max

Here’s where we get into trouble – if the PID inside the racadm pidfile is larger than 65535 (from the previous time it ran) then the racadm tool will just bail and crash leaving you with no clue why – it took a lot of strace-fu to discover this. If you simply delete /var/run/local_racadm.pid before launching the tool it will work fine. Or you could edit the file and toss some random unused PID lower than 65535 into it (not recommended).

Written by troyengel

2013-03-09 at 08:06

setting up jumbo frames in RHEL/CentOS

leave a comment »

Jumbo frames are the concept of opening up the Ethernet frames to a large MTU to be able to push large packets without fragmenting; this can be a common need on a private GigE switched network for Oracle RAC Interconnect between nodes. The accepted standard is 9000 (large enough for 8k payload plus packet overhead). Once your GigE switches have been configured for the new MTU, configure and test your servers.

Node A: (bond1)
Node B: (bond1)

On both nodes:

 # ip link set dev bond1 mtu 9000
 # vi /etc/sysconfig/networking-scripts/ifcfg-bond1
    add: MTU=9000

Node A -> B test:

 # ip route get
 # tracepath -n
 # ping -c 5 -s 8972 -M do

Node B -> A test:

 # ip route get
 # tracepath -n
 # ping -c 5 -s 8972 -M do

For those interested in the math, read on for theoretical maximums and protocol overhead:

Read the rest of this entry »

Written by troyengel

2013-03-07 at 20:56

disabling autonegotiate on the Dell iDRAC

with one comment

Dell iDRAC devices tend to have problems negotiating with a switch port that’s at 1000mbit/auto – the device is limited to 100mbit. The quickest way to get it working is to disable auto and just go 100/Full.

# racadm getconfig -g cfgNetTuning

# racadm config -g cfgNetTuning -o cfgNetTuningNicAutoneg 0
# racadm racreset

After a minute or so from it’s reboot it should pop right up on the network.

Written by troyengel

2013-03-07 at 20:20

debuggex: a visual regular expression debugger

leave a comment »

A fella named Serge Toarca sent me a message via G+ about a new tool he launched a week or so ago – Debuggex. It’s a javascript based regex debugging tool with a neat twist – a visual flowchart helping explain what has and hasn’t matched. Try out one of his samples to get an idea of how visualizing a complicated regex comes in handy:


I’m definitely going to give this a serious whirl during my next regex adventure (well, at least one that’s more complicated than matching line endings :) ). You can follow him via @Debuggex if Twitter is your thing.

Written by troyengel

2013-03-03 at 14:36

Posted in Uncategorized

Tagged with , , ,

repl_cmds.sh: bash aliases and functions

leave a comment »

My immediate need is to replace the workflow for when two external binaries might not be installed — resize (part of the xterm package) and “netcat -zv “. Update: I decided to see if I could inline perl and python just for kicks, it works. I can hear 7 million python coders weeping at my one-liner already.


# if resize (via xterm) is not available
alias tsize='shopt -s checkwinsize;COLUMNS=$(tput cols);LINES=$(tput lines);export COLUMNS LINES;echo -e "COLUMNS=$COLUMNS;\nLINES=$LINES;\nexport COLUMNS LINES;"'

# if netcat is not available
# - requires --enable-net-redirections compiled in with bash
# - works on RHEL/CentOS/Fedora but not Ubuntu/Debian
function nctzv() { [[ $# -eq 2 ]] && (timeout 3 bash -c "echo >/dev/tcp/$1/$2" && echo "Connection to $1 port $2/tcp succeeded" || echo "Connection to $1 port $2/tcp failed"); }

# the same nctzv() function in perl
function nctzv_pl() { perl -e 'use IO::Socket::INET;$socket=IO::Socket::INET->new(Proto=>tcp,Timeout=>3,PeerAddr=>$ARGV[0],PeerPort=>$ARGV[1]);printf("Connection to %s port %s/tcp ",$ARGV[0],$ARGV[1]);if(defined $socket && $socket){$socket->close();print "succeeded\n"}else{print "failed\n";}' $1 $2; }

# the same nctzv() function in python
function nctzv_py() { python -c "exec('import sys\nimport socket\nh=sys.argv[1]\np=sys.argv[2]\ns=socket.socket(socket.AF_INET,socket.SOCK_STREAM)\ns.settimeout(3)\ntry:\n\ts.connect((sys.argv[1],int(sys.argv[2])))\n\ts.shutdown(2)\n\tprint \"Connection to \"+h+\" port \"+p+\"/tcp succeeded\"\nexcept:\n\tprint \"Connection to \"+h+\" port \"+p+\"/tcp failed\"\ns.close')" $1 $2; }


Written by troyengel

2013-02-17 at 11:34


Get every new post delivered to your Inbox.

Join 65 other followers

%d bloggers like this: