Showing posts with label apple. Show all posts
Showing posts with label apple. Show all posts

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.

Tuesday, April 17, 2012

Want to access Simplenote from Vim? Use Vimplenote!

If you're the person who always logging anything like I do, probably you should try Simplenote , "easy way to keep notes, lists, ideas, and more" -- that's what they say in their website :)

For me, the ubiquity to using their service in many platform is their advantage. As a vim user, fortunately there are already many plugins to support my need in using Simplenote service, and one of them is Vimplenote

One reason for choosing Vimplenote than another plugins is because it's the easiest one to configure. I also using Vundle, Vim package manager to install and manage my vim plugins.

Enough said, just follow my steps to do it:
1. I prefer clean install, so move your ~/.vim and archive it
$ mv ~/.vim ~/.vim-bk
2. Create new ~/.vim and ~/.vim/bundle (to contain your plugins)
$ mkdir -p ~/.vim/bundle
3. Setup Vundle
$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
4. Configuring .vimrc
 set nocompatible               " be iMproved
 filetype off                   " required!

 set rtp+=~/.vim/bundle/vundle/
 call vundle#rc()

 " let Vundle manage Vundle
 " required! 
 Bundle 'gmarik/vundle'

 " My Bundles here:
 "
 " original repos on github
Bundle 'mattn/vimplenote'
Bundle 'mattn/webapi'
 " ...

 filetype plugin indent on     " required! 
 "
 " Brief help
 " :BundleList          - list configured bundles
 " :BundleInstall(!)    - install(update) bundles
 " :BundleSearch(!) foo - search(or refresh cache first) for foo
 " :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
 "
 " see :h vundle for more details or wiki for FAQ
 " NOTE: comments after Bundle command are not allowed.. 
5.  Get webapi-vim and vimplenote-vim
$ git clone git://github.com/mattn/webapi-vim.git ~/.vim/bundle/webapi
$ git clone git://github.com/mattn/vimplenote-vim.git ~/.vim/bundle/vimplenote
6. Running and installing bundle
$ vim
:BundleInstall
7. Using Vimplenote (do it inside vim)
:Vimplenote -l     " list of your Simplenote notes (you'll be prompted to fill in login credentials)
:Vimplenote -d    " delete your current note
:Vimplenote -n    " create new note
:Vimplenote -u    " update current note
:Vimplenote -t     " add a tag to a note
:Vimplenote -s    " search a note
And you're good to go :)

You can also see the README file in every plugin page to see additional info.

Thursday, October 13, 2011

SSL Certificate Errors on MacOS X

Credit goes to loopkid, for I only put several parts that I used into my blogpost.

Last time I tried to wget a libnotifyperl.pl file from the web, I got this error:


The workaround is by installing curl-ca-bundle using MacPorts:
$ sudo port install curl-ca-bundle
Then, create .wgetrc file in your home directory:
$ vim ~/.wgetrc
And put this line:
CA_CERTIFICATE=/opt/local/share/curl/curl-ca-bundle.crt
That way, you don't need to include the path everytime you want to do a wget.


Friday, August 26, 2011

Installing Installous Using Cydia

Here's how to get Installous from Cydia:
1. Your iOS device must already been jailbreak, you can see here for my blogpost about jailbreak-ing iOS device
2. Open up Cydia
3. If you open it up for the first time, choose "Developer" mode
4. Once it loaded, click "Manage" then choose "Source"
5. Click 'Edit' then 'Add'
6. Type in: "cydia.hackulo.us" (withou quotation marks), and click on "Add Source" button
7. There would be popup shown, wait for the process to finish, then click "Back to Cydia" button
8. Click "Search" then type "Installous"
9. When the search listing its results, choose Installous 4 then install
10.  Now you have Installous installed on your iOS device :)

Friday, August 19, 2011

#webOS: How to remove EXT3FS partition

I assume you already tried to run UbuntuChroot on your #webOS device, and now you'd like to get back any space taken by EXT3FS. Here's simple thing you can do:
1. Connect your webOS device to your PC
2. Open up Terminal (Mac/ Linux) or Command Prompt (Windows), then type "novaterm"
3. And after you presented by your webOS device's root shell, run this command:
a. Unmount EXT3FS partition:
# umount /dev/mapper/store-ext3fs
b. Remove EXT3FS partition:
# lvremove /dev/mapper/store-ext3fs


4. Then run meta-doctor to re-assign all space to user's diskspace


Or, if you already do Meta-Doctor first, like I did :p , you can follow these steps:
1. Connect your webOS device to your PC
2. Open up Terminal (Mac/ Linux) or Command Prompt (Windows), then type "novaterm"
3. And after you presented by your webOS device's root shell, run this command:
a. Display LV size of EXT3FS partition, don't forget to write that down:
# lvdisplay /dev/mapper/store-ext3fs
b. Remove EXT3FS partition:
# lvremove /dev/mapper/store-ext3fs
c. Display existing user diskspace partition:
# df -kh

d. Unmount existing user diskspace partition:
# umount /dev/mapper/store-media
e. Resize existing user diskspace by adding size of previous EXT3FS partition:
I'm using /etc/fstab to see the filesystem of user's diskspace and /proc/partitions to see total allocation for user's diskspace:



# resizefat /dev/mapper/store-media 6995968K

And here's what you've got on user's diskspace after everything is done:


Enjoy! :)

Friday, July 8, 2011

Show hidden files in Mac OS X Finder

While accessing my #webOS device, there comes a time when I need to show hidden files. But you can't find anywhere in the menu, just like you did with Folder Properties in Windows operating system. All you have to do is simple, using Terminal apps. Here's what you have to do:

1. Open Terminal apps
2. Type this command:
$ defaults write com.apple.finder AppleShowAllFiles TRUE
$ killall Finder
And suddenly you'll find changes in your Finder. If you ever want to get the already-revealed hidden files to default, just type the same command as above and change TRUE to FALSE:
$ defaults write com.apple.finder AppleShowAllFiles FALSE
$ killall Finder


Tuesday, June 21, 2011

Using tcpdump in Mac OS X

This is just notes taken for personal use on which options used in tcpdump command:
# sudo tcpdump -i en0 -vvv -K -n -s 0 -w ~/Desktop/DumpFile.dmp

or without -K option:
# sudo tcpdump -i en0 -vvv -n -s 0 -w ~/Desktop/DumpFile.dmp
If you want to stop it from capturing, just press control-c. And to view the file:
# sudo tcpdump -s 0 -n -e -x -vvv -r ~/Desktop/DumpFile.dmp

Here's options explanation using in command above:
-i     interface
-vvv     even more verbose output
-K     don't attempt to verify TCP, UDP and IP checksums
-n     don't convert addressed to names
-s     snaplen settings. setting snaplen to 0 means use the required length to catch whole packets
-w     write the raw packets to file rather than parsing and printing them out
-x     when parsing and printing, in addition to printing header of each packet, print the data of each packet (minus its link level header) in hex
-r     read packets from file

Tuesday, June 14, 2011

Running Winbox in Snow Leopard

My everyday work are sometime using winbox to configure and manage routerboard device which running MikroTik OS, while using MacBook Pro, I need to prepare the environment since winbox are meant to be run on Windows environment. I can use either Darwine or wine package from macports, and I chose to use macports, since I'm more used to CLI environment.

All you need to do is:
1. choose the package according to Mac OS X version, download and install from here
2. for snow leopard (64-bit), you should install wine-devel instead of wine package, and add +universal
#  sudo port -v install wine-devel +universal

3. then you should be able to run winbox.exe from terminal
# /opt/local/bin/wine winbox.exe

4. you can also download this package, put it in your Applications and just double-click to run it

For complete references on other Mac OS X version, see here

Wednesday, June 8, 2011

Hardcoded .srt Subtitle Into A Video Files in Mac OS X

The situation is like this, I have a bunch of download movie (in .avi format) and .srt (subtitles) files along with all of those movie files. Since I don't have much time to watch the movies in my Mac/ PC or player, I want to keep it in my Palm Pre, so I can play it any moment I have some times (while waiting, perhaps). But since video player in Palm Pre doesn't support displaying .srt file while playing the video files, I have to convert it and hardcoded the .srt file so it could "attach" to the converted video files (.mp4 or .m4v, the same format that can be played in iPhone's or Palm Pre's video player).

Here's what you need:
1. Perian (go here to download and install if you haven't already installed it)
2. Quick Time (already installed in any Mac OS X)
3. .avi and .srt files (of course! :D )

And here's what you've got to do:
1. Install Perian
2. Go to System Preferences, open up the Perian and make sure you check "Load External Subtitles" on Subtitle Options section
3. Launch Quick Time and open up .avi file
4. If it plays well and your subtitle can show up then Perian works well
5. File - Save as.. and you can choose the directory where to save the file and file format



6. I choose iPhone format, so it saved as .m4v file
7. Done :)

Friday, May 27, 2011

Accesing #webOS Device via WiFi using SFTP Client

I'm using this because I'm tired of connecting USB cable everytime I want to copy files between my Palm Pre and my MacBookPro. Actually there's only 5 simple steps to follow:

  1. Install Preware
  2. Use Preware to install SFTP and terminal application
  3. Use terminal application to generate keys for OpenSSH
  4. Transfer SSH keys to desktop via USB
  5. Configure SFTP client (I'm using Cyberduck on Mac OS X) on desktop and connect
1. Install Preware
You can see here for complete reference

2. Using Preware to install SFTP and Terminal application
Still, you can refer to previous link for usage guide. FYI, I'm using SDL Terminal, other options is Terminal and Terminus

3. Use terminal application to generate keys for openSSH
I just did these steps:
# cd /
# /opt/bin/ssh-keygen (press Enter key once to accept default filename, then Enter key twice for blank password)
# mv /home/root/.ssh/id_rsa.pub /home/root/.ssh/authorized_keys

Or you can read from wiki here

4. Transfer SSH keys to desktop via USB
First, run this command:
# mv /home/root/.ssh/id_rsa /media/internal/

Then connect your Pre to your desktop station via USB cable, and put it in Drive mode. Copy and save id_rsa file you've just copied to any safe place in your desktop station

5. Configure SFTP client on desktop and connect
First,you need to know your IP address on your Pre. Open Wifi and tap on current Wifi connection (SSID) to view the IP address.
Then, open your SFTP client. Since I'm using Cyberduck, for now I'm just explaining about how to use it on Cyberduck only. But, actually the steps are very similar on any SFTP client. 
1. Click on Open Connection
2. Choose SFTP (SSH File Transfer Protocol).
3. Fill in username: root
4. Leave the password blank
5. More options -> check "Use Public Key Autentication"
6. Click Connect

Just wait and see :D

Monday, May 23, 2011

Workaround to Run SPSS 17 on Snow Leopard

You have to installed Leopard version of  JRE 1.5, like I post in previous blog post before doing these steps. After installing SPSS 17 and JRE 1.5 on Snow Leopard, open edit 2 files system:

1.  /Applications/SPSSInc/Statistics17/SPSSStatistics17.0.app/Contents/bin/jvmcfg.ini
# vim /Applications/SPSSInc/Statistics17/SPSSStatistics17.0.app/Contents/bin/jvmcfg.ini
Comment this line (put semicolon in front of this line):
jvm_lib_path1=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Libraries/
and add this line (to change the previous commented line):
jvm_lib_path1=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Libraries/
2. /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist


# sudo vim  /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist
Find this line:
"com.spss.SPSSStatistics.17.0"
"17.1"
and change 17.1 to 17.0
That's all you need to do.  This workaround makes me run SPSS 17 smoothly on my MacBook Pro :)

Sunday, May 22, 2011

Installing JRE1.5 on Snow Leopard

This JRE workaround was I did to make SPSS 17 runs well on Snow Leopard, in order to make things clearer, I divide those 2 things and put each of them on separate blog post. So let's get started! :)


Just follow this simple steps, and in the end you'll get JRE1.5 installed. Please keep in mind that this steps will not remove JRE1.6, but add the option to choose with JRE you'd like to use. First you can go to Finder -> Utilities -> Java Preferences, and check to make sure you only have Java SE 6 there (32-bit and 64-bit version). If you already have J2SE 5.0 (32-bit and 64-bit), just move 32-bit version to top of the list and you're done. No need to follow these steps below :D


1. Check your current version of JRE installed:
# java -version
2. change directory to home directory
# cd ~/
3. retrieve JRE version for Leopard (OS X 10.5.x)
# curl -o java.1.5.0-leopard.tar.gz http://www.cs.washington.edu/homes/isdal/snow_leopard_workaround/java.1.5.0-leopard.tar.gz
4. extract the file you just downloaded

# tar -xvzf java.1.5.0-leopard.tar.gz
5. remove existing 1.5 version file on Snow Leopard

# sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/1.5
6. remove existing 1.5.0 version file on Snow Leopard

# sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
7. move current extracted JRE1.5 for Leopard to existing System directory

# sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard
8. make link from currently moved folder to previously removed file

# sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard /System/Library/Frameworks/JavaVM.framework/Versions/1.5
9. same usage as no. 8
# sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
And after you done with all 9 steps above, just go to Finder -> Utilities -> Java Preferences.



There you'll see additional J2SE 5.0 (32-bit and 64-bit), move J2SE 5.0 32-bit version to top of the list, close the preferences, then go back to Terminal apps to execute this command:
# java -version
Notice the differences? You'll now get the "java version 1.5.0_19" (in my MacBook Pro). And you're done :)

Friday, May 20, 2011

Jailbreaking FU iOS Device

I put the title, so I am aware that what I'm about to write here works on almost any iOS device (which I already tried the same way for iPhone 3G/s and 1st generation of iPad). After reading on several blogs, and tried it on my iOS device myself, I choose the method using redsn0w. All you need to do first is make sure that newest update iOS version already been able to jailbreak, and all requirement files are downloaded and ready to use.

Actually you only need 2 files, redsn0w (mac and/or windows) and .ipsw files according to which version of iOS device you want to jailbreak. After you get those two files, execute redsn0w, choose the .ipsw files, check only at "Install Cydia", then just follow onscreen instruction at redsn0w window. That's it! :) And after rebooted, you'll find Cydia icon in your launcher.

Here are some of the snapshot I took, when jailbreak iPhone 3G:




Monday, August 9, 2010

Using Mutt for Gmail on Mac OS X

First, you have to install Macports, then install mutt with all these compile options:
# sudo port -v install mutt-devel +ssl +smtp +date_conditional +deepif +gdbm +gpgme +headercache +idn +sidebar +trash +sasl
Then, on your .muttrc file, add these config:








--- begin of configuration ---

#account settings
set from="YOUR_GMAIL_ADDRESS"
set realname = "REAL_NAME"
set imap_user = "YOUR_GMAIL_ADDRESS"
set imap_pass = "PASSWORD"
set smtp_url = "smtp://GMAIL_USERNAME@smtp.gmail.com:587"
set smtp_pass = "GMAIL_PASSWORD"
 
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set trash = "imaps://imap.gmail.com/[Gmail]/Trash"
set record = "+[Gmail]/Sent Mail"
set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates
 
set move = no  #Stop asking to "move read messages to mbox"!
set imap_keepalive = 900
 
# Header related stuff
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
 
ignore *
unignore from: date subject to cc
unignore x-mailing-list: posted-to:
unignore x-mailer:
 
# Sorting, Markers etc.
set markers=no # don't put '+' at the beginning of wrapped lines
set pager_index_lines= 10 # how large is the index window?
set sort = 'threads'
set sort_aux = 'last-date-received'
 
# Set which Editor to use for composing Emails.
set editor= '/usr/bin/emacs'
 
# set up the sidebar
set sidebar_width=24
set sidebar_visible=yes
set sidebar_delim='|'
set sidebar_sort=no
 
# which mailboxes to list in the sidebar,
# you can add your Labels in Gmail to the Sidebar.
mailboxes =All\ Mail =INBOX =Drafts =Sent\ Mail  =Trash
 
# color of folders with new mail
color sidebar_new yellow default
 
#Sidebar Navigation
bind index \CP sidebar-prev
bind index \CN sidebar-next
bind index \CO sidebar-open
bind pager \CP sidebar-prev
bind pager \CN sidebar-next
bind pager \CO sidebar-open
 
# b toggles sidebar visibility
macro index b 'toggle sidebar_visible'
macro pager b 'toggle sidebar_visible'
 
# Remap bounce-message function to "B"
bind index B bounce-message
 
#make mutt colorful!
color attachment brightmagenta default
color error      brightred    default
color hdrdefault red          default
color indicator  brightyellow red
color markers    brightcyan   default
color message    brightcyan   default
color normal     default      default
color quoted     brightblue   default
color search     default      green
color signature  red          default
color status     yellow       blue
color tilde      magenta      default
color tree       magenta      default
--- end of configuration ---











On these line, you can customize it to use other file editor such as vi or vim. Since I'm not familiar with emacs, I'm using vi :)

# Set which Editor to use for composing Emails.
set editor= '/usr/bin/emacs'




And in these line, you can add/ remove any IMAP folders you already set on Gmail, prefix it with '=' :







# which mailboxes to list in the sidebar,
# you can add your Labels in Gmail to the Sidebar.
mailboxes =All\ Mail =INBOX =Drafts =Sent\ Mail  =Trash













You will be prompted to accept 2 certificates when first firing up mutt, just accept it. Here's a screenshoot of my mutt interface:




Sunday, August 8, 2010

Several MacPorts Commands

Here is several MacPorts commands that I often used, with little description on every command. I always use -v option (as in verbose), to look at the detail downloading and compiling process.


1. sudo port -v selfupdate
- removing and downloading new file repository list, often updated

2. sudo port -v upgrade outdated
- upgrade outdate port, according to newest file repository list

3. sudo port -v uninstall inactive
- even after update, macports still kept the outdated version, you can execute this command to automatically vanish outdated version immediately

3. sudo port -v search [port]
- used for looking certain port

4. sudo port -v install [port]
- install certain port

5. sudo port -v uninstall [port]
- uninstall certain port

6. sudo port -v clean --all [port]
- clean up all port build and dependencies

7. sudo port -v activate [port@version]
- activate certain port version

8. sudo port -v installed
- shows up all port installed

Monday, August 2, 2010

Test AUTH SMTP Connection

Lengkapnya bisa diliat di link ini: http://qmail.jms1.net/test-auth.shtml. Saya coba summaries cara mudahnya sbb:

1. Create dulu base64 encode dari email address dan password kita:

$ perl -MMIME::Base64 -e 'print encode_base64("\000[mailbox]\@[domain]\000[password]")'

contoh:
$ perl -MMIME::Base64 -e 'print encode_base64("\000kostka\@cbn.net.id\000passkostka")'
AGtvc3RrYUBjYm4ubmkAGNibm00MWxndTM=


2. menggunakan telnet-ssl

$ telnet-ssl -z ssl smtps.cbn.net.id 465
Trying 210.210.145.21...
Connected to smtps.cbn.net.id.
Escape character is '^]'.
220 mx-corp3b.int.cbn.net.id ESMTP
ehlo cbn.net.id
250-mx-corp3b.int.cbn.net.id Hello cheyenne.cbn.net.id [202.158.50.81]
250-SIZE 10485760
250-PIPELINING
250-AUTH PLAIN LOGIN
250 HELP
auth plain AGtvc3RrYUBjYm4ubmkAGNibm00MWxndTM=
235 Authentication succeeded
mail from: kostka@cbn.net.id
250 OK
rcpt to: tslan@cbn.net.id
250 Accepted
data
354 Enter message, ending with "." on a line by itself
test ke-2 :)
.
250 OK id=1Obqkv-0004Qq-Nf


3. menggunakan openssl

$ openssl s_client -connect smtps.cbn.net.id:465
CONNECTED(00000003)
--- edited for security purposes ---
---
220 mx-corp3e.int.cbn.net.id ESMTP
ehlo cbn.net.id
250-mx-corp3e.int.cbn.net.id Hello cheyenne.cbn.net.id [202.158.50.81]
250-SIZE 10485760
250-PIPELINING
250-AUTH PLAIN LOGIN
250 HELP
auth plain AGtvc3RrYUBjYm4ubmkAGNibm00MWxndTM=
235 Authentication succeeded
mail from: kostka@cbn.net.id
250 OK
rcpt to: tslan@cbn.net.id
250 Accepted
data
354 Enter message, ending with "." on a line by itself
test kirim email via telnet ke smtps cbn :)
.
250 OK id=1ObqiT-000103-Kk

Thursday, July 22, 2010