So today I learned about find -exec ... +
Posts for: #Shell
pimped out zsh prompt
Here is [yet another]{zsh-git-prompt} update to the series. I’ve updated my git prompt again,
now using the zsh 4.3.7 built in vcs_info
module. This time the motivation came
from Zsh Prompt Magic article.
Here is what it looks like now:
Everything is now self contained in one file: S60_prompt. Grab it and source it into your zsh config.
The features are:
- name of current branch,
- git repo state (
rebase
,am
,bisect
,merge
, etc), - markers indicating staged/unstaged changes,
- little
1
after branch name indicates dirty working tree, - little
2
after branch name indicates staged changes,
- little
- highlight depth decended into the repository on the right,
- show failure of commands via prompt background change,
- show command/insert mode when using vi mode (
set -o vi
).
live termcasting of your terminal over telnet
I mentioned [earlier]{ubifs-on-sheeva} that I will be giving a talk at Flourish Conf next month. While preparing for the talk I decided to I wanted to share my terminal with the participants of the Workshop via telnet. The more popular alternative would be to use screen built in sharing, or maybe vnc, which would require more memory and CPU overhead… and additional accounts using the former method. I only have a SheevaPlug to work with, so I am trying to be as conservative as possible.
running really nice
Everyone that uses the shell eventually learns about nice
– the tool that runs a process at a reduced priority.
Well, there is also ionice
that allows you to tweak processes from taking over all disk IO.
I added a vnice()
function into my ZSH config so I can run or mark processes for lower priority for
both nice
and ionice
levels.
how would you read a file into an array of lines
I was working on a shell script that needed to look at some lines in a bunch of files and perform some data mining. I started it in bash, so I am writing it in bash even though dave0 notes that I should have started in in perl. Point taken… I suffer for my mistake.
After a quick google I learned that a nice way to do what the topic of this post describes can be done using
IFS='
'
declare -a foo=( $(cat $file) )
Which is great! Right?
mark-yank-urls: fix bug allowing shell to interpret the url
I committed a fix for an annoying bug in the urxvt [mark-yank-urls]{urxvt-url-yank} script.
This has been reported by several people. I have finally fixed it, but the credit should go to Hans Dieter Pearcey, Daniel Danner and Olof Johansson for reporting it.
two terminals one PWD
I often find myself needing multiple terminals (urxvt) with shells (zsh) in the same directory. The step of entering that directory is teadieous, especially if there are many terminals involved. I have a few tricks that I use to make this faster.
shrinking URLs
I wrote a short script to shrink URLs:
% shorturl http://www.jukie.net/~bart/shorturl
http://2tu.us/ce8
% shorturl
Type in some urls and I'll try to shrink them for you...
http://www.jukie.net/~bart/shorturl
http://2tu.us/ce8
http://www.jukie.net/~bart/20090320214228
http://2tu.us/ce9
I am doing this as part of my new identi.ca addiction^W
usage and extending GregKH’s command line micro blogging tool.
UPDATE: also picked up by @vando for use with mcabber.
readlater
Instapaper is a quick way to stash things to read later. Here is a script that lets you post from the command line: readlater.
$ readlater http://www.jukie.net/
This URL has been successfully added to this Instapaper account.
Don’t forget to fill in the USER
and PASS
fields in the script :)
Next, I wanted to call on this from vimperator. I wrote this vimpeator plugin to do that.
show more git info on zsh prompt
UPDATE: This post was [updated]{pimping-out-zsh-prompt} (yet again).
This is my [third]{zsh-git-branch} [post]{zsh-git-branch2} on the topic. I have harshly assimulated MadCoder’s configuration. Here is my new zsh prompt:
UPDATE: I’ve [updated my prompt again]{pimping-out-zsh-prompt}.