Using SublimeText to write JSim file

50.002 Computation Structure course in SUTD requires students to write a kind of SPICE-like code using JSim, an MIT software to simulate circuit design. The editor, however, is pretty basic, and I have noticed that some students prefer to use SublimeText to write the JSim file. Here is the instruction to setup SublimeText to use with JSim.

  1. Download SublimeText.
  2. In Mac OS X, run SublimeText, press “CMD-SHIFT-P” to open the Command Palette. Otherwise, go to Menu -> Tools -> Command Palette.
  3. Type “browse packages” this will open a new Finder window with the location to install the packages.
  4. Create a new Folder called “JSim”.
  5. Download JSim syntax highlighter. Copy jsim.tmlanguage to the newly created folder “JSim”.
  6. Associate jsim extention to open with SublimeText. To do this (in Mac OS X):
    1. Find a JSim file, e.g. lab3.jsim. Right click and choose “Get Info”.
    2. Under “Open With”, choose “Sublime Text”.
    3. Click “Change All”.

UPDATE: There is some issue when using SublimeText in Ubuntu. A solution was to rename jsim.tmlanguage to jsim.tmLanguage (Note the capital “L”).


A free alternative to create Evernote notes from your email

As of July 2015, Evernote has changed its feature to create note from email to a “paid” service. Luckily, there are always alternatives. This post share with you how to do it for free using IFTTT.

  1. Create a free account with using the EMAIL that you want to use to create notes in Evernote. You will need to confirm your account by clicking the link from your email inbox.
  2. Once you are set, you can start creating recipe by clicking “Create a Recipe”  and then click “This”. create_recipeclick_this
  3. Select “Email” for your channel. trigger_channel
  4. And then select the trigger. choose_a_trigger
  5. To complete the trigger, key in the hash tag you want. You can create just one recipe with one hastag, let’s say “#evernote” or you can create multiple recipes with different hash tags. trigger_fields
  6. After that create the “Do” part. click_that
  7. Choose “Evernote” as the channel.  choose_evernote
  8. You will then have to authorize IFTTT to connect to your Evernote account by logging in to Evernote. connect_evernote
  9. Then, you can complete the action fields. In my body I chose “{{BodyHTML}}” rather than Body and I added “{{AttachmentUrl}}”. I decided to create a special Notebook to dump all my notes created from IFTTT. But as I said before, you can just create multiple recipes with different hash tags and for each hash tag you can set your notebook destination. action_fields
  10. Once, you are done, you can send email to create an Evernote note. email_evernote

Android emulator device not showing in Running Devices

Sometimes with the android virtual device running, I can’t seem to see them under the Running Devices when I click “run app”. To solve that, I need to restart my adb. To do that go to the “Android SDK/platform-tools” folder. In my case for Mac OS X, it is at:


From there I need to run the following command:

./adb kill-server
./adb start-server

Then you can check whether the device has been attached by:

./adb devices

Fixing PyInstaller on Mac Yosemite

I tried to install pyinstaller using PIP:

<code>$ pip install pyinstaller </code>

and this installed PyInstaller version 2.1, as you can check using

<code>$ pyinstaller –version</code>

When I tried PyInstaller to one of my python script, it gives me an error. I run PyInstaller in this way:

<code>$ pyinstaller</code>

Then I got the following error:

<code> struct.error: argument for ‘s’ must be a string</code>

The error is caused from a file


from line 84 and 367. To solve this, I replaced the following lines:

Line 84

<code> rslt.append(struct.pack(self.ENTRYSTRUCT + repr(nmlen) + ‘s’, nmlen + entrylen, dpos, dlen, ulen, flag, typcd, nm + pad))</code>

with the following:

<code> 84: rslt.append(struct.pack(self.ENTRYSTRUCT + repr(nmlen) + ‘s’, nmlen + entrylen, dpos, dlen, ulen, flag, typcd, nm.encode(‘utf8’) + pad)) </code>

and Line 367

<code>cookie = struct.pack(self._cookie_format, self.MAGIC, totallen, tocpos, self.toclen, pyvers, self._pylib_name)</code>

with the following:

<code>cookie = struct.pack(self._cookie_format, self.MAGIC, totallen, tocpos, self.toclen, pyvers, self._pylib_name.encode(‘utf8’)) </code>

After that, my pyinstaller works.

After msfupdate, postgresql selected, no connection

After I did a “sudo msfupdate”, somehow my msfconsole is not connected to the database. when I type:
msf> db_status
postgresql selected, no connection

So, to connect back, I need to provide the location of database.yml, as in

msf> db_connect -y /usr/local/share/metasploit-framework/config/database.yml

And it connects again. yeah. To do this everytime msfconsole is called, we can create an alias in .bashrc.

alias msfconsole='msfconsole -d db_connect -y /opt/framework/config/database.yml'

Installing Metasploit on Xubuntu 14.04

  1. Grap the script file from:
    $ wget
  2. Run the script.
    $ chmod a+x ./
    $ ./
  3. Now, by right, we can start running msfconsole, but I got some error when I tried to do so.
    $ msfconsole
    /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- /usr/local/bin/config/boot (LoadError)
    	from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    	from /usr/local/bin/msfconsole:23:in `'
  4. What I did was to edit /usr/local/bin/msfconsole line 23, and replace that line with:
    require File.expand_path('/usr/local/share/metasploit-framework/config/boot.rb', __FILE__)
  5. Make sure that the path for config/boot.rb is correct for your system.
  6. Now, when I run msfconsole again, it gives me some warning of missing permission to write some log file.
    Rails Error: Unable to access log file. Please ensure that /usr/local/share/metasploit-framework/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
  7. So I need to create the directory and make sure it is accessible.
    $ cd /usr/local/share/metasploit-framework/
    $ mkdir log
    $ chmod 777 log
  8. Now, I can run msfconsole. Before reaching the prompt, however, I got the following warning:
    [-] WARNING! The following modules could not be loaded!
    [-] 	/usr/local/share/metasploit-framework/modules/auxiliary/scanner/smb/smb_login.rb: LoadError cannot load such file -- robots

Fixing Missing “Articles from Pocket” from Library Menu in Kobo Aura

When I bought Kobo Aura eReader, I could not find Pocket from the Library Menu. It turns out that for Kobo aura from Japan, the firmware is set with different affiliate. Changing the affiliate solves the problem.

These are the steps:

  1. Connect Kobo using USB to PC
  2. Go to the hidden folder “.kobo”
  3. Inside that folder, there is a text file called “affiliate.conf”
  4. Change the value from Rakuten to KoboIndigo