Wednesday, 14 December 2011

cpanm for lazy people

This way individual projects with specific perl requirements avoid
borking the global install.


## I'm going to use MediaWiki::API to load, so I'll install local::lib
## using cpanm.

## Step 1, install a local cpanm (and some deps)

curl -k -L http://cpanmin.us \
   | perl - -l local-lib App::cpanminus


## Step 2, install local::lib

./local-lib/bin/cpanm \
   -l local-lib local::lib

perl -Ilocal-lib/lib/perl5/ -Mlocal::lib=`pwd`/local-lib \
   > local-lib.sh

source local-lib.sh


## Step 3, install MediaWiki::API

cpanm MediaWiki::API




## ENJOY

.emasc customization

Here is is:

P.S. Why no cut and paste at the bottom?




;; .emacs

;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)

; Disable that annoying Emacs Splashscreen
(setq inhibit-splash-screen t)

;; Load!
(setq load-path (cons "~/emacs" load-path))

;; Allow R command automatically
(load "~/emacs/ess-5.8/lisp/ess-site.el")

;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
 (global-font-lock-mode t))

;; enable visual feedback on selections
;(setq transient-mark-mode t)

;; default to better frame titles
(setq frame-title-format
     (concat  "%b - emacs@" (system-name)))

;; default to unified diffs
(setq diff-switches "-u")

;; always end a file with a newline
(setq require-final-newline 'query)



;; Handle my non-standard Perl extension
(setq auto-mode-alist (cons '("\\.plx$" . cperl-mode) auto-mode-alist))


;; Allow ?
;(load "~/emacs/bioperl.lisp")

; One DB
;(require 'sql)
;(defalias 'sql-get-login 'ignore)



;;; Some cool functions...

;; Auto INC
(defun increment-number-at-point ()
 (interactive)
 (skip-chars-backward "0123456789")
 (or (looking-at "[0123456789]+")
     (error "No number at point"))
 (replace-match (number-to-string (1+ (string-to-number (match-string 0))))))

;; Auto DEC
(defun decrement-number-at-point ()
 (interactive)
 (skip-chars-backward "0123456789")
 (or (looking-at "[0123456789]+")
     (error "No number at point"))
 (replace-match (number-to-string (1- (string-to-number (match-string 0))))))

;; Assign them
(global-set-key (kbd "C-c +") 'increment-number-at-point)
(global-set-key (kbd "C-c -") 'decrement-number-at-point)



;;; Biffy (http://www.cabochon.com/~stevey/blog-rants/effective-emacs.html)

;; Make M-x a handy new key stroke
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-c\C-m" 'execute-extended-command)

;; Make Ctrl-w match shell behaviour
(global-set-key "\C-w"     'backward-kill-word)

;; (remap old Ctrl-w behaviour to the following)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)

;; Lose the UI
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
;(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
;(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))

;; Re-run a macro at the push of a (single) button
(global-set-key [f5]       'call-last-kbd-macro)

;; Make paragraph formatting easier to access
(global-set-key "\M-p" 'fill-paragraph)

;; Stop Ctrl-z being stupid (and make it a shameless customization)
(global-set-key "\C-z" 'undo)




(custom-set-variables
 ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
 ;; Your init file should contain only one such instance.
 '(comint-move-point-for-output (quote others))
 '(comint-scroll-show-maximum-output t)
 '(comint-scroll-to-bottom-on-input t)
 '(comint-scroll-to-bottom-on-output t)
 '(cperl-indent-level 4)
 '(ess-ask-for-ess-directory nil)
 '(ess-help-own-frame (quote one))
 '(indent-tabs-mode nil)
 '(w3m-use-cookies t))
(custom-set-faces
 ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
 ;; Your init file should contain only one such instance.
 )

git remote for cvs... (Switching to a new CVS server)

See http://docs.moodle.org/20/en/CVS_for_Administrators#Switching_to_a_new_CVS_server

For me, its like this:

find . -type f -name Root | \
  xargs perl -pi -e \

    's/:pserver:cvsuser:\@cvs\.sanger\.ac\.uk:\/cvsroot\/ensembl/:ext:db14\@cvs.sanger.ac.uk:\/cvsroot\/ensembl/'