Tuesday, September 29, 2015

Bash alias to get the current IP in the terminal on mac

When I test iOS apps with server API I need my dev machine's local IP. I am using it to start the devserver and in the iOS app to connect to that. 
I got tired of typing ifconfig, scroll to find it and then copy and paste it so I created an alias for it.
Add this to your ~/.profile 
alias cip="ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print \$2}'"
After this restart the terminal or run 
source ~/.profile
Then all you have to do is type cip in the terminal to print your current IP

You can find me on twitter @LZAntal

Friday, September 25, 2015

Install python-ldap on Ubuntu server

Doing the usual to install python-ldap on ubuntu server

$ pip install python-ldap

Gave me this unpleasant

$ error: command 'gcc' failed with exit status 1
After some searching around it turns out that it needs the development files for python and openldap. Installing it still gave me missing module error, which was a missing cyrus sasl package.

Solution

Install all three of these packages before you install python-ldap

$ sudo apt-get install python-dev
$ sudo apt-get install libldap2-dev
$ sudo apt-get install libsasl2-dev
Once all that out of the way run
$ pip install python-ldap
Now you should have a working python-ldap install.