git diff like highlighting of extra whitespace in vim and emacs

via Jim Meyering via coreutils list

Some configs for vim and emacs to show trailing whitespace and other whitespace anomalies.

vim config

let c_space_errors=1
highlight RedundantSpaces ctermbg=red guibg=red
match RedundantSpaces /\s\+$\| \+\ze\t/

Emacs needs the Whitespace mode from http://www.emacswiki.org/emacs/WhiteSpace

The default config is a bit overboard for me, so I use something more like:

;http://www.emacswiki.org/emacs/WhiteSpace
(require 'whitespace)
(autoload 'global-whitespace-mode "whitespace" "Toggle whitespace visualization." t)
(autoload 'global-whitespace-toggle-options "whitespace" "Toggle local `whitespace-mode' options." t)

;turn on the more or less git diff --color whitespace highlighting
(setq whitespace-space whitespace-style (quote (face tabs trailing space-before-tab newline empty space-after-tab indentation)))

gitconfig

I finally started organizing the various git commands and aliases I use alot, and published them to github. My gitconfig repo.

Some of these are useful only for projects similar to mine (fedora, tito based, bugzilla, etc) but I think some of then are generally useful.

A few favorites:
# commits not pushed to $1
unpushed = cherry -v

# ignore po files in "git log", sorry translators ;-<
slog = "!sh -c 'git log --no-merges $1 `ls | grep -v ^po`' -"

# what tag contains the sha
whatrelease = name-rev --name-only

# what branch contains the sha
contains = branch --contains

# what got pushed to master in the last hour
# based on http://stackoverflow.com/questions/3357219/expose-the-date-a-commit-was-pushed-to-a-repository
justpushed = log origin/master@{\"1 hour ago\"}..origin/master --

# show a list of branches sorted by time of last commit
brage = "!sh -c 'for C in $(git for-each-ref --sort=committerdate refs/heads --format=\"%(refname:short)\") ; do git show -s pretty=format:\"%Cgreen%ci %Cblue%cr%Creset $C\" \"$C\" -- ; done'"

# show a list of tags sorted by when they were tagged
tagage = "!sh -c 'git for-each-ref --sort=taggerdate refs/tags --format=\"%(refname:short)\"'"

# show a list of every branch and show there latests commit, sorted by last commit
brlog = "!sh -c 'for C in $(git for-each-ref --sort=committerdate refs/heads --format=\"%(refname:short)\") ; do git show -s --pretty=format:\"%Cgreen%ci %Cblue%cr%Creset $C\" \"$C\" -- ; git show -s $C ; echo; done'"

# needs python-bugzilla, and git-showbugs
openbugs = showbugs -s NEW,ASSIGNED,NEEDINFO,FAILS_QA,REOPENED,ON_DEV
closedbugs = showbugs -s PASSES_QA,VERIFIED,RELEASE_PENDING,CLOSED

# show a list of files with bug fixes in them, sorted by popularity of occurance
# aka, list the buggy files
buggyfiles = !"git log --format=\"format:%n\" --grep \"^[[:digit:]]\\+:\" --name-only | grep . | sort | uniq -c | sort -n"

ring ring, fedoraphone!

I managed to get one of my machines installed with a os version I didn’t want, and no way to change it. Normally, this means it’s time to koan/cobbler to get it re-provisioned. But I couldn’t log into the machine to do anything. I could of reinstalled it from a cd/dvd, but I hate burning cd/dvd’s for that. I could of written an image to usb key and installed from that, but I didn’t have any with me.

So I decided to try what Mark Cox; did and try to boot it from my phone. I more or less just followed the steps he mentioned, though I had to get some 3rd party software to expose the storage card as a usb device.

But that aside, it worked. Not the fastest way to boot, but it got the live image running so I could do a hard drive install.  Kind of cool. Wonder if there is anyway to support i386/x86_64 live images on the same card?