Category Archives: How-to Guides

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 Sublime Text 3 on RHEL / Fedora


Here’s another three step guide to installing Sublime Text 3 on RHEL 6,7 / Fedora 18, 19, 20:-

  1. Download the installation script from the following gist.
    https://gist.github.com/sayak-sarkar/11b039f398ddcae88139
  2. Extract it to your home directory [or anywhere you like].
    $tar -xvf gist11b039f398ddcae88139-e339084ef22e956ea6ef8d04f8279ca70772f534.tar.gz
  3. Open your terminal (preferably as super user), navigate to your home directory and execute the shell script.
     #./sublime-text-3.sh

Voila!! You now have Sublime Text 3 installed on your machine. You may run it from the terminal or via the alt+f2 shortcut by simply typing in “sublime”.

Based upon my previous post on How to install Sublime Text 3 on Fedora. 😉

Enjoy!! 🙂

Creating scrollable Charts using Angular-Kendo


Creating Scrollable Charts:

Horizontal scrolling of Charts is not supported out of the box in Kendo UI, however it can be achieved using a bit of custom styling.

Basic steps:

  • Set overflow: auto of the <div class="chart-wrapper">;
  • Set width of the aforementioned div;
  • Set width of the <div id="chart"> to a value higher than it’s parent div width size.

Example piece of code:

Template:

<div class="parent-container">
  <div kendo-chart k-options="line" class="chart-container">
  </div>
</div>

CSS:

.parent-container {
    overflow-y: scroll; 
    width: 1000px;
}

.chart-container {
    overflow: auto; 
    width: 2000px;
}

Installing Android on the Geeksphone Keon


Here’s a clean, clear and to the point english post on how to install Android on your Geeksphone Keon developer device:-

Android on Keon

STEPS:-

  1. If you don’t already have adb and fastboot installed on your system:-
    1. Get the packages from here.
    2. Extract the contents of the zip file and navigate to the adbfastbootmac directory [Note: This package works on macs, if you are using Linux or any other operating system, a simple online search should help you figure out how to get adb and fastboot]
  2. On your Keon go to ‘Settings’ -> ‘Device Information’ -> ‘More Information’ -> ‘Developer’. From the list of checkboxes, enable the ‘Remote debugging’ checkbox.
  3. Connect your device to your computer using the USB cable.
  4. Back on your computer’s terminal do the following:-
    1. If you are using the package mentioned above, run ‘./adb devices’
    2. You should see a device named ‘full_keon’ as a part of the output. If you don’t see it listed out there, try reconnecting your device or check whether the Remote Debugging option is enabled.
  5. Now let’s get down to the magic:-
    1. Download and store the following zip packages to you device’s SD-Card:-
      1. TWRP recovery
      2. Android ICS ROM for Keon
      3. Google Apps
      4. Additional Ring Tones
    2. Start the Keon in the fastboot mode :
      # ./adb reboot-bootloader
    3. Install the new recovery :
      # ./fastboot flash recovery TWRP-GK.img
    4. Boot the recovery :
      #./fastboot boot TWRP-GK.img
    5. On the device’s screen now tap on ‘Backup’ to create a backup of Firefox OS.
    6. Once done, tap on ‘Wipe’ → ‘Swipe to Factory Reset’.
    7. ‘Install’ (select the ROM) → ‘Add More Zips’ (select the Google Apps and Additional Ringtones zip files) → ‘Swipe to Confirm Flash’.
    8. ‘Wipe Dalvik and Cache’.
    9. Tap on ‘Reboot System’.
  6. Voila! You’ve now successfully installed Android on your Geeksphone Keon device.

NOTES:-

  1. Make sure that the device has at least 50% battery power before commencing with the process.
  2. Since the Keon has only one soft touch button on it, it is mapped to the back functionality. If you want to use all three default Android soft-buttons, the easiest way to do that would be to install the “SoftKey Enabler” app from the Android Play Store.

SWITCHING BACK TO FIREFOX OS

If you now want to switch back to Firefox OS, all you need to do now is as follows:-

  1. Turn off your device.
  2. Press the power and the volume up buttons of the Keon at the same time to boot into the Team Win Recovery image.
  3. Tap ‘Restore’ and select the backup file created earlier during the Android setup, and confirm.
  4. Once the process completes, you should be able to use Firefox OS again! 🙂

DISCLAIMER: Please note that the steps I’ve mentioned here are what I followed to try out Android on a couple of my Keons. These steps involve flashing the device, hence involve a very real risk of ending up with a bricked [dead] phone. As such, go about the process at your own risk. I’m in no way liable for any unforeseen results coming out of this process.

References:

  1. http://sys.nodo21.org/geeksphone-keon-rom
  2. http://forum.geeksphone.com/index.php?topic=5672.msg60983#msg60983

 

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! 🙂

Installing Skype on Fedora 18 / 19 / 20


Here’s a list of command line steps to install Skype on Fedora 19:-

Step 1: Open up the terminal and switch to super user:

$su –

Step 2: Install the dependencies:

yum install alsa-lib.i686 fontconfig.i686 freetype.i686 glib2.i686 libSM.i686 libXScrnSaver.i686 libXi.i686 libXrandr.i686 libXrender.i686 libXv.i686 libstdc++.i686 pulseaudio-libs.i686 qt.i686 qt-x11.i686 qtwebkit.i686 zlib.i686

Step 3: Download Skype 4.2 Dynamic package for Fedora into /tmp:

cd /tmp
wget –trust-server-names http://www.skype.com/go/getskype-linux-dynamic

Step 4: Extract the Skype 4.2 package to /opt:

mkdir /opt/skype
tar xvf skype-4.2* -C /opt/skype –strip-components=1

Step 5: Create Launcher, Link icons, language and sounds:

ln -s /opt/skype/skype.desktop /usr/share/applications/skype.desktop
ln -s /opt/skype/icons/SkypeBlue_48x48.png /usr/share/icons/skype.png
ln -s /opt/skype/icons/SkypeBlue_48x48.png /usr/share/pixmaps/skype.png

touch /usr/bin/skype
chmod 755 /usr/bin/skype

Open /usr/bin/skype with text editor and add following content:

#!/bin/sh
export SKYPE_HOME=”/opt/skype”

$SKYPE_HOME/skype –resources=$SKYPE_HOME $*

Step 6: Congratulate yourself! You have successfully installed a non-free proprietary software on top of free Open Source software and bent down to corporate needs. Now go ahead and configure Skype according to your needs!

Sigh! :-/

Installing Sublime Text 2 on Fedora 18 / 19 / 20


Here’s another three step guide to installing Sublime Text 2 on Fedora 19 – Schrodinger’s Cat:-

  1. Download the installation script from the following gist.
    https://gist.github.com/sayak-sarkar/5810101
  2. Extract it to your home directory [or anywhere you like].
    $tar -xvf gist5810101-3b0e9bb3ef5128760df9e3e06877fa4f7e5689ec.tar.gz
  3. Open your terminal (preferably as super user), navigate to your home directory and execute the shell script.
     #./sublime-text-2.sh

Voila!! You now have Sublime Text 2 installed on your machine. You may run it from the terminal or via the alt+f2 shortcut by simply typing in “sublime-text”.

Credits to Henrique Moody for the original script gist!!
I’ve simply added a symbolic link at /usr/bin to enable terminal execution. 😉

Enjoy!! 🙂

Installing VLC player on Fedora 18 / 19 / 20


Here’s a simple three step guide to installing VLC media player on Fedora 19 [Schrodinger’s Cat]:-

  1. Login as Super User:
    • $su
  2. Setup rpmfusion:
  3. Install vlc using the default yum package manager:
    • #yum install vlc mozilla-vlc

Voila! You now have VLC media player installed on you computer! 🙂

Installing Microsoft TrueType Fonts in Fedora18 / 19 / 20


This is something that I just learned how to do, courtesy of a documentation work that I need to for my college’s fourth semester evaluations, where the requirements state that I need to use Arial / Verdana fonts for my Project Report. The interesting part is that I’m a hardcore Fedora user who uses LibreOffice for all my documentation purposes and as obvious as it may sound, these fonts don’t come pre-installed in Fedora 18. Du-uh? Right? So, I had to distinctly install these fonts on my laptop. How did I do it? Here’s the breakdown.

First here’s a bit of a trivia for those who already don’t know this! (Read: Yack):

Microsoft TrueType fonts (TTFs) are quite commonly found throughout the web, usually specified in stylesheets. However, for Linux users, the most common of these TTFs don’t come pre-installed in most of the common distributions by default. Instead, they are replaced by generic equivalents, usually fallback fonts most commonly defined in stylesheets (again!). This is also true even case of offline documents such as spreadsheets, presentations, or plain .doc files.

Installing TrueType font packages allow you to see content created using these fonts just as the content creator originally intended.

The Microsoft TrueType fonts package includes the following font-families:

  • Andale Mono
  • Arial Black/Arial (Bold, Italic, Bold Italic)
  • Comic Sans MS (Bold)
  • Courier New (Bold, Italic, Bold Italic)
  • Georgia (Bold, Italic, Bold Italic)
  • Impact
  • Times New Roman (Bold, Italic, Bold Italic)
  • Trebuchet (Bold, Italic, Bold Italic)
  • Verdana (Bold, Italic, Bold Italic)
  • Webdings

And here’s the part on how to install these fonts! (Read: Hack):

You can install the MS core fonts by installing the msttcorefonts package. Here’s how to do it. The gist describes what to do, and the commands explain how to do using the Terminal. You may need superuser privileges or sudo configured. :-

  1. Make sure you have the following rpm-packages installed. Any version should do.
    • rpm-build,
    • wget,
    • A package that provides the ttmkfdir utility. For Fedora Core, ttmkfdir should suffice.
  2. Download the latest msttcorefonts spec file from here.
  3. Install the cabextract utility.
    • sudo yum install rpm-build cabextract ttmkfdir
  4. Build the msttcorefonts-2.5-1.noarch.rpm package.
    • $ sudo rpmbuild -bb msttcorefonts-2.5-1.spec
  5. Install the fonts:
    • $ sudo yum install /root/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm
%d bloggers like this: