Colorized diff outupt

To have a colorized version of diff, where kdiff3 isn't available, try any of the following:

$> colordiff file1 file2

$> diff -u file1 file2 | colordiff

$> diff fileA fileB | vim -R -

$> vim -d fileA fileB

$> vimdiff fileA fileB fileC fileD

Convert a column of text URLs into active hyperlinks in Excel

Create the macro as here:

On the Tools menu in Microsoft Excel, point to Macro, and then click Visual Basic Editor. On the Insert menu, click Module. Copy and paste this code into the code window of the module. It will automatically name itself HyperAdd.

Sub HyperAdd()

    'Converts each text hyperlink selected into a working hyperlink

    For Each xCell In Selection
        ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
    Next xCell

End Sub

When you're finished pasting your macro, click Close and Return to Microsoft Excel on the File menu.

Then select the required cells and click macro and click run.

NOTE Do NOT select the whole column! Select ONLY the cells you wish to be changed to clickable links else you will end up in a neverending loop and have to restart Excel! Done!

Source: http://stackoverflow.com/questions/2595692/how-do-i-convert-a-column-of-text-urls-into-active-hyperlinks-in-excel

How to Rename a Folder on Mac OS X

  1. MacOS X: Rename a file or folder by selecting it and hitting the 'return' key. (source)

Simple Formatting for Posting

A simple way to format "command line" type entries is to use the following setup:

<table style="background-color: #f3f3f3; font-family: Courier New, Courier, monospace; width:100%">
<tbody>
<tr>
<td>

Moin and Python

In MoinMoin, I can search for tag: (with colon being part of what I am searching for) by quoting it, rather than escaping.

<<FullSearch(regex:'tag:')>>

Grep usage

To only print out files ( and not each line in the file that matches the pattern), use grep -l for example:


ebdev11:shell_scripts$ find . -iname "*pl" -exec grep -l "anyone" '{}' \; -print
./run_bioconcepts_incremental.pl
./run_bioconcepts_incremental.pl
./perl/test_GTRLB.pl
./perl/test_GTRLB.pl
./update_HPO.pl
./update_HPO.pl

Remove Icon in MoinMoin before links

1. remove element in common.css and msie.css.
  • One way is to comment out / delete the respective lines in the css sheets. If you don't want the earth-icon remove
    a.www:before {content: url(../img/moin-www.png); margin: 0 0.2em;}
  • from common.css and the corresponding similar line from msie.css.
You can see the css when you hover over the icon and right-click, choosing "inspect element". You may need to do this for each of the themes (e.g. modernized, modern, etc).

http://moinmo.in/MoinMoinQuestions/Themes#Avoid_Link-Icons_on_linked_images

Date in Bash Script

To get a nice formatted date in a bash script, use:

    $(date +%F)

There is also 
 
    DATE=`date +%Y-%m-%d`

get year-month-day hour:minute:second from date
    
    DATE=`date +%Y-%m-%d:%H:%M:%S`
 
http://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script


Mirror a Website with WGET

wget -mkEpnp http://example.org

wget --recursive --no-parent --level 3 --execute robots=off -nH  example.com

===================================================

wget --mirror --convert-links --adjust-extension --page-requisites 
--no-parent http://example.org
 
Explanation of the various flags:
  • --mirror – Makes (among other things) the download recursive.
  • --convert-links – convert all the links (also to stuff like CSS stylesheets) to relative, so it will be suitable for offline viewing.
  • --adjust-extension – Adds suitable extensions to filenames (html or css) depending on their content-type.
  • --page-requisites – Download things like CSS style-sheets and images required to properly display the page offline.
  • --no-parent – When recursing do not ascend to the parent directory. It useful for restricting the download to only a portion of the site.
Alternatively, the command above may be shortened:

wget -mkEpnp http://example.org

Note: that the last p is part of np (--no-parent) and hence you see p twice in the flags.

source: http://www.guyrutenberg.com/2014/05/02/make-offline-mirror-of-a-site-using-wget/

also note the -w flag:

wget -mk -w 1 http://www.example.com
  • -mk    will do mirroring
  • -w 1   wait 1 second in between downloads 

Nohup and Screen

One can use nohup to run files that won't exit when the shell closes; also check out screen!
 
 $ nohup ./somescript.sh &
 $ screen -A -m -d -S somename ./somescript.sh &
 
also see: http://en.wikipedia.org/wiki/Nohup, Advanced Bash Scripting Guide 

Capture and Read STDOUT and STDERR

$> command 2>&1 | tee -a some_file

Vim Hints/Tips

Line Numbering
  (Enable)
  :set number
  :set nu
  (Disable)
  :set nonumber
  :set nonu
  :set !nu
  source: http://vim.wikia.com/wiki/Display_line_numbers

PerlBestPractices 
  (.vimrc)

Shiftwidth
Autoindent

Solarized (coloring)

FileFormat
 :set ff=unix    [unix|dos|mac]
     dos     <CR> <NL>
     unix    <NL>
     mac     <CR>

Enabling Options
http://vim.wikia.com/wiki/Managing_set_options

Miscellaneous

test file format using vim (:set ff?)

solarized and coloring terminals

svn and SVN_EDITOR

Apple/Macs use .bash_profile, not .bashrc (so add link)

Make Offline Mirror of a Site Using `wget`

Use  wget to make an offline mirror of a website

wget --mirror --convert-links --adjust-extension --page-requisites 
--no-parent http://example.org
Explanation of the various flags:
  • --mirror – Makes (among other things) the download recursive.
  • --convert-links – convert all the links (also to stuff like CSS stylesheets) to relative, so it will be suitable for offline viewing.
  • --adjust-extension – Adds suitable extensions to filenames (html or css) depending on their content-type.
  • --page-requisites – Download things like CSS style-sheets and images required to properly display the page offline.
  • --no-parent – When recursing do not ascend to the parent directory. It useful for restricting the download to only a portion of the site.
Alternatively, the command above may be shortened:
wget -mkEpnp http://example.org
Note: that the last p is part of np (--no-parent) and hence you see p twice in the flags.

Configuring KDE to Have Desktop Icons Appear

On the desktop, select "Activities" (either on the menu bar at the bottom of the screen, or on the upper right corner box). Select "+ Create Activity" -> "Templates" -> "Desktop Icons". This selects the new activity "Desktop Icons"; this makes a new icon to appear "Desktop Icon"; when selected, will have the desktop icons appear and when "Desktop" activity is selected, the default desktop with a panel showing the Desktop folder appear.

Steam on Fedora 20

RPM packages are available from RPMFusion for all supported Fedora releases. The package works fine on both i686 and x86_64 systems and already contains support for the S3 Texture compression library for open source drivers (radeon, intel and nouveau) along with all the required libraries to start playing with Steam games. To install, after enabling the RPMFusion repositories, simply issue
sudo yum install steam
Note: There is also a staging repository where additional options are added to the package, like Valve's xpad driver and packages for running the SteamOS client in SteamOS mode. These features might not end up in RPMFusion. The repository is available at negativo17.org.
Source: Valve

Install .deb on Fedora 20

To install a debian package, you first need to convert it from a .deb package to a .rpm package (you may need to install alien first via sudo yum install alien which installs a bunch of perl modules...)
 >$ alien -r package.deb 

Then do the standard yum install:
 >$ sudo yum localinstall package.rpm

Moka Themes and Icons on Fedora 20

The Moka themes that are installed by default via fedy are obsolete.  The current Moka project repositories can be found at http://mokaproject.com/ .

First, install the repository:
su -c "yum-config-manager --add-repo http://mokaproject.com/packages/rpm/moka-stable.repo"
Then you can install the individual parts.
  • faba-icon-theme
  • faba-mono-icons
  • (these are supplemental icons)
  • moka-icon-theme
  • moka-gnome-shell-theme
  • orchis-gtk-theme
  • (requires the Murrine, but it is likely installed: yum search gtk-murrine-engine)
  • moka-cinnamon-theme
  • (!) Update! I don't need moka-cinnamon-theme because Fedora 20 uses gnome-shell - cinnamon is a fork of gnome-shell. Don't bother with this one!
    (!) Warning! I got "No package moka-cinnamon-theme available" when I tried to install this. And indeed, when I went and browsed the repo - I didn't see it under (http://mokaproject.com/packages/rpm/). But, one can download a package (.zip) and install it that way; see note below.

Instal an individual component like so:
su -c "yum install moka-icon-theme"

Notes:


  • Faba's purpose is to serve as a base icon theme to others (such as Moka). It comprises only of a system icons –folders, mimetypes, toolbar icons, etc. To fully experience Moka, it is recommended that you also install Faba Icon Theme.
  • The method shown here is Fedora 20 distribution specific. There are agnostic methods for installation.
  • UPDATE! Don't bother with moka-cinnamon-theme!
    For reference though, I've kept my notes below.
    Because the "preferred" method of downloading the archive doesn't work, I've downloaded the package (moka-cinnamon-theme.zip) and then installed it manually. One can run it as a user and have the theme installed in ~/.themes or as root (so all users can have access to the theme) and it will be installed in /usr/local/share/themes.
    Then you may select "Moka" in the Cinnamon theme preferences, or use the following command:
    gsettings set org.cinnamon.theme name "Moka"
    (BTW, it didn't work because I'm not using cinnamon, and it isn't installed! )
  • To enable the Moka Gnome Shell Theme, I believe you first need to use "Gnome Tweak Tool" to enable User Themes", and then the Moka Gnome Shell Theme can be selected. See here.

Fedora 20 - uses GNOME-Shell

FYI - Fedora 20 uses GNOME-Shell, not Cinnamon (as I thought earlier)! Cinnamon is a fork of GNOME-Shell and might be used by Mint Linux?

Windows Desktop Icons - Auto Arrange

Problem: the desktop icons don't move (you can't drag and move the icons).
Solution: right click the desktop,  click “View”, uncheck “Auto arrange icons”.