Blackout for SOPA and PIPA.
Click to learn more
Posterous theme by Cory Watilo

Filed under: Ubuntu

Show Your GIT Branch Name In Your Prompt

Media_https3amazonaws_hvyjm

Show Your GIT Branch Name In Your Prompt

Typing git branch over and over to see what branch you are on sucks. Sure, you could argue that you should always KNOW what branch you’re currently working on. And if you did, you would obviously not be a git user. Bouncing around branches can be pretty common, and I know I’ve messed some things up pretty bad not knowing what branch I was on. So set up your shell to always put the name of the current branch into your prompt. [cc lang="bash" escaped="yes" lines="27"] function parse_git_branch { git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } function proml { local BLUE="\[\033[0;34m\]" local RED="\[\033[0;31m\]" local LIGHT_RED="\[\033[1;31m\]" local GREEN="\[\033[0;32m\]" local LIGHT_GREEN="\[\033[1;32m\]" local WHITE="\[\033[1;37m\]" local LIGHT_GRAY="\[\033[0;37m\]" case $TERM in xterm*) TITLEBAR=&'\[\033]0;\u@\h:\w\007\]&' ;; *) TITLEBAR="" ;; esac PS1="${TITLEBAR}\ $BLUE[$RED\$(date +%H:%M)$BLUE]\ $BLUE[$RED\u@\h:\w$GREEN\$(parse_git_branch)$BLUE]\ $GREEN\$ " PS2=&'> &' PS4=&'+ &' } proml [/cc] Pastie Link Put this at the top of your .bash_profile and you’ll be pimping your branch all over. Thanks to @defunkt for this. via Show Your GIT Branch Name In Your Prompt.
I thank @fqqkd for this, He pointed me to the post. Though I didn't like the colors, so I've made blue [cc lang="bash" inline="yes"]BLUE="\[\033[0;36m\]"[/cc] and the propt: [cc lang="bash" escpaed="yes"] PS1="${TITLEBAR}\ $BLUE[$RED\$(date +%H:%M)$BLUE]\ $BLUE[$BLUE\u@\h:\w$GREEN\$(parse_git_branch)$BLUE]\ $BLUE\$ " [/cc]

Dropbox - If you've lost your hdd space

Media_https3amazonaws_gzpcb
I came home the other day, and had my computer notifying me about less then 2GB free space left. I fiddled a bit round with my data, deleted cache, sources, downloaded archives, etc. All went fine, had about 7GB left. Closed the lid, went to sleep and work. I got home today, and the same message waited for me on the screen again. I did a deeper folder size analysis, and found the truth. DROPBOX (2Gb package) CACHE was 15GB! In my home folder was a
.dropbox/cache
directory, which had several YYYY-MM-DD formatted entries. I deleted all, but the last 2 dates, and freed 10Gb's. If anyone finds a good way to prevent this hog, please leave a comment.

Helmi Ble'be': Trac error - database disk image is malformed

Media_https3amazonaws_ocdzj
I've ran into an irritating error after migrating the data from one server to the other. One of my projects under Trac got corrupted. I've found the solution:
One of my trac page got the error message "database disk image is malformed" "underlying Trac DB is in serious trouble, may corrupted" - Ticket #6347 How I fix: [cc lang="bash" escaped="true"]sqlite3 trac.db .dump | sqlite3 trac2.db cp trac.db trac.broken.db cp trac2.db trac.db[/cc]
via Helmi Ble'be': Trac error - database disk image is malformed.