I found this note-to-self which explains how to do bandwidth and latency emulation on Mac OS X system wide, that is, independent of Chrome, Firefox, Safari or whatever browser you may be using.
It can be done using a “network pipe”, and it is relatively easy to find several detailed articles about its usage once you know the name. One of these articles is this one, which, apart from explaining the basic usage of network pipes, also lets us know that there is a GUI tool called “Network Link Conditioner” bundled with Xcode 4.2 for this very purpose.
Now go and optimize your app/website for low bandwidth conditions :)
Git seems to always have the feature I need, but often I’m not able to find it right away. While searching for a commit where a certain constant had been removed, I stumbled upon the deprecated git-diff-grep, which, in its readme, led me to the solution I could have easily found by just reading the, you know, manual (i.e.
man git-log) :)
Look for differences that introduce or remove an instance of
<string>.Note that this is different than the string simply
appearing in diff output; see the pickaxe entry in gitdiffcore(7)
for more details.
Look for differences whose added or removed line matches the given
Knowing that, you can simply do the following:
$ git log -S"WHERE_DID_IT_GO"
$ git log -G"WHERE_DID.*"
If you want to see the commit’s diff as well, just supply the
As I had become more and more annoyed by the fact that there was no nice and easy way to trim trailing spaces from my source code, I’ve written “Mow.py“, a convenience Python script that makes it as easy as
git mow (or if you’re not a git user
mow -r) to get rid of those nasty spaces.
Check it out over at GitHub :)
Easy as pie if you know how to do it (actually this works for installing NewRelic anywhere that is not a standard Apache/PHP path) :)
- Download the New Relic installer files (as a .tar.gz package)
- Find out your MAMP PHP path (mine was /Applications/MAMP/bin/php/php5.3.6/bin)
- Go to your unpacked new relic installer files and execute
sudo NR_INSTALL_PHPLIST='<your mamp php path>' ./newrelic-install
- Follow the instructions in the installer (don’t forget to edit your php.ini, the installer gives you instructions on what to add)
And voilá, worked like a charm :)
PS: New Relic is kind of awesome!
I usually work with a tab width of 4 when editing code, but
git-diff (that is the *nix
less program) seems to use a default tab width of 8. You can change this behavior by setting the
core.pager option to something like this:
This would result in a tab width of 4. If you are not familiar with git config, here’s how you set the option:
$ git config --global core.pager 'less -x4'
If you remove the
--global flag, the option will be changed only for the current git repository, otherwise it will be changed globally for the current user account.
I like my home folder neat at clean, at least when viewed in finder, and once in a while some application comes along and thinks it has to place some random folder there. In some cases, said application is intelligent enough to prepend the folder with a dot, which will cause it to be hidden in Finder automatically, but here is a way to hide a folder if you cannot change its name:
# Hides a folder in Finder
$ chflags hidden SomeFolder/
# Unhides a folder in Finder
$ chflags nohidden SomeFolder/
Because those are somewhat long, I’ve created the following aliases on my system:
alias hide='chflags hidden'
alias unhide='chflags nohidden'
If you add these to lines to your
~/.profile file, you can use
unhide as shortcuts.
You can check it out here, and the source-code is hosted on GitHub.
Please let me know what you think of it, any suggestion are welcome :)
Unfortunately it is not possible to give meaningful names to the plugins created by the kickstarter extension, so they’re all named
pi2 and so on. Because this can get rather tiresome if you’ve got multiple plugins inside the same extensions, I’ve written a small ruby script to rename them.
For all of you who use Git on a daily basis, you probably know annoying it is to write .gitignore files yourself. But why do so? Someone else has already written them for you! Now for the really “lazy” ones, I wrote gemignore, which is a command-line utility which automatically adds snippets to you .gitignore files. Just take it for a test-drive:
$ gem install gemignore
-> Available .gitignore snippets:
$ gemignore go
-> Snippets found for ‘go’:
$ gemignore add Django
Adding Snippet ‘Django’
Features planned as soon as I have the time to write them:
- Find the nearest .gitignore file instead of using the current working directory
- Add other sources for .gitignore snippets? (if you know any, please leave a comment :)
Proper command-line help – Added in 0.2.0
If you can think of a feature you’d like to see in
gemignore feel free to post it as a comment. And please report any bugs you find here.