Code for Concinnity


Local/project-based .ackrc

If you use Ack, you may be annoyed by the fact that it only reads $HOME/.ackrc but not the project-local ./.ackrc.

It turns out it is quite easy to do it yourself by creating a simple shell script wrapper and then aliasing the ack command:

1
2
3
4
5
6
7
8
9
10
#!/bin/sh
# ack.sh

ackrc=""
if [ -f ./.ackrc ]
then
  ackrc=$(tr '\n' ' ' < ./.ackrc)
fi

ack $ackrc $*
1
2
3
# ~/.bashrc

alias ack="$HOME/bin/ack.sh"

That’s it! Now I can create a .ackrc file at project root like this:

1
2
3
--ignore-dir=tmp
--ignore-dir=logs
--ignore-dir=vendor

Now using this technique, one can easily create a wrapper than reads both $HOME/.greprc and ./.greprc and you get Ack’s functionality in grep! Now you wonder if we really need Ack at all :P

Published by kizzx2, on July 11th, 2012 at 9:36 pm. Filled under: Uncategorized Tags: , , 1 Comment

Starting Windows’ Network and Sharing Center from command prompt

It has always looked not-so-cool to have to type “Sharing” at the start menu or worse yet, navigate through the Control Panel just to start it. Today I finally dug out how to do it from TechNet:

1
control /name Microsoft.NetworkAndSharingCenter

Looks like Microsoft decided to go down the verbose path. Maybe I’ll just stick with the old ways :p

Published by kizzx2, on December 29th, 2009 at 9:21 pm. Filled under: Useful tips Tags: , , , No Comments