Blog Archives

Using Vim to generate HTML output of code


This is an interesting bit that I learnt about from an email in a mailing list by James Pryor.

To generate html output for code within a shell script you can use:

vim myscript.sh '+syntax on' '+ set nu' '+set background=light' +TOhtml '+w myscript.html' '+qall!'
If you don’t want numbers and need a dark background you can use:
vim myscript.sh '+syntax on' '+ set nonu' '+set background=dark' +TOhtml '+w myscript.html' '+qall!'

Installing EditorConfig on Sublime Text


To install Editor Config on Sublime Text all you need to do is to follow the following steps:-
  1. Go the Preferences tab -> Package Control.
  2. Select Install Package from the drop down menu.
  3. Wait for the list to load, once it loads it will show you a list of packages.
  4. Now, type in EditorConfig and select the highlighted option.

To confirm that Editor Config is installed correctly on your Sublime Text instance you can go to Preferences -> Browse Packages. If installed correctly you should be able to see an EditorConfig directory present in the Packages directory.

That’s it! Enjoy! 🙂

Installing Firefox Nightly with Australis on Fedora 18 / 19 / 20


Australis Sceenshot

Screenshot of Firefox Nightly with Australis on Fedora 19

Are you a Fedora user who wants to check out the new Australis Theme for Firefox scheduled for release with Firefox 28? However, you are a bit apprehensive of letting go that stable release of Firefox in bundled within your Fedora installation by default, just in case something goes wrong with the nightly beta release.

If this is what defines your current dilemma, fear not. You can have both the stable as well as the nightly beta versions installed simultaneously in your computer in a few simple steps without any trouble at all! Here’s how to do it in case of Firefox Nightly version 28 [the latest release at the time of writing this post]:-

Step 1: Login as Super User:-

$su

Step 2: Get the nightly package:-

Go to http://nightly.mozilla.org to get the latest available nightly build for your system.

Screenshot of Firefox Nightly Webpage

Firefox Nightly Webpage

Alternatively, you can use the command line tool wget to directly download it via the command line as follows:-

#wget http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-28.0a1.en-US.linux-x86_64.tar.bz2

Step 3: Extract the contents of the tar ball as follows:-

#tar -xvf firefox-28.0a1.en-US.linux-x86_64.tar.bz2

Step 4: Rename the extracted directory to “nightly”:-

#mv firefox nightly

Step 4: Create an installation directory:-

#mkdir /opt/firefox

Step 5: Move the contents of the “nightly” directory to the installation directory:-

#mv /nightly /opt/firefox/nightly

Step 6: Create a Symbolic link for the Nightly installation:-

#ln -s /opt/firefox/nightly/firefox /usr/local/bin/nightly

Step 7:Run Firefox Nightly by typing the following within the command line or the alt+f2 launcher:-

For command line: $nightly

For alt+f2: nightly

Step 8: Relax and enjoy the Australis awesomeness! 🙂

Running Friendlycode – A local instance of Thimble


Here is a breakdown of how to run Friendlycode in 3 (maybe not-so-simple) steps.

Friendlycode Snapshot

Friendlycode – An Offline Thimble Instance.

Prerequisite: A static file server such as Apache.

Steps:-

  1. Download Friendlycode from here.
  2. Extract the contents of the friendlycode-gh-pages package into a directory named friendlycode within your file server’s document root. For example, in Apache you might want to put the friendlycode directory inside www/html or www or public_html based upon your Operating System’s preferences.
  3. You can then run a trivial embedding of Friendlycode from your browser by navigating to the examples/bare.html file within the friendlycode directory.

    Example: http://localhost/friendlycode/examples/bare.html

Additional features in Friendlycode:-

  1. Javascript: By default, Friendlycode doesn’t allow JS. An example of an embedding that allows JS and publishes using an alternate API can be run from the examples/alternate-publisher.html file.

    Example: http://localhost/friendlycode/examples/alternate-publisher.html

  2. Localization: Friendlycode currently uses Transifex for localization. To localize Friendlycode in your language, please visit the Transifex friendlycode project. Any strings you don’t translate will fall-back to English. To try out a localized version run the examples/transifex.html file.

    Example: http://localhost/friendlycode/examples/transifex.html

  3. Development: If you are a code ninja and want to play around with the dev-repository of Friendlycode, you can checkout the excellent Readme.md file at Atul’s friendlycode repository at Github.

Debugging NO KEY warning during “yum install vlc”


This is a problem that I encountered today while tryiing to install VLC media player on my brand new Fedora 18 installation.

Right after the dependency resolutions are complete, yum returns the following warning:-

Transaction Summary
===============================================
Install 1 Package (+45 Dependent packages)

Total size: 37 M
Installed size: 118 M
Is this ok [y/N]: y
Downloading Packages:
warning: /var/cache/yum/i386/18/rpmfusion-free/packages/live555-0-0.38.2012.10.18.fc18.i686.rpm: Header V3 RSA/SHA256 Signature, key ID 982e0a7c: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-18-i386

GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-18-i386

Did a bit of snooping around over the internet and found the missing rpmfusion keys at: http://rpmfusion.org/keys and derived the following solution:-

Step by step solution to the problem [root login used]:-

  • I have already compiled the key into a single .gz file, which can be downloaded from this link: http://goo.gl/bKoyb
  • Place the .gz file in the directory: /etc/pki/rpm-gpg/
  • #cd /etc/pki/rpm-gpg/
  • #tar -xvzf RPM-GPG-KEY-rpmfusion.tar.gz
  • rm RPM-GPG-KEY-rpmfusion.tar.gz
  • #yum install vlc
  • You should get this output after dependency resolution is complete:

    Transaction Summary
    ===============================================
    Install 1 Package (+45 Dependent packages)

    Total size: 37 M
    Installed size: 118 M
    Is this ok [y/N]: y
    Downloading Packages:
    warning: /var/cache/yum/i386/18/rpmfusion-free/packages/live555-0-0.38.2012.10.18.fc18.i686.rpm: Header V3 RSA/SHA256 Signature, key ID 982e0a7c: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-18-i386
    Importing GPG key 0x982E0A7C:
    Userid : “RPM Fusion free repository for Fedora (18) <rpmfusion-buildsys@lists.rpmfusion.org>”
    Fingerprint: c63d a8f3 375c 7182 3e3a 2d42 3633 9914 982e 0a7c
    From : /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-18-i386
    Is this ok [y/N]:

  • Enter ‘y’ (without the quotes!)

Voila! VLC’s installed!

NOTE:It is highly recommended to do a ‘yum update’ after the installation procedure is complete, as it helps ensuring that the new rpm keys are standards-compliant!

%d bloggers like this: