Install Git in your home directory :: How to

If you every need to install Git on a server but don’t have root access, follow the below steps to install Git in your home directory

check that you can run gcc – if you get errors then you got to figure something else out

gcc --version

prep your home folder

mkdir ~/src
cd ~/src

make the ~/opt directory – this is where we will install git into

mkdir ~/opt

Get the git source from google code 1.7.8.4 is the latest at the moment and untar

wget http://git-core.googlecode.com/files/git-1.7.8.4.tar.gz
tar -xvzf git-1.7.8.4.tar.gz
cd git-1.7.8.4

run ./configure and tell it to use ~/opt

./configure --prefix=$HOME/opt

now do the install

make install

check git is happy

~/opt/bin/git --version

If it prints out ‘git version 1.7.8.4’ then its all good to go – git is now installed in your home folder

How to: Rotate a video in linux

For the life of me I can't figure out how to flip/rotate a video in linux using any GUI apps

Here's the commandline way to do it

mencoder -ovc lavc -vf rotate=2 -oac copy INPUT.AVI -o OUTPUT.AVI

The rotate=2 can be replaced with whatever option best suits your needs. Rotating video options are below:

0 Rotate by 90 degrees clockwise and flip (default).
1 Rotate by 90 degrees clockwise.
2 Rotate by 90 degrees counterclockwise.
3 Rotate by 90 degrees counterclockwise and flip.

How to disable the GDM pre-login 'music' in Ubuntu 11.04

To get rid of the annoying pre login gdm 'music' in Ubuntu 11.04 just open the 'Startup Applications' from the Control Panel
- click on the logout button on the top right - then select 'System Settings' to get to the Control Panel

Then just untick the 'GNOME Login Sound' option - refer image below
Screenshot

and then option the terminal/commandline and execute this command

sudo -u gdm gconftool-2 --type=bool --set /desktop/gnome/sound/event_sounds false

restart and you won't get those annoying drums

-- old posr --

One annoying issue in Ubuntu 11.04 is that there is no GUI to disable the pre-login sound that GDM (the Ubuntu login screen) makes when it opens.  This 'music' becomes an issue when you work in a quiet environment

from the command line execute 

gksudo gedit /etc/gdm/custom.conf 

and add the line

SoundOnLogin=false

and the [daemon] line

save the file and restart - now you won't hear the pre-login 'music' at the login screen

goodbye jolicloud 1.2, hello ubuntu 11.04

I've been using Jolicloud on my netbook since December and really enjoyed using, that was until Ubuntu 11.04 was releaed 

Whats great in Jolicloud
  • integrated your Google Docs and Dropbox files into your OS like normal files
  • all your apps and preferences are store on jolicloud.com
  • when you reinstall or setup a new laptop all your apps and settings are all auto installed and setup for you
Problems with Jolicloud
  • Apps disappear behind the jolicloud desktop and can't be alt-tab to etc.. - really annoying
  • The jolicloud file browser is really slow and a pain to use
    • yeah it looks nice but plain old nautilus is much better
  • its just not as nice to use as ubuntu with unity desktop
Whats great about Ubuntu `11.04 on a netbook
  • Unity desktop is fantastic - there was tonnes of negative press re Unity before the launch of 11.04
  • Everything pretty much 'just works'
Problems with Ubuntu on a netbook
  • The GDM pre-login sound can't be disabled via a GUI, really annoying when your working in a quiet environment ( i'll post next about how to fix this )
  • On a netbook when you click an app in the The Unity apps launcher on the left its very hard to tell if anything is happening, yeah the background of the icon pulses but on a small screen this is really hard to see.  This needs to be changed so the icon 'jumps' like OSX or something similar so you can actually see something happening after you click it 
  • Needs to be an easy way to find out what the Unity keyboard shortcuts are, Super-W and Super-S are fantastic - but I would never have found them if I didn't read about them in some comments on some a blog
Apart from those minor issues I can't recommend Ubuntu 11.04 enough

Ubuntu / Broadcom slow wifi issue solved

Since upgrading from Ubuntu 9.04 on my HP Mini 2140 I've found that all recent Ubuntu derivatives (Jolicloud etc.) and other recent distros (Fedora 14 etc..) have an issue with the Broadcom wifi drivers where download speed goes back to dial-up level.  If you search ubuntuforums.org you'll find heaps of posts all complaining of slow wifi speed with Broadcom devices (4322 in the case of my HP Mini). most posts have no real solution.

Whats the solution?

Set your wifi router to use G wifi mode.  My router was using N mode - This seems to have issues with the Broadcom wifi drivers, once this was changed to G mode my wifi speeds came straight back to normal levels :)

ack = a better grep "ignores most of the crap you don't want to search"

If you've ever use grep to search a svn directory you'll know the issues re .svn folders, easiest solution is to use ack from http://betterthangrep.com/

Why: 
- refer point 5 below "ack ignores most of the crap you don't want to search" 

How to install:

- "curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 !#:3"

Top reasons to use ack instead of grep.

  • It's blazingly fast because it only searches the stuff you want searched.
  • ack is pure Perl, so it runs on Windows just fine.
  • The standalone version uses no non-standard modules, so you can put it in your ~/bin without fear.
  • Searches recursively through directories by default, while ignoring .svn, CVS and other VCS directories.
    • Which would you rather type?
    • $ grep pattern $(find . -type f | grep -v '\.svn')
    • $ ack pattern
  • ack ignores most of the crap you don't want to search
    • VCS directories
    • blib, the Perl build directory
    • backup files like foo~ and #foo#
    • binary files, core dumps, etc
  • Ignoring .svn directories means that ack is faster than grep for searching through trees
  • Lets you specify file types to search, as in --perl or --nohtml
    • Which would you rather type?
    • $ grep pattern $(find . -name '*.pl' -or -name '*.pm' -or -name '*.pod' | grep -v .svn)
    • $ ack --perl pattern
    • Note that ack's --perl also checks the shebang lines of files without suffixes, which the find command will not
  • File-filtering capabilities usable without searching with ack -f. This lets you create lists of files of a given type
    • $ ack -f --perl > all-perl-files
  • Color highlighting of search results
enjoy

.htaccess and Apache VirtualDocumentRoot

If you using VirtualDocumentRoot in your Apache set you need to make a minor change to your .htaccess rewrites to make them work 
- just add a slash before the url and it'll work 

refer below

from: 
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)$ index.php?module=$1&view=$2 [L]

to: 
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)$ /index.php?module=$1&view=$2 [L]

Connecting to an OpenVPN (untangle) network from linux: How to

Just connected to an OpenVPN (untangle) network from linux and it was super easy (way easier than a normal cisco vpn anyway)

All you have to do is:

install the openvpn client for your distro and  get your config files from the network admin
-- the files should look somethign like below
--- replace 'xyz-co' with and 'you' with your username

xyz-co.conf
xyz-co.ovpn
untangle-vpn/
untangle-vpn/xyz-co-ca.crt
untangle-vpn/xyz-co-you.crt
untangle-vpn/xyz-co-you.key

copy the above files into your /etc/openvpn directory

then connect using the below command

sudo openvpn /etc/openvpn/xyz-co.conf

all done - too easy

shell script to check if ExLibris Aleph is running OK

If you have to admin Aleph from ExLibris you may be wondering why there is minimal tools to help you make sure its all running ok

Below is a simple shell script that checks various 'ue_' process (PC server, publishing, etc..) and emails if they are down

Add this to your crontab to run each 15 minutes or so

Note:
- replace the email address with your email address
- replace LIB with your 3 character library code
- add/remove ue_ sections as you need

#!/bin/bash

SUBJECT='Aleph: alert'
TO='youremailaddress@you.com'

if [[ $ps =~ "ue_21_a_LIB30" ]]
then
        echo LIB30 ue_21 all OK
else
        message="LIB30 ue_21 is not running
"
fi

if [[ $ps =~ "ue_21_a_LIB01" ]]
then
        echo LIB01 ue_21 all OK
else
        message="${message}
LIB01 ue_21 is not running"
fi


if [[ $ps =~ "ue_08_a_LIB01" ]]
then
        echo LIB01 ue_08 all OK
else
        message="${message}
LIB01 ue_08 is not running"
fi

if [[ $ps =~ "ue_08_a_LIB10" ]]
then
        echo LIB10 ue_08  all OK
else
        message="${message}
LIB10 ue_08 is not running"
fi

if [[ $ps =~ "ue_06_a_LIB50" ]]
then
        echo LIB50 ue_06  all OK
else
        message="${message}
LIB50 ue_06 is not running"
fi

if [[ $ps =~ "-d_/exlibris/aleph/u20_1/alephe/apache" ]]
then
        echo Apache looks OK
else
        message="${message}
Apache doesn't look to be running"
fi

if [[ $ps =~ "-f_/exlibris/aleph/a20_1/aleph/proc/pc_server" ]]
then
        echo PC_Server looks  all OK
else
        message="${message}
PC_Server doen't look to be running"
fi

if [[ $ps =~ "-f_/exlibris/aleph/a20_1/aleph/proc/www_server" ]]
then
        echo www_server looks all OK
else
        message="${message}
wwww_server doens't look to be running"
fi

if [[ $ps =~ "-f_/exlibris/aleph/a20_1/aleph/proc/sip2_server" ]]
then
        echo SIP2 looks OK
else
        message="${message}
SIP2 doesn't look to be running"
fi

if [[ $ps =~ "-f_/exlibris/aleph/a20_1/aleph/proc/oclc_server" ]]
then
        echo OCLC server looks OK
else
        message="${message}
OCLC server doesn't look to be running"
fi

if [[ $ps =~ "-f_/exlibris/aleph/a20_1/aleph/proc/ncip_server" ]]
then
        echo NCIP server looks OK
else
        message="${message}
NCIP server doesn't look to be running"
fi

if [[ $ps =~ "-f_/exlibris/aleph/a20_1/aleph/proc/sru_server" ]]
then
        echo SRU server looks OK
else
        message="${message}
SRU server doesn't look to be running"
fi

if [[ $ps =~ "-f_/exlibris/aleph/a20_1/aleph/proc/z39_server" ]]
then
        echo Z39 server looks OK
else
        message="${message}
Z39 server doesn't look to be running"
fi

if [[ $ps =~ "ue_01_a_LIB01.a20_1" ]]
then
        echo LIB01 indexing looks OK
else
        message="${message}
LIB01 indexing doesn't look to be running"
fi

if [[ $ps =~ "ue_01_a_LIB10.a20_1" ]]
then
        echo LIB10 indexing looks OK
else
        message="${message}
LIB10 indexing doesn't look to be running"
fi

if [[ $ps =~ "ue_01_a_LIB30.a20_1" ]]
then
        echo LIB30 indexing looks OK
else
        message="${message}
LIB30 indexing doesn't look to be running"
fi

if [[ -n $message ]]
then
        echo $message
        /bin/mail -s "$SUBJECT" "$TO" <<EOM
        $message
EOM
else
        echo "No email needs to be sent - all working OK"
fi