Getting Markdown Viewer To Display HTML Formatted Markdown Content in Firefox Under Linux

I recently installed the Markdown Viewer 1.3 in Firefox 23.0 under Fedora Core  18.  When I went to open a .md file in the browser it prompted me to download it.

To configure Firefox to display the markdown in the browser do the following:

Edit the ~/.mozilla/firefox/*default/mimeTypes.rdf file.

If there is not yet an existing RDF node for ‘text/plain’ add it, and add “md” as a file extension.

<RDF:Description RDF:about=”urn:mimetype:text/plain”
        NC:value=”text/plain”
        NC:fileExtensions=”md”
        NC:description=”Text Document”>
    <NC:handlerProp RDF:resource=”urn:mimetype:handler:text/plain”/>
</RDF:Description>

Internet Explorer Not Deleting Session Cookies

If you are trying to delete session cookies, those cookies with an expires or max-age value of -1 or no value set for that property, in Internet Explorer, you will probably notice that deleting them from the controls in the browser, does not actually delete them.

Evidently, the IE cookie implementation only writes persistent cookies to the file system and maintains the session cookies in RAM.  Moreover, when telling the browser to delete the cookies, it only deletes the cookies from the file system and does not delete them from RAM.

To delete session cookies in IE, you will need to restart the browser.

Use CookieSpy to View and Manage Internet Explorer 9 Cookies on Windows 7

I am doing some client-side testing of IE 9 on Windows 7 and need to be able to view cookies and their associated data.

The F12 developer tools is insufficient for this task as using the Cache/View cookie information selection only shows the cookies for the current domain that you are browsing in the current tab.

Moreover, when going to Internet Options, General Tab, clicking on the Settings button under ‘Browsing History’, and then clicking on the ‘View files’ or ‘View objects’ button does not show the cookie files.

I ended up installing CookieSpy and with it am able to easily view and manage the cookies for all of the (supported) browsers on the machine.

Automate the Download of Windows VMs for Testing IE6, IE7, IE8, IE9, IE10 and IE11 with ievms

I am working on some client-side Javascript and I need to be able to test it in all of the currently extant versions of Internet Explorer.  A collegue of mine pointed me to the ievms project by Greg Thornton (xdissent) that automates the download of multiple Windows vms provided by Microsoft to facilitate testing in multiple versions of IE.

https://github.com/xdissent/ievms

To get it working under Fedora (RedHad, CentOS):

   . The script requires unar but is not readily available for FC18.  I found a page that indicated 7za provided by p7zip works to unzip the large VM files.
   . cd /
   . Installed p7zip:
      . # yum install p7zip
   . Modified the ievms.sh:

# Check for the `unar` command, downloading and installing it if not found.
check_unar() {
    if [ “${kernel}” == “Darwin” ]
    then
        hash unar 2>&- || install_unar
    else
        #
        # Commented out to use 7za instead
        #
        # hash unar 2>&- || fail “Linux support requires unar (sudo apt-get install for Ubuntu/Debian)”
        echo “using 7za . . . “
    fi
}

    log “Checking for existing OVA at ${ievms_home}/${ova}”
    if [[ ! -f “${ova}” ]]
    then
        download “OVA ZIP” “${url}” “${archive}”

        log “Extracting OVA from ${ievms_home}/${archive}”
        #
        # Use 7za instead of unar
        #
        # unar “${archive}” || fail “Failed to extract ${archive} to ${ievms_home}/${ova}, unar command returned error code $?”
        7za e “${archive}” || fail “Failed to extract ${archive} to ${ievms_home}/${ova}, unar command returned error code $?”
    fi

Services That Can Be Turned Off in a CentOS 6, Minimal Server

Following is a list of services that can (for most applications) be turned off if you are setting up a bare-bones CentOS 6.4 server:

Automatic bug reporting services:
abrt-ccpp
abrt-oops
abrtd

Power control and features, query battery and config status
acpid

Controls ‘at’ command queing, examining, or deleting jobs for later execution.  Anything atd can do, cron can do
atd

File auditing
auditd

Auto fs mounting
autofs

Printing
cups

For desktop environments:
netfs

Network filesystems:
nfslock
rpcbind
rpcgssd
rpcidmapd

MTA
postfix

ip6tables

Sends anonymized usage stats:
udev-post

Setting Up Passwordless SSH Under CentOS 6 Running Selinux

I am setting up a cluster of KVM virtual machines and want to be able to ssh to them as the root user on the vm without having to enter a password.

The first thing that I did was create keys on the box from which I was going to make connections (A):

[rchapin@A .ssh]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/usr/local2/home/rchapin/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /usr/local2/home/rchapin/.ssh/id_rsa.
Your public key has been saved in /usr/local2/home/rchapin/.ssh/id_rsa.pub.
The key fingerprint is:
6a:ca:57:31:23:30:67:8c:9d:de:78:53:14:90:16:6e rchapin@A
The key’s randomart image is:
+–[ RSA 2048]—-+
|     + .o=o.     |
|    + *.o .      |
|     * +E.       |
|      +.B        |
|       oS=       |
|       ..        |
|      o.         |
|   . o.          |
|    o.           |
+—————–+

After which I scp the id_rsa.pub file to the remote box

[rchapin@A ~]$ scp ./id_rsa.pub root@B:/root/

Then ssh to the remote box, create the ~/.ssh directory, copy the contents of the id_rsa.pub file into ~/.ssh/authorized_keys and set the permissions on all of the files.

[root@B ~]# mkdir .ssh
[root@B ~]# chmod 700 .ssh
[root@B ~]# cat ~/id_rsa.pub > authorized_keys
[root@B ~]# chmod 600 authorized_keys

The first problem was that it wasn’t accepting the key and was giving me the password prompt.

After a quick search regarding passwordless ssh and Selinux I did the following:

[root@B .ssh]# restorecon -R -v /root/.ssh/
restorecon reset /root/.ssh context unconfined_u:object_r:admin_home_t:s0->unconfined_u:object_r:ssh_home_t:s0
restorecon reset /root/.ssh/authorized_keys2 context unconfined_u:object_r:admin_home_t:s0->unconfined_u:object_r:ssh_home_t:s0

Now I received the error:

[rchapin@A .ssh]$ ssh root@B
Agent admitted failure to sign using the key.

Another quick search and all I had to do was add the key on the A box and I was all set

[rchapin@A.ssh]$ ssh-add
[rchapin@A.ssh]$ ssh root@B
Last login: Thu Aug 22 20:40:54 2013 from A
[root@B ~]#

Splitting a String into an Array with a Custom Delimiter in a Bash Shell Script

Most high level languages have some sort of String.split([delimiter]) method to create an array of Strings tokenized by a user specified delimiter.  This is a simple way to convert a CSV into an array.

Here is a quick way to do that in a bash shell script:

#!/bin/bash

SOURCE_STRING='foo|blah|moo'
# Save the initial Interal Field Separator
OIFS="$IFS"
# Set the IFS to a custom delimiter
IFS='|'

read -a TOKENS <<< "${SOURCE_STRING}"
for i in "${TOKENS[@]}"
do
  echo "$i"
done

# Reset original IFS
IFS="$OIFS"