Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Mike Wilson www.whisperingwind.co.uk

« Newer Snippets
Older Snippets »
Showing 1-5 of 5 total  RSS 

Very basic lighttpd configuration

The configuration of lighttpd is vast and complex. Here is a close to minimal configuration which allows for Perl and Ruby CGI.

   1  
   2  server.document-root = "/opt/lighttpd/htdocs"
   3  
   4  server.port = 3000
   5  
   6  mimetype.assign = (
   7    ".html" => "text/html",
   8    ".txt" => "text/plain",
   9    ".jpg" => "image/jpeg",
  10    ".png" => "image/png"
  11  )
  12  
  13  static-file.exclude-extensions = ( ".rb", ".pl", ".fcgi", ".php", ".rb", "~", ".inc" )
  14  index-file.names = ( "index.html" )
  15  server.modules += ( "mod_cgi" )
  16  
  17  cgi.assign = (  ".rb" => "/opt/ruby/bin/ruby",
  18                  ".pl" => "/usr/bin/perl")

bash aliases

For old duffers like me who were used to earlier shells when bash came along.

   1  
   2  # These save typing, I use them a lot
   3  
   4  alias sd='cd -' > /dev/null
   5  alias cx='chmod +x'
   6  alias which="type -path"
   7  
   8  # This goes back to Unix v7, some time around 1985 I think.
   9  
  10  alias lf='ls -CF'
  11  
  12  # From my 'C' shell days. Those were almost 20 years ago as well. Sigh.
  13  
  14  alias h='fc -l -20'
  15  alias r='fc -s'
  16  
  17  # Because real men use 'vi' and why use character mode if you have X?
  18  
  19  alias vi='gvim'

.inputrc to make bash command-line editing like ksh

I was used to ksh and vi when bash came along, so I wanted the behaviour to remain the same. Some may think this odd.

   1  
   2  set editing-mode vi
   3  set keymap vi

vim configuration - graphics mode

This is my .gvim rc, the configuration file for gvim, vim's graphics mode. vim is "vi improved", a vi clone and so much more.

   1  
   2  set guifont=Monospace\ 11
   3  
   4  " Overrides settings in vim's configuration. I prefer minimal colour.
   5  
   6  hi Normal			guifg=Black		guibg=White
   7  hi NonText			guifg=Black		guibg=White
   8  hi Comment	gui=none	guifg=DarkGray
   9  hi Constant	gui=none	guifg=Magenta
  10  hi Identifier	gui=none	guifg=DarkGreen
  11  hi Statement	gui=none	guifg=Blue
  12  hi PreProc	gui=none	guifg=Blue
  13  hi Type		gui=none	guifg=Blue
  14  hi Special	gui=none	guifg=DarkGreen
  15  hi Ignore	gui=none	guifg=DarkGreen
  16  hi Error	gui=none	guifg=DarkGreen
  17  hi Todo		gui=none	guifg=DarkGreen
  18  hi Cursor	gui=none	guifg=White		guibg=Black
  19  
  20  autocmd GUIEnter * winpos 66 28
  21  autocmd GUIEnter * winsize 80 45
  22  
  23  " What is this menu for? No documentation, something to do with 'C'
  24  " or C++ perhaps? Dunno, but I don't want it.
  25  
  26  aunmenu Bicycle\ Repair\ Man
  27  
  28  " If I have Python, create a dummy project menu and exececute the
  29  " vimproject script.
  30  
  31  if has ("python")
  32      if filereadable ("/home/mrw/bin/vimproject.py")
  33  	amenu Project.Dummy dummy
  34  	pyfile /home/mrw/bin/vimproject.py
  35      endif
  36  endif
  37  

vim configuration

This is my .vimrc file -- configuration options for vim, the "vi improved" text editor for grown ups.

   1  
   2  :autocmd!
   3  
   4  set nohlsearch
   5  
   6  " Press F2 to word-wrap a block of text. It's almost like using Word
   7  " Star all over again.
   8  
   9  map #2 !}fmt -65
  10  
  11  " Personally, I wouldn't use a C++ keyword as a Java identifier, but
  12  " if someone else does, I don't want an ugly display, so turn off
  13  " flagging of this as an error:
  14  
  15  let java_allow_cpp_keywords=1
  16  
  17  set autoindent
  18  set cmdheight=2
  19  
  20  " Strewth, what a mess. Copied from the vim docs, if memory serves.
  21  
  22  set comments=s:/*,mb:**,ex:*/,://,b:#,b:##,:%,:XCOMM,n:>,fb:-
  23  
  24  set formatoptions=orc
  25  set history=20
  26  set incsearch
  27  set ignorecase
  28  set keywordprg=
  29  set mouse=a
  30  set mousehide
  31  set mousemodel=popup_setpos
  32  set nowrapscan
  33  set path=.,/usr/include,/usr/local/include
  34  set smartcase
  35  set nosmartindent
  36  set smarttab
  37  set showmode
  38  set textwidth=70
  39  set viminfo='50,\"10000,n~/.viminfo
  40  set wildchar=9
  41  set wildignore+=*.class,*.pyc
  42  set wildmenu
  43  
  44  syntax on
  45  
  46  :autocmd FileType *		set shiftwidth=4
  47  :autocmd FileType xml,html	set shiftwidth=2
  48  :autocmd FileType java,c,cc,cpp	set nocindent
  49  
  50  set makeprg=ant
  51  
  52  " Bleurgh! This makes sense of ant/jikes error messages so the ":make"
  53  " command works. But, I ask you, how the f**k can anyone make sense of
  54  " that mess?
  55  
  56  set efm=\ %#[javac]\ %#%f:%l:%c:%*\\d:%*\\d:\ %t%[%^:]%#:%m,\%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#
  57  
  58  " For the style of comments I like in 'C', C++ and Java.
  59  
  60  autocmd BufNewFile,BufRead *.java set comments=s:/*,mb:**,ex:*/
  61  autocmd BufNewFile,BufRead *.c set comments=s:/*,mb:**,ex:*/
  62  autocmd BufNewFile,BufRead *.cc set comments=s:/*,mb:**,ex:*/
  63  
« Newer Snippets
Older Snippets »
Showing 1-5 of 5 total  RSS