Friday, May 27, 2016

Installing ssh-copy-id on Mac OS X using MacPorts

Ssh-copy-id is a script used to add your public key to remote server, so next time you connect to that remote server, it would be passwordless (unless, of course, if you put a paraphrase when generate your public key).

Most simple way is by using MacPorts:
$ sudo port install openssh +ssh-copy-id
That's it! And you ready to use it :)

Wednesday, April 13, 2016

Modifying Vim to be able editing crontab in Mac OS X Yosemite

Get the solution from Vim Wikia post here, already tried this by myself and worked like a charm :)

If you ever get this error while trying to add cron entries:
crontab: temp file must be edited in place
Then the solution is very simple. You just need to create ~/.vim/ftplugin/crontab.vim and add this one line:
set backupcopy=yes
Save the file and you can try to add cron entry again.

Mutt+Offlineimap Error while using it to access Gmail IMAP

The solution came from this forum

Upon Offlineimap version 6.6.0, you'll get an error when accessing Gmail IMAP, something like this:
XOAUTH2 authentication failed: AUTHENTICATE command error: BAD ['Client aborted AUTHENTICATE command. q205mb46565077wmb']. Data: MFNB2 AUTHENTICATE XOAUTH2

The solution is very simple, you just have to add one line to your .offlineimaprc file, in the [Repository YOUR_ACCOUNT-remote] section:
auth_mechanisms = LOGIN

referring to config line: #auth_mechanisms = GSSAPI, CRAM-MD5, XOAUTH2, PLAIN, LOGIN

Save the file and run your offlineimap to check that the error is already gone. Voila! :)

Setup Wi-Fi on your Raspberry Pi via the Command Line

The complete guide for this can be checked here

1. Boot up your Pi
2. Connect ethernet cable to your Pi
3. SSH into it (You can check the IP from your wireless router DHCP client list)
4. Open up /etc/network/interfaces:
$ sudo vim.tiny /etc/network/interfaces
You'll see few lines of basic configuration:
auto lo
iface lo inet loopbackiface eth0 inet dhcp
allow-hotplug wlan0iface wlan0 inet dhcpwpa-conf /etc/wpa_supplicant/wpa_supplicant.confiface default inet dhcp
5. Then open up /etc/wpa_supplicant/wpa_supplicant.conf:
$ sudo vim.tiny /etc/wpa_supplicant/wpa_supplicant.conf
Just copy and paste below script inside that file:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdevupdate_config=1network={ssid="YOURSSID"psk="YOURPASSWORD" 
# Protocol type can be: RSN (for WP2) and WPA (for WPA1)proto=WPA 
# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)key_mgmt=WPA-PSK 
# Pairwise can be CCMP or TKIP (for WPA2 or WPA1)pairwise=TKIP 
#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)auth_alg=OPEN 
}
Change ssid, psk, proto, key_mgmt, pairwise and auth_alg according to your wireless router setup.

6. And after you finished, reboot the pi:
$ sudo reboot
7. Upon booting, unplug ethernet cable and try to access your Pi via wireless connection (check the IP from your wireless router DHCP client list)

Just repeat the steps if you still haven't seen your Pi in the DHCP client list.